Converted Volume model and operation to use UUIDs.

This commit is contained in:
Eric Day
2010-12-27 12:19:36 -08:00
parent 83d9da6a20
commit b378d7e285
2 changed files with 7 additions and 8 deletions

View File

@@ -127,9 +127,9 @@ class CloudTestCase(test.TestCase):
result = self.cloud.describe_volumes(self.context) result = self.cloud.describe_volumes(self.context)
self.assertEqual(len(result['volumeSet']), 2) self.assertEqual(len(result['volumeSet']), 2)
result = self.cloud.describe_volumes(self.context, result = self.cloud.describe_volumes(self.context,
volume_id=[vol2['ec2_id']]) volume_id=[vol2['id']])
self.assertEqual(len(result['volumeSet']), 1) self.assertEqual(len(result['volumeSet']), 1)
self.assertEqual(result['volumeSet'][0]['volumeId'], vol2['ec2_id']) self.assertEqual(result['volumeSet'][0]['volumeId'], vol2['id'])
db.volume_destroy(self.context, vol1['id']) db.volume_destroy(self.context, vol1['id'])
db.volume_destroy(self.context, vol2['id']) db.volume_destroy(self.context, vol2['id'])

View File

@@ -79,8 +79,8 @@ class XenAPIVolumeTestCase(test.TestCase):
helper = volume_utils.VolumeHelper helper = volume_utils.VolumeHelper
helper.XenAPI = session.get_imported_xenapi() helper.XenAPI = session.get_imported_xenapi()
vol = self._create_volume() vol = self._create_volume()
info = helper.parse_volume_info(vol['ec2_id'], '/dev/sdc') info = helper.parse_volume_info(vol['id'], '/dev/sdc')
label = 'SR-%s' % vol['ec2_id'] label = 'SR-%s' % vol['id']
description = 'Test-SR' description = 'Test-SR'
sr_ref = helper.create_iscsi_storage(session, info, label, description) sr_ref = helper.create_iscsi_storage(session, info, label, description)
srs = fake.get_all('SR') srs = fake.get_all('SR')
@@ -97,7 +97,7 @@ class XenAPIVolumeTestCase(test.TestCase):
# oops, wrong mount point! # oops, wrong mount point!
self.assertRaises(volume_utils.StorageError, self.assertRaises(volume_utils.StorageError,
helper.parse_volume_info, helper.parse_volume_info,
vol['ec2_id'], vol['id'],
'/dev/sd') '/dev/sd')
db.volume_destroy(context.get_admin_context(), vol['id']) db.volume_destroy(context.get_admin_context(), vol['id'])
@@ -108,8 +108,7 @@ class XenAPIVolumeTestCase(test.TestCase):
volume = self._create_volume() volume = self._create_volume()
instance = db.instance_create(self.values) instance = db.instance_create(self.values)
fake.create_vm(instance.name, 'Running') fake.create_vm(instance.name, 'Running')
result = conn.attach_volume(instance.name, volume['ec2_id'], result = conn.attach_volume(instance.name, volume['id'], '/dev/sdc')
'/dev/sdc')
def check(): def check():
# check that the VM has a VBD attached to it # check that the VM has a VBD attached to it
@@ -134,7 +133,7 @@ class XenAPIVolumeTestCase(test.TestCase):
self.assertRaises(Exception, self.assertRaises(Exception,
conn.attach_volume, conn.attach_volume,
instance.name, instance.name,
volume['ec2_id'], volume['id'],
'/dev/sdc') '/dev/sdc')
def tearDown(self): def tearDown(self):