From 9a2c944be8e7187a12bfd363a2a74325403e00d8 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Mon, 23 May 2011 22:30:01 -0700 Subject: select partially going through --- nova/scheduler/api.py | 4 ++-- nova/scheduler/manager.py | 4 ++++ nova/scheduler/zone_aware_scheduler.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nova/scheduler/api.py b/nova/scheduler/api.py index f9a4f238b..f5b570dbd 100644 --- a/nova/scheduler/api.py +++ b/nova/scheduler/api.py @@ -85,7 +85,7 @@ def get_zone_capabilities(context): def select(context, specs=None): """Returns a list of hosts.""" return _call_scheduler('select', context=context, - params={"specs": specs}) + params={"request_spec": specs}) def update_service_capabilities(context, service_name, host, capabilities): @@ -137,7 +137,7 @@ def call_zone_method(context, method, errors_to_ignore=None, *args, **kwargs): def _error_trap(*args, **kwargs): try: - LOG.warn(_("*** CALLING ZONE") % locals())#asdads + LOG.warn(_("*** CALLING ZONE %(args)s ^^ %(kwargs)s") % locals())#asdads return zone_method(*args, **kwargs) except Exception as e: if type(e) in errors_to_ignore: diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index 96e69566d..db8c41e71 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -70,6 +70,10 @@ class SchedulerManager(manager.Manager): self.zone_manager.update_service_capabilities(service_name, host, capabilities) + def select(self, context=None, *args, **kwargs): + """Select a list of hosts best matching the provided specs.""" + return self.driver.select(context, *args, **kwargs) + def _schedule(self, method, context, topic, *args, **kwargs): """Tries to call schedule_* method on the driver to retrieve host. diff --git a/nova/scheduler/zone_aware_scheduler.py b/nova/scheduler/zone_aware_scheduler.py index 6c666d1a8..c6f2935b7 100644 --- a/nova/scheduler/zone_aware_scheduler.py +++ b/nova/scheduler/zone_aware_scheduler.py @@ -21,6 +21,7 @@ across zones. There are two expansion points to this class for: """ import operator +import json import M2Crypto from nova import crypto @@ -199,10 +200,11 @@ class ZoneAwareScheduler(driver.Scheduler): # weighted = [{weight=weight, name=hostname}, ...] weighted = self.weigh_hosts(num_instances, request_spec, host_list) - LOG.debug(_("XXXXXXX - 3 - _SCHEDULE")) + LOG.debug(_("XXXXXXX - 3 - _SCHEDULE >> %s") % request_spec) # Next, tack on the best weights from the child zones ... + json_spec = json.dumps(request_spec) child_results = self._call_zone_method(context, "select", - specs=request_spec) + specs=json_spec) LOG.debug(_("XXXXXXX - 4 - _SCHEDULE - CHILD RESULTS %(child_results)s") % locals()) for child_zone, result in child_results: for weighting in result: -- cgit