summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-27 14:54:20 +0000
committerGerrit Code Review <review@openstack.org>2012-07-27 14:54:20 +0000
commitef5d5951d891171d385eefee7562383ef59cb6d3 (patch)
treec7f4fc92fe835e7f6535995bb5a17d3fdbb82ef8 /nova/compute
parentbf58f027bf98fc811580c47b8d1c80bc5732f6ef (diff)
parentbc1947d2e9c21c19735a9470a498234b94b8d9c4 (diff)
Merge "Send a full instance in power_on_instance and start_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 b2744e03d..ef1bdbcc6 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.21'
+ RPC_API_VERSION = '1.22'
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
@@ -951,11 +951,12 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@wrap_instance_fault
- def start_instance(self, context, instance_uuid):
+ def start_instance(self, context, instance=None, instance_uuid=None):
"""Starting an instance on this host.
Alias for power_on_instance for compatibility"""
- self.power_on_instance(context, instance_uuid)
+ self.power_on_instance(context, instance=instance,
+ instance_uuid=instance_uuid)
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@@ -978,9 +979,10 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@wrap_instance_fault
- def power_on_instance(self, context, instance_uuid):
+ def power_on_instance(self, context, instance=None, instance_uuid=None):
"""Power on 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_on.start")
self.driver.power_on(instance)
current_power_state = self._get_power_state(context, instance)
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 2c84e3a10..a99c8f492 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -86,6 +86,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
post_live_migration_at_destination()
1.21 - Remove instance_uuid, add instance argument to
power_off_instance() and stop_instance()
+ 1.22 - Remove instance_uuid, add instance argument to
+ power_on_instance() and start_instance()
'''
BASE_RPC_API_VERSION = '1.0'
@@ -260,9 +262,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
version='1.21')
def power_on_instance(self, ctxt, instance):
+ instance_p = jsonutils.to_primitive(instance)
self.cast(ctxt, self.make_msg('power_on_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.22')
def pre_live_migration(self, ctxt, instance, block_migration, disk,
host):
@@ -379,9 +383,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
topic=_compute_topic(self.topic, ctxt, None, instance))
def start_instance(self, ctxt, instance):
+ instance_p = jsonutils.to_primitive(instance)
self.cast(ctxt, self.make_msg('start_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.22')
def stop_instance(self, ctxt, instance, cast=True):
rpc_method = self.cast if cast else self.call