summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/conductor/api.py3
-rw-r--r--nova/conductor/manager.py1
-rw-r--r--nova/conductor/rpcapi.py8
-rw-r--r--nova/tests/unit/conductor/test_conductor.py66
4 files changed, 36 insertions, 42 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index 76b8e560d6..7d1292287d 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -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)
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index 7351e7c7fa..f2353b83e6 100644
--- a/nova/conductor/manager.py
+++ b/nova/conductor/manager.py
@@ -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 = {}
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index c5ed7137c1..e458f73eb4 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -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()
diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py
index 19fa985b0f..c39c5b8528 100644
--- a/nova/tests/unit/conductor/test_conductor.py
+++ b/nova/tests/unit/conductor/test_conductor.py
@@ -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."""