]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Implement retype for Pure drivers
authorPatrick East <patrick.east@purestorage.com>
Thu, 23 Jul 2015 23:02:43 +0000 (16:02 -0700)
committerPatrick East <patrick.east@purestorage.com>
Thu, 23 Jul 2015 23:02:43 +0000 (16:02 -0700)
Currently retyping on the same backend requires a migration to occur
due to using the default implementation of retype on the base volume
driver.

Volumes on the Pure arrays do not have any differentiation
between volume types Cinder may be using. Because of this we can
implement a retype method that will be used whenever changing
types on the same backend that essentially does nothing except return.

Change-Id: Ibf4c57166fe5742cc7e079c4422f7efd2b6dce79
Closes-Bug: 1477780

cinder/tests/unit/test_pure.py
cinder/volume/drivers/pure.py

index e9ec65261ba01aae83194ccc7ab83b9c8d230e27..dce80fe8de76af293235a6ee8c8bb107da37bdd8 100644 (file)
@@ -1028,6 +1028,12 @@ class PureBaseVolumeDriverTestCase(PureDriverTestCase):
         self.array.rename_volume.assert_called_with(vol_name,
                                                     unmanaged_vol_name)
 
+    def test_retype(self):
+        # Ensure that we return true no matter what the inputs are
+        retyped, update = self.driver.retype(None, None, None, None, None)
+        self.assertTrue(retyped)
+        self.assertIsNone(update)
+
 
 class PureISCSIDriverTestCase(PureDriverTestCase):
 
index 7aad3dd3f84b52b38102783c5c510bb7b0d55cb7..5fec7965d7f5910d740ce2dd6992c60a5d9aef53 100644 (file)
@@ -605,6 +605,15 @@ class PureBaseVolumeDriver(san.SanDriver):
 
         return connection
 
+    def retype(self, context, volume, new_type, diff, host):
+        """Retype from one volume type to another on the same backend.
+
+        For a Pure Array there is currently no differentiation between types
+        of volumes. This means that changing from one type to another on the
+        same array should be a no-op.
+        """
+        return True, None
+
 
 class PureISCSIDriver(PureBaseVolumeDriver, san.SanISCSIDriver):