From 48a3ec6e55f029578d5dc8ef7fe2e9fbe0de1b81 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Tue, 24 May 2011 12:05:46 -0700 Subject: more fix up --- nova/api/openstack/servers.py | 1 - nova/api/openstack/zones.py | 2 +- nova/compute/api.py | 1 - nova/scheduler/api.py | 4 ---- nova/scheduler/zone_aware_scheduler.py | 41 +++++++++++++++++++++------------- nova/service.py | 2 -- 6 files changed, 26 insertions(+), 25 deletions(-) (limited to 'nova') diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index f3fa36028..8d5e78d3a 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -189,7 +189,6 @@ class Controller(common.OpenstackController): inst['instance_type'] = inst_type inst['image_id'] = requested_image_id - # TODO(sandy): REMOVE THIS LOG.debug(_("***** API.OPENSTACK.SERVER.CREATE = %(inst)s") % locals()) #pep8 builder = self._get_view_builder(req) diff --git a/nova/api/openstack/zones.py b/nova/api/openstack/zones.py index 96a6552b3..f8867f5a4 100644 --- a/nova/api/openstack/zones.py +++ b/nova/api/openstack/zones.py @@ -119,7 +119,7 @@ class Controller(common.OpenstackController): ctx = req.environ['nova.context'] json_specs = json.loads(req.body) specs = json.loads(json_specs) - LOG.debug("INCOMING SELECT '%s'" % specs) + LOG.debug("NOVA.API.OPENSTACK.ZONES.SELECT '%s'" % specs)#pep8 build_plan = api.select(ctx, specs=specs) cooked = self._scrub_build_plan(build_plan) return {"weights": cooked} diff --git a/nova/compute/api.py b/nova/compute/api.py index 301c777bb..d66ee7920 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -264,7 +264,6 @@ class API(base.Base): 'filter_driver': filter_driver, 'blob': zone_blob } - LOG.debug(_("**** REQUEST SPEC: %(request_spec)s") % locals()) rpc.cast(context, FLAGS.scheduler_topic, diff --git a/nova/scheduler/api.py b/nova/scheduler/api.py index f5b570dbd..24d7ed0d6 100644 --- a/nova/scheduler/api.py +++ b/nova/scheduler/api.py @@ -18,7 +18,6 @@ Handles all requests relating to schedulers. """ import novaclient -import traceback #nuke from nova import db from nova import exception @@ -125,7 +124,6 @@ def call_zone_method(context, method, errors_to_ignore=None, *args, **kwargs): nova = novaclient.OpenStack(zone.username, zone.password, zone.api_url) nova.authenticate() - LOG.warn(_("*** AUTHENTICATED") % locals())#asdads except novaclient.exceptions.BadRequest, e: url = zone.api_url LOG.warn(_("Failed request to zone; URL=%(url)s: %(e)s") @@ -137,13 +135,11 @@ def call_zone_method(context, method, errors_to_ignore=None, *args, **kwargs): def _error_trap(*args, **kwargs): try: - 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: return None ex = traceback.format_exc(e) - LOG.warn(_("*** CAUGHT EXCEPTION %(ex)s") % locals())#asdads # TODO (dabo) - want to be able to re-raise here. # Returning a string now; raising was causing issues. # raise e diff --git a/nova/scheduler/zone_aware_scheduler.py b/nova/scheduler/zone_aware_scheduler.py index 1a96c56c3..3dd43443a 100644 --- a/nova/scheduler/zone_aware_scheduler.py +++ b/nova/scheduler/zone_aware_scheduler.py @@ -84,7 +84,7 @@ class ZoneAwareScheduler(driver.Scheduler): kwargs) return - self._provision_resource_in_child_zone(context, item, instance_id, + self._provision_resource_from_blob(context, item, instance_id, request_spec, kwargs) def _provision_resource_locally(self, context, item, instance_id, kwargs): @@ -95,20 +95,24 @@ class ZoneAwareScheduler(driver.Scheduler): db.queue_get_for(context, "compute", host), {"method": "run_instance", "args": kwargs}) - LOG.debug(_("Casted to compute %(host)s for run_instance") + LOG.debug(_("Provisioning locally via compute node %(host)s") % locals()) - def _provision_resource_in_child_zone(self, context, item, instance_id, + def _provision_resource_from_blob(self, context, item, instance_id, request_spec, kwargs): - """Create the requested resource in a child zone.""" - # Start by attempting to decrypt the blob to see if this - # request is: - # 1. valid, - # 2. intended for this zone or a child zone. - # if 2 ... forward call to child zone. - # Note: If we have "blob" that means the request was passed - # into us. If we have "child_blob" that means we just asked - # the child zone for the weight info. + """Create the requested resource locally or in a child zone + based on what is stored in the zone blob info. + + Attempt to decrypt the blob to see if this request is: + 1. valid, and + 2. intended for this zone or a child zone. + + Note: If we have "blob" that means the request was passed + into us from a parent zone. If we have "child_blob" that + means we gathered the info from one of our children. + It's possible that, when we decrypt the 'blob' field, it + contains "child_blob" data. In which case we forward the + request.""" if "blob" in item: # Request was passed in from above. Is it for us? @@ -139,11 +143,14 @@ class ZoneAwareScheduler(driver.Scheduler): def _ask_child_zone_to_create_instance(self, context, zone_info, request_spec, kwargs): + """Once we have determined that the request should go to one + of our children, we need to fabricate a new POST /servers/ + call with the same parameters that were passed into us. + + Note that we have to reverse engineer from our args to get back the + image, flavor, ipgroup, etc. since the original call could have + come in from EC2 (which doesn't use these things).""" - # Note: we have to reverse engineer from our args to get back the - # image, flavor, ipgroup, etc. since the original call could have - # come in from EC2 (which doesn't use these things). - LOG.debug(_("****** ASK CHILD %(zone_info)s ** %(request_spec)s") % locals()) instance_type = request_spec['instance_type'] instance_properties = request_spec['instance_properties'] @@ -159,6 +166,8 @@ class ZoneAwareScheduler(driver.Scheduler): child_blob = zone_info['child_blob'] zone = db.zone_get(context, child_zone) url = zone.api_url + LOG.debug(_("Forwarding instance create call to child zone %(url)s") + % locals()) nova = None try: nova = novaclient.OpenStack(zone.username, zone.password, url) diff --git a/nova/service.py b/nova/service.py index 93020d94f..2532b9df2 100644 --- a/nova/service.py +++ b/nova/service.py @@ -132,9 +132,7 @@ class Service(object): self.service_id = service_ref['id'] def __getattr__(self, key): - logging.warn(_('SERVICE __GETATTR__ %s') % (key, )) manager = self.__dict__.get('manager', None) - logging.warn(_('SERVICE MANAGER %s') % (manager, )) return getattr(manager, key) @classmethod -- cgit