From 0ce533e0e194741b6ade7eed12c107628d0e6d3d Mon Sep 17 00:00:00 2001 From: Craig Vyvial Date: Thu, 24 May 2012 13:16:08 -0500 Subject: fixing issue with db.volume_update not returning the volume_ref fixes bug #1003664 - changed the sqlalchemy db api code to return the volume_ref from the volume_update method. This was causing the volume notifications to have the incorrect information in the payload. - Fixed up the unit tests because they started failing badly. - fixed the volume-usage-audit reading the default config values - fix hacking issue with volume-usage-audit Change-Id: Iba5634b0c351a6cc0c48b697217a6f85533de93e --- nova/tests/api/ec2/test_cloud.py | 8 +++----- nova/tests/test_volume.py | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py index 3135364ec..c9080c0e3 100644 --- a/nova/tests/api/ec2/test_cloud.py +++ b/nova/tests/api/ec2/test_cloud.py @@ -623,7 +623,7 @@ class CloudTestCase(test.TestCase): self.assertEqual(result['volumeSet'][0]['availabilityZone'], availabilityZone) - db.volume_destroy(self.context, ec2utils.ec2_id_to_id(volume_id)) + db.volume_destroy(self.context, ec2utils.ec2_vol_id_to_uuid(volume_id)) def test_create_volume_from_snapshot(self): """Makes sure create_volume works when we specify a snapshot.""" @@ -640,7 +640,7 @@ class CloudTestCase(test.TestCase): self.assertEqual(len(result['volumeSet']), 2) self.assertEqual(result['volumeSet'][1]['volumeId'], volume_id) - db.volume_destroy(self.context, ec2utils.ec2_id_to_id(volume_id)) + db.volume_destroy(self.context, ec2utils.ec2_vol_id_to_uuid(volume_id)) db.snapshot_destroy(self.context, snap['id']) db.volume_destroy(self.context, vol['id']) @@ -2083,7 +2083,7 @@ class CloudTestCase(test.TestCase): 'snapshot_id': snapshot2_id, 'delete_on_termination': True}]} ec2_instance_id = self._run_instance(**kwargs) - instance_id = ec2utils.ec2_id_to_id(ec2_instance_id) + instance_id = ec2utils.ec2_vol_id_to_uuid(ec2_instance_id) instance_uuid = ec2utils.ec2_instance_id_to_uuid(self.context, ec2_instance_id) @@ -2122,8 +2122,6 @@ class CloudTestCase(test.TestCase): for snapshot_id in (ec2_snapshot1_id, ec2_snapshot2_id): self.cloud.delete_snapshot(self.context, snapshot_id) - db.volume_destroy(self.context, vol['id']) - def test_create_image(self): """Make sure that CreateImage works""" # enforce periodic tasks run in short time to avoid wait for 60s. diff --git a/nova/tests/test_volume.py b/nova/tests/test_volume.py index f9b54badc..2909b51f7 100644 --- a/nova/tests/test_volume.py +++ b/nova/tests/test_volume.py @@ -395,6 +395,8 @@ class VolumeTestCase(test.TestCase): self.assertEquals(len(test_notifier.NOTIFICATIONS), 2) msg = test_notifier.NOTIFICATIONS[0] self.assertEquals(msg['event_type'], 'volume.create.start') + payload = msg['payload'] + self.assertEquals(payload['status'], 'creating') msg = test_notifier.NOTIFICATIONS[1] self.assertEquals(msg['priority'], 'INFO') self.assertEquals(msg['event_type'], 'volume.create.end') @@ -402,7 +404,7 @@ class VolumeTestCase(test.TestCase): self.assertEquals(payload['tenant_id'], volume['project_id']) self.assertEquals(payload['user_id'], volume['user_id']) self.assertEquals(payload['volume_id'], volume['id']) - self.assertEquals(payload['status'], 'creating') + self.assertEquals(payload['status'], 'available') self.assertEquals(payload['size'], volume['size']) self.assertTrue('display_name' in payload) self.assertTrue('snapshot_id' in payload) -- cgit