indenting cleanup
This commit is contained in:
@@ -360,4 +360,4 @@ DEFINE_string('node_availability_zone', 'nova',
|
|||||||
DEFINE_string('zone_name', 'nova', 'name of this zone')
|
DEFINE_string('zone_name', 'nova', 'name of this zone')
|
||||||
DEFINE_list('zone_capabilities',
|
DEFINE_list('zone_capabilities',
|
||||||
['hypervisor=xenserver;kvm', 'os=linux;windows'],
|
['hypervisor=xenserver;kvm', 'os=linux;windows'],
|
||||||
'Key/Multi-value list representng capabilities of this zone')
|
'Key/Multi-value list representng capabilities of this zone')
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ from nova.scheduler import api
|
|||||||
|
|
||||||
FLAGS = flags.FLAGS
|
FLAGS = flags.FLAGS
|
||||||
|
|
||||||
|
LOG = logging.getLogger('nova.manager')
|
||||||
|
|
||||||
|
|
||||||
class Manager(base.Base):
|
class Manager(base.Base):
|
||||||
def __init__(self, host=None, db_driver=None):
|
def __init__(self, host=None, db_driver=None):
|
||||||
@@ -83,6 +85,7 @@ class SchedulerDependentManager(Manager):
|
|||||||
should derive from this class. Otherwise they can derive from
|
should derive from this class. Otherwise they can derive from
|
||||||
manager.Manager directly. Updates are only sent after
|
manager.Manager directly. Updates are only sent after
|
||||||
update_service_capabilities is called with non-None values."""
|
update_service_capabilities is called with non-None values."""
|
||||||
|
|
||||||
def __init__(self, host=None, db_driver=None, service_name="undefined"):
|
def __init__(self, host=None, db_driver=None, service_name="undefined"):
|
||||||
self.last_capabilities = None
|
self.last_capabilities = None
|
||||||
self.service_name = service_name
|
self.service_name = service_name
|
||||||
@@ -95,7 +98,7 @@ class SchedulerDependentManager(Manager):
|
|||||||
def periodic_tasks(self, context=None):
|
def periodic_tasks(self, context=None):
|
||||||
"""Pass data back to the scheduler at a periodic interval"""
|
"""Pass data back to the scheduler at a periodic interval"""
|
||||||
if self.last_capabilities:
|
if self.last_capabilities:
|
||||||
logging.debug(_("Notifying Schedulers of capabilities ..."))
|
LOG.debug(_("Notifying Schedulers of capabilities ..."))
|
||||||
api.update_service_capabilities(context, self.service_name,
|
api.update_service_capabilities(context, self.service_name,
|
||||||
self.host, self.last_capabilities)
|
self.host, self.last_capabilities)
|
||||||
|
|
||||||
|
|||||||
@@ -219,8 +219,8 @@ class FanoutAdapterConsumer(AdapterConsumer):
|
|||||||
self.queue = "%s_fanout_%s" % (topic, unique)
|
self.queue = "%s_fanout_%s" % (topic, unique)
|
||||||
self.durable = False
|
self.durable = False
|
||||||
LOG.info(_("Created '%(exchange)s' fanout exchange "
|
LOG.info(_("Created '%(exchange)s' fanout exchange "
|
||||||
"with '%(key)s' routing key"),
|
"with '%(key)s' routing key"),
|
||||||
dict(exchange=self.exchange, key=self.routing_key))
|
dict(exchange=self.exchange, key=self.routing_key))
|
||||||
super(FanoutAdapterConsumer, self).__init__(connection=connection,
|
super(FanoutAdapterConsumer, self).__init__(connection=connection,
|
||||||
topic=topic, proxy=proxy)
|
topic=topic, proxy=proxy)
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ def get_zone_capabilities(context, service=None):
|
|||||||
"""Returns a dict of key, value capabilities for this zone,
|
"""Returns a dict of key, value capabilities for this zone,
|
||||||
or for a particular class of services running in this zone."""
|
or for a particular class of services running in this zone."""
|
||||||
return _call_scheduler('get_zone_capabilities', context=context,
|
return _call_scheduler('get_zone_capabilities', context=context,
|
||||||
params=dict(service=service))
|
params=dict(service=service))
|
||||||
|
|
||||||
|
|
||||||
def update_service_capabilities(context, service_name, host, capabilities):
|
def update_service_capabilities(context, service_name, host, capabilities):
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class ZoneManagerTestCase(test.TestCase):
|
|||||||
zm.update_service_capabilities("svc10", "host1", dict(a=99, b=99))
|
zm.update_service_capabilities("svc10", "host1", dict(a=99, b=99))
|
||||||
caps = zm.get_zone_capabilities(self, None)
|
caps = zm.get_zone_capabilities(self, None)
|
||||||
self.assertEquals(caps, dict(svc1_a=(2, 20), svc1_b=(3, 30),
|
self.assertEquals(caps, dict(svc1_a=(2, 20), svc1_b=(3, 30),
|
||||||
svc10_a=(99, 99), svc10_b=(99, 99)))
|
svc10_a=(99, 99), svc10_b=(99, 99)))
|
||||||
|
|
||||||
zm.update_service_capabilities("svc1", "host3", dict(c=5))
|
zm.update_service_capabilities("svc1", "host3", dict(c=5))
|
||||||
caps = zm.get_zone_capabilities(self, None)
|
caps = zm.get_zone_capabilities(self, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user