]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add test for volume status check when extending
authorMathieu Gagné <mgagne@iweb.com>
Fri, 19 Jul 2013 19:49:54 +0000 (15:49 -0400)
committerMathieu Gagné <mgagne@iweb.com>
Fri, 19 Jul 2013 19:51:03 +0000 (15:51 -0400)
Ensure exception is raised if volume status is not 'available'
when extending volume.

Change-Id: I21337d5ca78090665b2feba50c74f853d3703650

cinder/tests/test_volume.py

index 544ee27068834a6aa581336ca89c7bc1b2fad3d4..41c389b6e6e0a769257da4a801cbca85e61b6936 100644 (file)
@@ -1254,11 +1254,19 @@ class VolumeTestCase(test.TestCase):
         # create a volume and assign to host
         volume = self._create_volume(2)
         self.volume.create_volume(self.context, volume['id'])
-        volume['status'] = 'available'
+        volume['status'] = 'in-use'
         volume['host'] = 'fakehost'
 
         volume_api = cinder.volume.api.API()
 
+        # Extend fails when status != available
+        self.assertRaises(exception.InvalidVolume,
+                          volume_api.extend,
+                          self.context,
+                          volume,
+                          3)
+
+        volume['status'] = 'available'
         # Extend fails when new_size < orig_size
         self.assertRaises(exception.InvalidInput,
                           volume_api.extend,