summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-08-15 17:31:24 -0500
committerEd Leafe <ed@leafe.com>2011-08-15 17:31:24 -0500
commitd8a156f9ed0729c4c5553fe3b28f6c3afb93d54f (patch)
tree032c110499fcaa3996fcc20b654be68bde4cd338
parent32461499f0a66debdfcf54bab0bf78ef6c806238 (diff)
pep8 cleanup
-rw-r--r--nova/compute/manager.py3
-rw-r--r--nova/scheduler/abstract_scheduler.py6
-rw-r--r--nova/scheduler/filters/abstract_filter.py4
-rw-r--r--nova/scheduler/host_filter.py1
-rw-r--r--nova/tests/scheduler/test_host_filter.py5
-rw-r--r--nova/tests/scheduler/test_least_cost_scheduler.py3
-rw-r--r--nova/virt/libvirt/connection.py3
7 files changed, 12 insertions, 13 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 16b8e14b4..52fcf5c49 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -1315,7 +1315,8 @@ class ComputeManager(manager.SchedulerDependentManager):
# This nwfilter is necessary on the destination host.
# In addition, this method is creating filtering rule
# onto destination host.
- self.driver.ensure_filtering_rules_for_instance(instance_ref, network_info)
+ self.driver.ensure_filtering_rules_for_instance(instance_ref,
+ network_info)
# Preparation for block migration
if block_migration:
diff --git a/nova/scheduler/abstract_scheduler.py b/nova/scheduler/abstract_scheduler.py
index 2f1ede0a4..77db67773 100644
--- a/nova/scheduler/abstract_scheduler.py
+++ b/nova/scheduler/abstract_scheduler.py
@@ -15,7 +15,7 @@
"""
The AbsractScheduler is an abstract class Scheduler for creating instances
-locally or across zones. Two methods should be overridden in order to
+locally or across zones. Two methods should be overridden in order to
customize the behavior: filter_hosts() and weigh_hosts(). The default
behavior is to simply select all hosts and weight them the same.
"""
@@ -298,8 +298,8 @@ class AbstractScheduler(driver.Scheduler):
def filter_hosts(self, topic, request_spec, host_list):
"""Filter the full host list returned from the ZoneManager. By default,
this method only applies the basic_ram_filter(), meaning all hosts
- with at least enough RAM for the requested instance are returned.
-
+ with at least enough RAM for the requested instance are returned.
+
Override in subclasses to provide greater selectivity.
"""
def basic_ram_filter(hostname, capabilities, request_spec):
diff --git a/nova/scheduler/filters/abstract_filter.py b/nova/scheduler/filters/abstract_filter.py
index d9d272130..a1d00d562 100644
--- a/nova/scheduler/filters/abstract_filter.py
+++ b/nova/scheduler/filters/abstract_filter.py
@@ -18,10 +18,10 @@ import nova.scheduler
from nova import flags
FLAGS = flags.FLAGS
-flags.DEFINE_string('default_host_filter',
- 'AllHostsFilter',
+flags.DEFINE_string('default_host_filter', 'AllHostsFilter',
'Which filter to use for filtering hosts')
+
class AbstractHostFilter(object):
"""Base class for host filters."""
def instance_type_to_filter(self, instance_type):
diff --git a/nova/scheduler/host_filter.py b/nova/scheduler/host_filter.py
index be618f3f3..4bc5158cc 100644
--- a/nova/scheduler/host_filter.py
+++ b/nova/scheduler/host_filter.py
@@ -39,6 +39,7 @@ FLAGS = flags.FLAGS
def _get_filters():
# Imported here to avoid circular imports
from nova.scheduler import filters
+
def get_itm(nm):
return getattr(filters, nm)
diff --git a/nova/tests/scheduler/test_host_filter.py b/nova/tests/scheduler/test_host_filter.py
index a961b1b06..17431fc7e 100644
--- a/nova/tests/scheduler/test_host_filter.py
+++ b/nova/tests/scheduler/test_host_filter.py
@@ -187,11 +187,6 @@ class HostFilterTestCase(test.TestCase):
raw = ['in', '$compute.host_memory_free', 20, 40, 60, 80, 100]
cooked = json.dumps(raw)
- def debug(*args):
- with file("/tmp/debug", "a") as dbg:
- msg = " ".join([str(arg) for arg in args])
- dbg.write("%s\n" % msg)
-
hosts = hf.filter_hosts(self.zone_manager, cooked)
self.assertEquals(5, len(hosts))
just_hosts = [host for host, caps in hosts]
diff --git a/nova/tests/scheduler/test_least_cost_scheduler.py b/nova/tests/scheduler/test_least_cost_scheduler.py
index d6eaaa223..af58de527 100644
--- a/nova/tests/scheduler/test_least_cost_scheduler.py
+++ b/nova/tests/scheduler/test_least_cost_scheduler.py
@@ -139,7 +139,8 @@ class LeastCostSchedulerTestCase(test.TestCase):
# free ram will cost 1/N more. Since the lowest cost host has some
# free ram, we add in the 1/N for the base_cost
weight = 0.1 + (0.1 * idx)
- wtd_dict = dict(hostname=hostname, weight=weight, capabilities=caps)
+ wtd_dict = dict(hostname=hostname, weight=weight,
+ capabilities=caps)
expected.append(wtd_dict)
self.assertWeights(expected, num, request_spec, hosts)
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index 2b17e244a..c009641ef 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -1539,7 +1539,8 @@ class LibvirtConnection(driver.ComputeDriver):
# basic-filtering must be set here.
self.firewall_driver.setup_basic_filtering(instance_ref, network_info)
# setting up n)ova-instance-instance-xx mainly.
- self.firewall_driver.prepare_instance_filter(instance_ref, network_info)
+ self.firewall_driver.prepare_instance_filter(instance_ref,
+ network_info)
# wait for completion
timeout_count = range(FLAGS.live_migration_retry_count)