Pārlūkot izejas kodu

For AWS, fix volume description during volume creation.

Enis Afgan 10 gadi atpakaļ
vecāks
revīzija
429882c231

+ 2 - 0
cloudbridge/cloud/providers/aws/services.py

@@ -283,6 +283,8 @@ class AWSVolumeService(BaseVolumeService):
             snapshot=snapshot_id)
             snapshot=snapshot_id)
         cb_vol = AWSVolume(self.provider, ec2_vol)
         cb_vol = AWSVolume(self.provider, ec2_vol)
         cb_vol.name = name
         cb_vol.name = name
+        if description:
+            cb_vol.description = description
         return cb_vol
         return cb_vol
 
 
 
 

+ 3 - 3
test/test_block_store_service.py

@@ -121,11 +121,12 @@ class CloudBlockStoreServiceTestCase(ProviderTestBase):
         instance_name = "CBVolProps-{0}-{1}".format(
         instance_name = "CBVolProps-{0}-{1}".format(
             self.provider.name,
             self.provider.name,
             uuid.uuid4())
             uuid.uuid4())
+        vol_desc = 'newvoldesc1'
         test_instance = helpers.get_test_instance(self.provider, instance_name)
         test_instance = helpers.get_test_instance(self.provider, instance_name)
         with helpers.cleanup_action(lambda: test_instance.terminate()):
         with helpers.cleanup_action(lambda: test_instance.terminate()):
             name = "CBUnitTestVolProps-{0}".format(uuid.uuid4())
             name = "CBUnitTestVolProps-{0}".format(uuid.uuid4())
             test_vol = self.provider.block_store.volumes.create(
             test_vol = self.provider.block_store.volumes.create(
-                name, 1, test_instance.placement_zone)
+                name, 1, test_instance.placement_zone, description=vol_desc)
             with helpers.cleanup_action(lambda: test_vol.delete()):
             with helpers.cleanup_action(lambda: test_vol.delete()):
                 test_vol.wait_till_ready()
                 test_vol.wait_till_ready()
                 self.assertTrue(
                 self.assertTrue(
@@ -156,11 +157,10 @@ class CloudBlockStoreServiceTestCase(ProviderTestBase):
                                  "/dev/sda2")
                                  "/dev/sda2")
                 test_vol.detach()
                 test_vol.detach()
                 test_vol.name = 'newvolname1'
                 test_vol.name = 'newvolname1'
-                test_vol.description = 'newvoldesc1'
                 # Force a refresh before checking attachment status
                 # Force a refresh before checking attachment status
                 test_vol.refresh()
                 test_vol.refresh()
                 self.assertEqual(test_vol.name, 'newvolname1')
                 self.assertEqual(test_vol.name, 'newvolname1')
-                self.assertEqual(test_vol.description, 'newvoldesc1')
+                self.assertEqual(test_vol.description, vol_desc)
                 self.assertIsNone(test_vol.attachments)
                 self.assertIsNone(test_vol.attachments)
                 test_vol.wait_for(
                 test_vol.wait_for(
                     [VolumeState.AVAILABLE],
                     [VolumeState.AVAILABLE],