summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-27 14:47:21 +0000
committerGerrit Code Review <review@openstack.org>2012-07-27 14:47:21 +0000
commitbf58f027bf98fc811580c47b8d1c80bc5732f6ef (patch)
tree39f53c868a360c9d571003794af66da0b8423717 /nova/compute
parent43a963747d20e053d64a069d58577d86086579fc (diff)
parent3a03a9c46ad20b1c0f44497e9e23b9ef7be465e7 (diff)
Merge "Send a full instance in power_off_instance and stop_instance."
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py12
-rw-r--r--nova/compute/rpcapi.py14
2 files changed, 17 insertions, 9 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index d25405ce3..b2744e03d 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -295,7 +295,7 @@ def _get_additional_capabilities():
class ComputeManager(manager.SchedulerDependentManager):
"""Manages the running instances from creation to destruction."""
- RPC_API_VERSION = '1.20'
+ RPC_API_VERSION = '1.21'
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
@@ -940,11 +940,12 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@wrap_instance_fault
- def stop_instance(self, context, instance_uuid):
+ def stop_instance(self, context, instance=None, instance_uuid=None):
"""Stopping an instance on this host.
Alias for power_off_instance for compatibility"""
- self.power_off_instance(context, instance_uuid,
+ self.power_off_instance(context, instance=instance,
+ instance_uuid=instance_uuid,
final_state=vm_states.STOPPED)
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@@ -959,10 +960,11 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@wrap_instance_fault
- def power_off_instance(self, context, instance_uuid,
+ def power_off_instance(self, context, instance=None, instance_uuid=None,
final_state=vm_states.SOFT_DELETED):
"""Power off an instance on this host."""
- instance = self.db.instance_get_by_uuid(context, instance_uuid)
+ if not instance:
+ instance = self.db.instance_get_by_uuid(context, instance_uuid)
self._notify_about_instance_usage(context, instance, "power_off.start")
self.driver.power_off(instance)
current_power_state = self._get_power_state(context, instance)
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 7243e37c5..2c84e3a10 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -84,6 +84,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
inject_network_info()
1.20 - Remove instance_id, add instance argument to
post_live_migration_at_destination()
+ 1.21 - Remove instance_uuid, add instance argument to
+ power_off_instance() and stop_instance()
'''
BASE_RPC_API_VERSION = '1.0'
@@ -251,9 +253,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
version='1.20')
def power_off_instance(self, ctxt, instance):
+ instance_p = jsonutils.to_primitive(instance)
self.cast(ctxt, self.make_msg('power_off_instance',
- instance_uuid=instance['uuid']),
- topic=_compute_topic(self.topic, ctxt, None, instance))
+ instance=instance_p),
+ topic=_compute_topic(self.topic, ctxt, None, instance),
+ version='1.21')
def power_on_instance(self, ctxt, instance):
self.cast(ctxt, self.make_msg('power_on_instance',
@@ -381,9 +385,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
def stop_instance(self, ctxt, instance, cast=True):
rpc_method = self.cast if cast else self.call
+ instance_p = jsonutils.to_primitive(instance)
return rpc_method(ctxt, self.make_msg('stop_instance',
- instance_uuid=instance['uuid']),
- topic=_compute_topic(self.topic, ctxt, None, instance))
+ instance=instance),
+ topic=_compute_topic(self.topic, ctxt, None, instance),
+ version='1.21')
def suspend_instance(self, ctxt, instance):
instance_p = jsonutils.to_primitive(instance)