diff options
| author | Alex Meade <alex.meade@rackspace.com> | 2011-11-23 14:40:46 -0500 |
|---|---|---|
| committer | Alex Meade <alex.meade@rackspace.com> | 2011-11-23 14:42:43 -0500 |
| commit | 25efaa8f8ae6954b10fb9317d09d3b65481b8053 (patch) | |
| tree | c47ccb31292ffbadb0fdaec7f400240e761dbcce /nova/compute | |
| parent | 1670bccfa42c48e964c691e94c76359d56a73e59 (diff) | |
rescue/unrescue in compute manager to use uuids
Related to blueprint internal-uuids.
Change-Id: I9e2861a463cdf42c8abcc7a408699fdcfdc62ea2
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 10 | ||||
| -rw-r--r-- | nova/compute/manager.py | 20 |
2 files changed, 15 insertions, 15 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 60a54ae91..a22a78860 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1416,7 +1416,6 @@ class API(base.Base): @scheduler_api.reroute_compute("rescue") def rescue(self, context, instance, rescue_password=None): """Rescue the given instance.""" - instance_id = instance['id'] self.update(context, instance, vm_state=vm_states.ACTIVE, @@ -1425,18 +1424,19 @@ class API(base.Base): rescue_params = { "rescue_password": rescue_password } - self._cast_compute_message('rescue_instance', context, instance_id, - params=rescue_params) + self._cast_compute_message('rescue_instance', context, + instance['uuid'], + params=rescue_params) @scheduler_api.reroute_compute("unrescue") def unrescue(self, context, instance): """Unrescue the given instance.""" - instance_id = instance['id'] self.update(context, instance, vm_state=vm_states.RESCUED, task_state=task_states.UNRESCUING) - self._cast_compute_message('unrescue_instance', context, instance_id) + self._cast_compute_message('unrescue_instance', context, + instance['uuid']) @scheduler_api.reroute_compute("set_admin_password") def set_admin_password(self, context, instance, password=None): diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 2f0b0c71c..d149425b7 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -925,17 +925,17 @@ class ComputeManager(manager.SchedulerDependentManager): self.driver.agent_update(instance_ref, url, md5hash) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - @checks_instance_lock - def rescue_instance(self, context, instance_id, **kwargs): + @checks_instance_lock_uuid + def rescue_instance(self, context, instance_uuid, **kwargs): """ Rescue an instance on this host. :param rescue_password: password to set on rescue instance """ - LOG.audit(_('instance %s: rescuing'), instance_id, context=context) + LOG.audit(_('instance %s: rescuing'), instance_uuid, context=context) context = context.elevated() - instance_ref = self.db.instance_get(context, instance_id) + instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) instance_ref.admin_pass = kwargs.get('rescue_password', utils.generate_password(FLAGS.password_length)) network_info = self._get_instance_nw_info(context, instance_ref) @@ -944,26 +944,26 @@ class ComputeManager(manager.SchedulerDependentManager): current_power_state = self._get_power_state(context, instance_ref) self._instance_update(context, - instance_id, + instance_uuid, vm_state=vm_states.RESCUED, task_state=None, power_state=current_power_state) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - @checks_instance_lock - def unrescue_instance(self, context, instance_id): + @checks_instance_lock_uuid + def unrescue_instance(self, context, instance_uuid): """Rescue an instance on this host.""" - LOG.audit(_('instance %s: unrescuing'), instance_id, context=context) + LOG.audit(_('instance %s: unrescuing'), instance_uuid, context=context) context = context.elevated() - instance_ref = self.db.instance_get(context, instance_id) + instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) network_info = self._get_instance_nw_info(context, instance_ref) self.driver.unrescue(instance_ref, network_info) current_power_state = self._get_power_state(context, instance_ref) self._instance_update(context, - instance_id, + instance_uuid, vm_state=vm_states.ACTIVE, task_state=None, power_state=current_power_state) |
