diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-08-03 16:28:00 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-08-06 15:09:33 -0400 |
| commit | 0cee422e2e452d31a6aad1644cf38c2a669e99cb (patch) | |
| tree | 6debc0013c261e3afd41ee879b140ee0fdc4676f /nova/compute | |
| parent | ce2da5e52b743a15d87bab8b7546449ceb4e6871 (diff) | |
Use explicit arguments in compute manager run_instance.
Use explicit arguments in functions in the run_instance code path of the
compute manager. I think methods of the rpc API are better this way as
we have to be careful when changing these functions so we handle
versioning and backwards compatibility properly. Spelling out all of
the arguments like this makes it easier to catch when things change and
to make sure they are changed properly.
This is in preparation of changing the instance_uuid to an instance
dict, instead.
Part of blueprint no-db-messaging.
Change-Id: I1e141b471040b0fd4833d4e08d44166a9d12bcad
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 0f24a2546..f6e3ff9cf 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -496,12 +496,9 @@ class ComputeManager(manager.SchedulerDependentManager): 'block_device_mapping': block_device_mapping } - def _run_instance(self, context, instance_uuid, - requested_networks=None, - injected_files=[], - admin_password=None, - is_first_time=False, - **kwargs): + def _run_instance(self, context, instance_uuid, request_spec, + filter_properties, requested_networks, injected_files, + admin_password, is_first_time): """Launch a new instance with specified options.""" context = context.elevated() try: @@ -526,7 +523,7 @@ class ComputeManager(manager.SchedulerDependentManager): # try to re-schedule instance: self._reschedule_or_reraise(context, instance, requested_networks, admin_password, injected_files, - is_first_time, **kwargs) + is_first_time, request_spec, filter_properties) else: # Spawn success: if (is_first_time and not instance['access_ip_v4'] @@ -542,7 +539,9 @@ class ComputeManager(manager.SchedulerDependentManager): with excutils.save_and_reraise_exception(): self._set_instance_error_state(context, instance_uuid) - def _reschedule_or_reraise(self, context, instance, *args, **kwargs): + def _reschedule_or_reraise(self, context, instance, requested_networks, + admin_password, injected_files, is_first_time, + request_spec, filter_properties): """Try to re-schedule the build or re-raise the original build error to error out the instance. """ @@ -563,8 +562,9 @@ class ComputeManager(manager.SchedulerDependentManager): raise try: - rescheduled = self._reschedule(context, instance_uuid, *args, - **kwargs) + rescheduled = self._reschedule(context, instance_uuid, + requested_networks, admin_password, injected_files, + is_first_time, request_spec, filter_properties) except Exception: rescheduled = False LOG.exception(_("Error trying to reschedule"), @@ -578,9 +578,9 @@ class ComputeManager(manager.SchedulerDependentManager): raise type_, value, tb def _reschedule(self, context, instance_uuid, requested_networks, - admin_password, injected_files, is_first_time, **kwargs): + admin_password, injected_files, is_first_time, request_spec, + filter_properties): - filter_properties = kwargs.get('filter_properties', {}) retry = filter_properties.get('retry', None) if not retry: # no retry information, do not reschedule. @@ -588,7 +588,6 @@ class ComputeManager(manager.SchedulerDependentManager): instance_uuid=instance_uuid) return - request_spec = kwargs.get('request_spec', None) if not request_spec: LOG.debug(_("No request spec, will not reschedule"), instance_uuid=instance_uuid) @@ -825,10 +824,15 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @wrap_instance_fault - def run_instance(self, context, instance_uuid, **kwargs): + def run_instance(self, context, instance_uuid, request_spec=None, + filter_properties={}, requested_networks=None, + injected_files=[], admin_password=None, + is_first_time=False): @utils.synchronized(instance_uuid) def do_run_instance(): - self._run_instance(context, instance_uuid, **kwargs) + self._run_instance(context, instance_uuid, request_spec, + filter_properties, requested_networks, injected_files, + admin_password, is_first_time) do_run_instance() def _shutdown_instance(self, context, instance): |
