Merge "Fix error in rescue rpcapi that prevents sending objects"
This commit is contained in:
commit
132f5ec861
|
@ -716,8 +716,7 @@ class ComputeAPI(object):
|
|||
|
||||
def rescue_instance(self, ctxt, instance, rescue_password,
|
||||
rescue_image_ref=None):
|
||||
instance = jsonutils.to_primitive(instance)
|
||||
msg_args = {'rescue_password': rescue_password, 'instance': instance}
|
||||
msg_args = {'rescue_password': rescue_password}
|
||||
if self.client.can_send_version('3.24'):
|
||||
version = '3.24'
|
||||
msg_args['rescue_image_ref'] = rescue_image_ref
|
||||
|
@ -725,7 +724,9 @@ class ComputeAPI(object):
|
|||
version = '3.9'
|
||||
else:
|
||||
# NOTE(russellb) Havana compat
|
||||
instance = jsonutils.to_primitive(instance)
|
||||
version = self._get_compat_version('3.0', '2.44')
|
||||
msg_args['instance'] = instance
|
||||
cctxt = self.client.prepare(server=_compute_host(None, instance),
|
||||
version=version)
|
||||
cctxt.cast(ctxt, 'rescue_instance', **msg_args)
|
||||
|
|
|
@ -23,10 +23,10 @@ from oslo.config import cfg
|
|||
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova.openstack.common import jsonutils
|
||||
from nova import test
|
||||
from nova.tests import fake_block_device
|
||||
from nova.tests.fake_instance import fake_instance_obj
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
@ -36,9 +36,11 @@ class ComputeRpcAPITestCase(test.TestCase):
|
|||
def setUp(self):
|
||||
super(ComputeRpcAPITestCase, self).setUp()
|
||||
self.context = context.get_admin_context()
|
||||
inst = db.instance_create(self.context, {'host': 'fake_host',
|
||||
'instance_type_id': 1})
|
||||
self.fake_instance = jsonutils.to_primitive(inst)
|
||||
instance_attr = {'host': 'fake_host',
|
||||
'instance_type_id': 1}
|
||||
self.fake_instance_obj = fake_instance_obj(self.context,
|
||||
**instance_attr)
|
||||
self.fake_instance = jsonutils.to_primitive(self.fake_instance_obj)
|
||||
self.fake_volume_bdm = jsonutils.to_primitive(
|
||||
fake_block_device.FakeDbBlockDeviceDict(
|
||||
{'source_type': 'volume', 'destination_type': 'volume',
|
||||
|
@ -571,7 +573,8 @@ class ComputeRpcAPITestCase(test.TestCase):
|
|||
def test_rescue_instance(self):
|
||||
self.flags(compute='3.9', group='upgrade_levels')
|
||||
self._test_compute_api('rescue_instance', 'cast',
|
||||
instance=self.fake_instance, rescue_password='pw', version='3.9')
|
||||
instance=self.fake_instance_obj, rescue_password='pw',
|
||||
version='3.9')
|
||||
|
||||
def test_rescue_instance_with_rescue_image_ref_passed(self):
|
||||
self._test_compute_api('rescue_instance', 'cast',
|
||||
|
|
Loading…
Reference in New Issue