Просмотр исходного кода

For AWS, fix volume description during volume creation.

Enis Afgan 10 лет назад
Родитель
Сommit
429882c231
2 измененных файлов с 5 добавлено и 3 удалено
  1. 2 0
      cloudbridge/cloud/providers/aws/services.py
  2. 3 3
      test/test_block_store_service.py

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

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

+ 3 - 3
test/test_block_store_service.py

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