diff options
| author | Rick Harris <rconradharris@gmail.com> | 2011-09-16 19:45:46 +0000 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2011-09-16 19:45:46 +0000 |
| commit | 9f2ef26d5e4e34c26bd3c8fe62b81bd6409de2c5 (patch) | |
| tree | cfdd3d3612c680c9a2ca68cd6dcbb1464690e0cc /nova/compute | |
| parent | f31b37c80a9ef0c4ba07940897388094e5ed052c (diff) | |
| parent | 8c5c5bb4dd8b8c53fb3ed0bbed5598da55fab12b (diff) | |
Merging trunk
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 11 | ||||
| -rw-r--r-- | nova/compute/manager.py | 12 |
2 files changed, 16 insertions, 7 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 8b3306409..1ecf1e2e3 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1052,7 +1052,7 @@ class API(base.Base): vm_state=vm_states.ACTIVE, task_state=task_states.REBOOTING) self._cast_compute_message('reboot_instance', context, instance_id, - reboot_type) + params={'reboot_type': reboot_type}) @scheduler_api.reroute_compute("rebuild") def rebuild(self, context, instance_id, image_href, admin_password, @@ -1277,13 +1277,18 @@ class API(base.Base): self._cast_compute_message('resume_instance', context, instance_id) @scheduler_api.reroute_compute("rescue") - def rescue(self, context, instance_id): + def rescue(self, context, instance_id, rescue_password=None): """Rescue the given instance.""" self.update(context, instance_id, vm_state=vm_states.ACTIVE, task_state=task_states.RESCUING) - self._cast_compute_message('rescue_instance', context, instance_id) + + rescue_params = { + "rescue_password": rescue_password + } + self._cast_compute_message('rescue_instance', context, instance_id, + params=rescue_params) @scheduler_api.reroute_compute("unrescue") def unrescue(self, context, instance_id): diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d80fa6e70..46c85889b 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -70,8 +70,6 @@ flags.DEFINE_string('compute_driver', 'nova.virt.connection.get_connection', 'Driver to use for controlling virtualization') flags.DEFINE_string('stub_network', False, 'Stub network related code') -flags.DEFINE_integer('password_length', 12, - 'Length of generated admin passwords') flags.DEFINE_string('console_host', socket.gethostname(), 'Console proxy host to use to connect to instances on' 'this host.') @@ -797,12 +795,18 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @checks_instance_lock - def rescue_instance(self, context, instance_id): - """Rescue an instance on this host.""" + def rescue_instance(self, context, instance_id, **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) context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) + instance_ref.admin_pass = kwargs.get('rescue_password', + utils.generate_password(FLAGS.password_length)) network_info = self._get_instance_nw_info(context, instance_ref) # NOTE(blamar): None of the virt drivers use the 'callback' param |
