Updates to the compute API and manager so that rebuild, reboot, snapshots,
and password resets work with the most recent versions of novaclient.
This commit is contained in:
@@ -454,7 +454,7 @@ class ControllerV10(Controller):
|
||||
|
||||
def _action_rebuild(self, info, request, instance_id):
|
||||
context = request.environ['nova.context']
|
||||
instance_id = int(instance_id)
|
||||
instance_id = instance_id
|
||||
|
||||
try:
|
||||
image_id = info["rebuild"]["imageId"]
|
||||
@@ -569,7 +569,7 @@ class ControllerV11(Controller):
|
||||
|
||||
def _action_rebuild(self, info, request, instance_id):
|
||||
context = request.environ['nova.context']
|
||||
instance_id = int(instance_id)
|
||||
instance_id = instance_id
|
||||
|
||||
try:
|
||||
image_href = info["rebuild"]["imageRef"]
|
||||
|
||||
@@ -561,6 +561,7 @@ class API(base.Base):
|
||||
self.db.queue_get_for(context, FLAGS.compute_topic, host),
|
||||
{'method': 'refresh_provider_fw_rules', 'args': {}})
|
||||
|
||||
@scheduler_api.reroute_compute("update")
|
||||
def update(self, context, instance_id, **kwargs):
|
||||
"""Updates the instance in the datastore.
|
||||
|
||||
@@ -776,6 +777,7 @@ class API(base.Base):
|
||||
raise exception.Error(_("Unable to find host for Instance %s")
|
||||
% instance_id)
|
||||
|
||||
@scheduler_api.reroute_compute("backup")
|
||||
def backup(self, context, instance_id, name, backup_type, rotation,
|
||||
extra_properties=None):
|
||||
"""Backup the given instance
|
||||
@@ -792,6 +794,7 @@ class API(base.Base):
|
||||
extra_properties=extra_properties)
|
||||
return recv_meta
|
||||
|
||||
@scheduler_api.reroute_compute("snapshot")
|
||||
def snapshot(self, context, instance_id, name, extra_properties=None):
|
||||
"""Snapshot the given instance.
|
||||
|
||||
@@ -834,10 +837,12 @@ class API(base.Base):
|
||||
params=params)
|
||||
return recv_meta
|
||||
|
||||
@scheduler_api.reroute_compute("reboot")
|
||||
def reboot(self, context, instance_id):
|
||||
"""Reboot the given instance."""
|
||||
self._cast_compute_message('reboot_instance', context, instance_id)
|
||||
|
||||
@scheduler_api.reroute_compute("rebuild")
|
||||
def rebuild(self, context, instance_id, image_href, name=None,
|
||||
metadata=None, files_to_inject=None):
|
||||
"""Rebuild the given instance with the provided metadata."""
|
||||
@@ -1012,6 +1017,7 @@ class API(base.Base):
|
||||
"""Unrescue the given instance."""
|
||||
self._cast_compute_message('unrescue_instance', context, instance_id)
|
||||
|
||||
@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."""
|
||||
host = self._find_host(context, instance_id)
|
||||
|
||||
@@ -415,7 +415,10 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
image_ref = kwargs.get('image_ref')
|
||||
instance_ref.image_ref = image_ref
|
||||
instance_ref.injected_files = kwargs.get('injected_files', [])
|
||||
self.driver.spawn(instance_ref)
|
||||
network_info = self.network_api.get_instance_nw_info(context,
|
||||
instance_ref)
|
||||
bd_mapping = self._setup_block_device_mapping(context, instance_id)
|
||||
self.driver.spawn(instance_ref, network_info, bd_mapping)
|
||||
|
||||
self._update_image_ref(context, instance_id, image_ref)
|
||||
self._update_launched_at(context, instance_id)
|
||||
|
||||
Reference in New Issue
Block a user