Rename VolumeMapping to EC2VolumeMapping

During the code review for adding the InstanceMapping object, a
request was made by a couple of people to rename it to
EC2InstanceObject.  I did that so now I think we should rename the one
that already merged to also have the EC2 prefix.

Change-Id: I0b0847b6d4e229c973e268045709fa90726baed9
This commit is contained in:
Russell Bryant
2014-06-16 22:04:55 +00:00
parent 96ac6ebde7
commit 785f98a6b0
5 changed files with 15 additions and 14 deletions

View File

@@ -852,9 +852,9 @@ class CloudController(object):
kwargs.get('description'),
**create_kwargs)
vmap = ec2_obj.VolumeMapping()
vmap = ec2_obj.EC2VolumeMapping(context)
vmap.uuid = volume['id']
vmap.create(context)
vmap.create()
# TODO(vish): Instance should be None at db layer instead of
# trying to lazy load, but for now we turn it into

View File

@@ -315,18 +315,18 @@ def get_int_id_from_volume_uuid(context, volume_uuid):
if volume_uuid is None:
return
try:
vmap = ec2_obj.VolumeMapping.get_by_uuid(context, volume_uuid)
vmap = ec2_obj.EC2VolumeMapping.get_by_uuid(context, volume_uuid)
return vmap.id
except exception.NotFound:
vmap = ec2_obj.VolumeMapping()
vmap = ec2_obj.EC2VolumeMapping(context)
vmap.uuid = volume_uuid
vmap.create(context)
vmap.create()
return vmap.id
@memoize
def get_volume_uuid_from_int_id(context, int_id):
vmap = ec2_obj.VolumeMapping.get_by_id(context, int_id)
vmap = ec2_obj.EC2VolumeMapping.get_by_id(context, int_id)
return vmap.uuid

View File

@@ -56,7 +56,7 @@ class EC2InstanceMapping(base.NovaPersistentObject, base.NovaObject):
return cls._from_db_object(context, cls(), db_imap)
class VolumeMapping(base.NovaPersistentObject, base.NovaObject):
class EC2VolumeMapping(base.NovaPersistentObject, base.NovaObject):
# Version 1.0: Initial version
VERSION = '1.0'

View File

@@ -70,14 +70,14 @@ class TestRemoteEC2InstanceMapping(test_objects._RemoteTest,
pass
class _TestVolumeMapping(object):
class _TestEC2VolumeMapping(object):
@staticmethod
def _compare(test, db, obj):
for field, value in db.items():
test.assertEqual(db[field], obj[field])
def test_create(self):
vmap = ec2_obj.VolumeMapping()
vmap = ec2_obj.EC2VolumeMapping()
vmap.uuid = 'fake-uuid-2'
with mock.patch.object(db, 'ec2_volume_create') as create:
@@ -91,20 +91,21 @@ class _TestVolumeMapping(object):
def test_get_by_uuid(self):
with mock.patch.object(db, 'ec2_volume_get_by_uuid') as get:
get.return_value = fake_map
vmap = ec2_obj.VolumeMapping.get_by_uuid(self.context,
vmap = ec2_obj.EC2VolumeMapping.get_by_uuid(self.context,
'fake-uuid-2')
self._compare(self, fake_map, vmap)
def test_get_by_ec2_id(self):
with mock.patch.object(db, 'ec2_volume_get_by_id') as get:
get.return_value = fake_map
vmap = ec2_obj.VolumeMapping.get_by_id(self.context, 1)
vmap = ec2_obj.EC2VolumeMapping.get_by_id(self.context, 1)
self._compare(self, fake_map, vmap)
class TestVolumeMapping(test_objects._LocalTest, _TestVolumeMapping):
class TestEC2VolumeMapping(test_objects._LocalTest, _TestEC2VolumeMapping):
pass
class TestRemoteVolumeMapping(test_objects._RemoteTest, _TestVolumeMapping):
class TestRemoteEC2VolumeMapping(test_objects._RemoteTest,
_TestEC2VolumeMapping):
pass

View File

@@ -874,6 +874,7 @@ object_data = {
'DNSDomain': '1.0-54455ffc071515a2052a70a37d674435',
'DNSDomainList': '1.0-7d1165619956062314f5f2c4d1bb61ba',
'EC2InstanceMapping': '1.0-c9ebf3e641800d1f453ef9f19b159971',
'EC2VolumeMapping': '1.0-f376082f497bba08583119ef7cbbb07e',
'FixedIP': '1.1-70b8c86daf93913c7bb11afc901dda76',
'FixedIPList': '1.1-cbe7d8ff7eea9d3aecb7d537e1007742',
'Flavor': '1.0-2956744a9d1edd729bf8bf0dcc98c235',
@@ -912,7 +913,6 @@ object_data = {
'TestSubclassedObject': '1.6-5e9f181288c104ae0d1aad6f8c0d40b9',
'VirtualInterface': '1.0-513adc400c9c4dfcbd0a638a0a415183',
'VirtualInterfaceList': '1.0-15f2f3e0517805f585b402ab1547ba92',
'VolumeMapping': '1.0-f376082f497bba08583119ef7cbbb07e'
}