diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-11-07 15:47:09 -0500 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-11-07 15:47:09 -0500 |
| commit | eef2dfa580c1a675efc2af46830547befe89dd0f (patch) | |
| tree | ddd14381135bd6bae8f901cb92ea92e1fce72840 /nova/compute | |
| parent | d90aaaafbc11c8e951ccde27cac11f70ae65c9b2 (diff) | |
Set task state to UPDATING_PASSWORD when needed
Fixes bug 885389
Change-Id: Ia4b91fc8ccc55cac4f484f64c73398e803480eac
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 4 | ||||
| -rw-r--r-- | nova/compute/manager.py | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 0d6498693..a92b2123c 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1436,6 +1436,10 @@ class API(base.Base): @scheduler_api.reroute_compute("set_admin_password") def set_admin_password(self, context, instance_id, password=None): """Set the root/admin password for the given instance.""" + self.update(context, + instance_id, + task_state=task_states.UPDATING_PASSWORD) + host = self._find_host(context, instance_id) rpc.cast(context, diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 4a51147a2..f03a482e6 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -825,18 +825,25 @@ class ComputeManager(manager.SchedulerDependentManager): expected_state = power_state.RUNNING if instance_state != expected_state: + self._instance_update(context, instance_id, task_state=None) raise exception.Error(_('Instance is not running')) else: try: self.driver.set_admin_password(instance_ref, new_pass) LOG.audit(_("Instance %s: Root password set"), instance_ref["name"]) + self._instance_update(context, + instance_id, + task_state=None) break except NotImplementedError: # NOTE(dprince): if the driver doesn't implement # set_admin_password we break to avoid a loop LOG.warn(_('set_admin_password is not implemented ' - 'by this driver.')) + 'by this driver.')) + self._instance_update(context, + instance_id, + task_state=None) break except Exception, e: # Catch all here because this could be anything. @@ -845,6 +852,9 @@ class ComputeManager(manager.SchedulerDependentManager): # At some point this exception may make it back # to the API caller, and we don't want to reveal # too much. The real exception is logged above + self._instance_update(context, + instance_id, + vm_state=vm_states.ERROR) raise exception.Error(_('Internal error')) time.sleep(1) continue |
