diff options
-rwxr-xr-x | nova/compute/manager.py | 4 | ||||
-rw-r--r-- | nova/conductor/api.py | 9 | ||||
-rw-r--r-- | nova/conductor/manager.py | 5 | ||||
-rw-r--r-- | nova/conductor/rpcapi.py | 8 | ||||
-rw-r--r-- | nova/tests/compute/test_compute.py | 2 | ||||
-rw-r--r-- | nova/tests/conductor/test_conductor.py | 10 |
6 files changed, 34 insertions, 4 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 6cb0bbb94..f36f74531 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -3434,8 +3434,8 @@ class ComputeManager(manager.SchedulerDependentManager): instance=instance) continue try: - self.compute_api.confirm_resize(context, instance, - migration_ref=migration) + self.conductor_api.compute_confirm_resize( + context, instance, migration_ref=migration) except Exception, e: msg = _("Error auto-confirming resize: %(e)s. " "Will retry later.") diff --git a/nova/conductor/api.py b/nova/conductor/api.py index 1825a9e7e..cebe6bf1f 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -337,6 +337,10 @@ class LocalAPI(object): def compute_stop(self, context, instance, do_cast=True): return self._manager.compute_stop(context, instance, do_cast) + def compute_confirm_resize(self, context, instance, migration_ref): + return self._manager.compute_confirm_resize(context, instance, + migration_ref) + class API(object): """Conductor API that does updates via RPC to the ConductorManager.""" @@ -671,3 +675,8 @@ class API(object): def compute_stop(self, context, instance, do_cast=True): return self.conductor_rpcapi.compute_stop(context, instance, do_cast) + + def compute_confirm_resize(self, context, instance, migration_ref): + return self.conductor_rpcapi.compute_confirm_resize(context, + instance, + migration_ref) diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 71b08bad4..b4e35066c 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -49,7 +49,7 @@ datetime_fields = ['launched_at', 'terminated_at', 'updated_at'] class ConductorManager(manager.Manager): """Mission: TBD.""" - RPC_API_VERSION = '1.45' + RPC_API_VERSION = '1.46' def __init__(self, *args, **kwargs): super(ConductorManager, self).__init__(*args, **kwargs) @@ -422,3 +422,6 @@ class ConductorManager(manager.Manager): def compute_stop(self, context, instance, do_cast=True): self.compute_api.stop(context, instance, do_cast) + + def compute_confirm_resize(self, context, instance, migration_ref): + self.compute_api.confirm_resize(context, instance, migration_ref) diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py index 22b1b039f..d8daecf9c 100644 --- a/nova/conductor/rpcapi.py +++ b/nova/conductor/rpcapi.py @@ -83,6 +83,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.43 - Added compute_stop 1.44 - Added compute_node_delete 1.45 - Added project_id to quota_commit and quota_rollback + 1.46 - Added compute_confirm_resize """ BASE_RPC_API_VERSION = '1.0' @@ -437,3 +438,10 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): msg = self.make_msg('compute_stop', instance=instance_p, do_cast=do_cast) return self.call(context, msg, version='1.43') + + def compute_confirm_resize(self, context, instance, migration_ref): + instance_p = jsonutils.to_primitive(instance) + migration_p = jsonutils.to_primitive(migration_ref) + msg = self.make_msg('compute_confirm_resize', instance=instance_p, + migration_ref=migration_p) + return self.call(context, msg, version='1.46') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 3a1526522..b27c079a2 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -3654,7 +3654,7 @@ class ComputeTestCase(BaseTestCase): fake_migration_get_unconfirmed_by_dest_compute) self.stubs.Set(self.compute.conductor_api, 'migration_update', fake_migration_update) - self.stubs.Set(self.compute.compute_api, 'confirm_resize', + self.stubs.Set(self.compute.conductor_api, 'compute_confirm_resize', fake_confirm_resize) def fetch_instance_migration_status(instance_uuid): diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index df0f5e73b..1c675ec61 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -599,6 +599,16 @@ class _BaseTestCase(object): self.mox.ReplayAll() self.conductor.compute_stop(self.context, 'instance') + def test_compute_confirm_resize(self): + self.mox.StubOutWithMock(self.conductor_manager.compute_api, + 'confirm_resize') + self.conductor_manager.compute_api.confirm_resize(self.context, + 'instance', + 'migration') + self.mox.ReplayAll() + self.conductor.compute_confirm_resize(self.context, 'instance', + 'migration') + class ConductorTestCase(_BaseTestCase, test.TestCase): """Conductor Manager Tests.""" |