Remove and deprecate conductor get_ec2_ids()
A previous change converted the one use of this method to objects so remove and deprecate the now unused method in conductor. Change-Id: I22681b6cac638d471519eecc0b1ebec84664a72f
This commit is contained in:
parent
9004e15e3d
commit
89d376c7c5
|
@ -187,9 +187,6 @@ class LocalAPI(object):
|
|||
return self._manager.security_groups_trigger_members_refresh(context,
|
||||
group_ids)
|
||||
|
||||
def get_ec2_ids(self, context, instance):
|
||||
return self._manager.get_ec2_ids(context, instance)
|
||||
|
||||
def object_backport(self, context, objinst, target_version):
|
||||
return self._manager.object_backport(context, objinst, target_version)
|
||||
|
||||
|
|
|
@ -390,6 +390,7 @@ class ConductorManager(manager.Manager):
|
|||
quota.QUOTAS.rollback(context, reservations, project_id=project_id,
|
||||
user_id=user_id)
|
||||
|
||||
# NOTE(hanlind): This method can be removed in version 3.0 of the RPC API
|
||||
def get_ec2_ids(self, context, instance):
|
||||
ec2_ids = {}
|
||||
|
||||
|
|
|
@ -159,6 +159,8 @@ class ConductorAPI(object):
|
|||
* 2.1 - Make notify_usage_exists() take an instance object
|
||||
* Remove bw_usage_update()
|
||||
* Remove notify_usage_exists()
|
||||
* Remove get_ec2_ids()
|
||||
|
||||
"""
|
||||
|
||||
VERSION_ALIASES = {
|
||||
|
@ -315,12 +317,6 @@ class ConductorAPI(object):
|
|||
return cctxt.call(context, 'security_groups_trigger_members_refresh',
|
||||
group_ids=group_ids)
|
||||
|
||||
def get_ec2_ids(self, context, instance):
|
||||
instance_p = jsonutils.to_primitive(instance)
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'get_ec2_ids',
|
||||
instance=instance_p)
|
||||
|
||||
def object_class_action(self, context, objname, objmethod, objver,
|
||||
args, kwargs):
|
||||
cctxt = self.client.prepare()
|
||||
|
|
|
@ -283,39 +283,6 @@ class _BaseTestCase(object):
|
|||
self.conductor.security_groups_trigger_members_refresh(self.context,
|
||||
[1, 2, 3])
|
||||
|
||||
def test_get_ec2_ids(self):
|
||||
expected = {
|
||||
'instance-id': 'ec2-inst-id',
|
||||
'ami-id': 'ec2-ami-id',
|
||||
'kernel-id': 'ami-kernel-ec2-kernelid',
|
||||
'ramdisk-id': 'ami-ramdisk-ec2-ramdiskid',
|
||||
}
|
||||
inst = {
|
||||
'uuid': 'fake-uuid',
|
||||
'kernel_id': 'ec2-kernelid',
|
||||
'ramdisk_id': 'ec2-ramdiskid',
|
||||
'image_ref': 'fake-image',
|
||||
}
|
||||
self.mox.StubOutWithMock(ec2utils, 'id_to_ec2_inst_id')
|
||||
self.mox.StubOutWithMock(ec2utils, 'glance_id_to_ec2_id')
|
||||
self.mox.StubOutWithMock(ec2utils, 'image_type')
|
||||
|
||||
ec2utils.id_to_ec2_inst_id(inst['uuid']).AndReturn(
|
||||
expected['instance-id'])
|
||||
ec2utils.glance_id_to_ec2_id(self.context,
|
||||
inst['image_ref']).AndReturn(
|
||||
expected['ami-id'])
|
||||
for image_type in ['kernel', 'ramdisk']:
|
||||
image_id = inst['%s_id' % image_type]
|
||||
ec2utils.image_type(image_type).AndReturn('ami-' + image_type)
|
||||
ec2utils.glance_id_to_ec2_id(self.context, image_id,
|
||||
'ami-' + image_type).AndReturn(
|
||||
'ami-%s-ec2-%sid' % (image_type, image_type))
|
||||
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.get_ec2_ids(self.context, inst)
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
|
||||
class ConductorTestCase(_BaseTestCase, test.TestCase):
|
||||
"""Conductor Manager Tests."""
|
||||
|
@ -772,6 +739,39 @@ class ConductorTestCase(_BaseTestCase, test.TestCase):
|
|||
'exists', system_metadata={},
|
||||
extra_usage_info=info)
|
||||
|
||||
def test_get_ec2_ids(self):
|
||||
expected = {
|
||||
'instance-id': 'ec2-inst-id',
|
||||
'ami-id': 'ec2-ami-id',
|
||||
'kernel-id': 'ami-kernel-ec2-kernelid',
|
||||
'ramdisk-id': 'ami-ramdisk-ec2-ramdiskid',
|
||||
}
|
||||
inst = {
|
||||
'uuid': 'fake-uuid',
|
||||
'kernel_id': 'ec2-kernelid',
|
||||
'ramdisk_id': 'ec2-ramdiskid',
|
||||
'image_ref': 'fake-image',
|
||||
}
|
||||
self.mox.StubOutWithMock(ec2utils, 'id_to_ec2_inst_id')
|
||||
self.mox.StubOutWithMock(ec2utils, 'glance_id_to_ec2_id')
|
||||
self.mox.StubOutWithMock(ec2utils, 'image_type')
|
||||
|
||||
ec2utils.id_to_ec2_inst_id(inst['uuid']).AndReturn(
|
||||
expected['instance-id'])
|
||||
ec2utils.glance_id_to_ec2_id(self.context,
|
||||
inst['image_ref']).AndReturn(
|
||||
expected['ami-id'])
|
||||
for image_type in ['kernel', 'ramdisk']:
|
||||
image_id = inst['%s_id' % image_type]
|
||||
ec2utils.image_type(image_type).AndReturn('ami-' + image_type)
|
||||
ec2utils.glance_id_to_ec2_id(self.context, image_id,
|
||||
'ami-' + image_type).AndReturn(
|
||||
'ami-%s-ec2-%sid' % (image_type, image_type))
|
||||
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.get_ec2_ids(self.context, inst)
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
|
||||
class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase):
|
||||
"""Conductor RPC API Tests."""
|
||||
|
|
Loading…
Reference in New Issue