]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove RetypeVD class, fix NFS driver retype
authorEric Harney <eharney@redhat.com>
Tue, 28 Jul 2015 14:19:07 +0000 (10:19 -0400)
committerEric Harney <eharney@redhat.com>
Thu, 13 Aug 2015 14:30:11 +0000 (10:30 -0400)
retype() only exists in the deprecated VolumeDriver() class
and not BaseVD.  This means that drivers inheriting from *VD
hit attribute errors when trying to call driver.retype().

The thinking here is that RetypeVD isn't really necessary,
since all drivers must implement some version of the retype
method (even if it's a no-op with just a standard return code).

Therefore, just rely on this being in the base driver class(es)
rather than making it a separate abc class.

Closes-Bug: #1478987
Related-Bug: #1471807

Change-Id: Ie0c6f23caf68080a05a10cc7ad245878a057fb02

cinder/tests/unit/test_nfs.py
cinder/volume/driver.py
cinder/volume/drivers/ibm/gpfs.py
cinder/volume/drivers/ibm/storwize_svc/__init__.py
cinder/volume/drivers/ibm/xiv_ds8k.py
cinder/volume/drivers/rbd.py
cinder/volume/drivers/san/hp/hp_lefthand_iscsi.py

index 0365d3a732b89e57e6962e27f8a906a466c2400b..f7617f2331d7a405d1f845ad142b2be3465c2732 100644 (file)
@@ -1308,3 +1308,17 @@ class NfsDriverDoSetupTestCase(test.TestCase):
                           v1,
                           v2,
                           mock.sentinel)
+
+    def test_retype_is_there(self):
+        "Ensure that driver.retype() is there."""
+
+        drv = nfs.NfsDriver(configuration=self.configuration)
+        v1 = DumbVolume()
+
+        ret = drv.retype(self.context,
+                         v1,
+                         mock.sentinel.new_type,
+                         mock.sentinel.diff,
+                         mock.sentinel.host)
+
+        self.assertEqual((False, None), ret)
index f1489bcbc6e89ac2aa3380c7a3bb336b2b3ae2fe..d21d91a624cfafff80623eaab6a2404849183389 100644 (file)
@@ -922,6 +922,9 @@ class BaseVD(object):
     def validate_connector_has_setting(connector, setting):
         pass
 
+    def retype(self, context, volume, new_type, diff, host):
+        return False, None
+
     # #######  Interface methods for DataPath (Connector) ########
     @abc.abstractmethod
     def ensure_export(self, context, volume):
@@ -1101,42 +1104,6 @@ class ExtendVD(object):
         return
 
 
-@six.add_metaclass(abc.ABCMeta)
-class RetypeVD(object):
-    @abc.abstractmethod
-    def retype(self, context, volume, new_type, diff, host):
-        """Convert the volume to be of the new type.
-
-        Returns either:
-        A boolean indicating whether the retype occurred, or
-        A tuple (retyped, model_update) where retyped is a boolean
-        indicating if the retype occurred, and the model_update includes
-        changes for the volume db.
-        if diff['extra_specs'] includes 'replication' then:
-            if  ('True', _ ) then replication should be disabled:
-                Volume replica should be deleted
-                volume['replication_status'] should be changed to 'disabled'
-                volume['replication_extended_status'] = None
-                volume['replication_driver_data'] = None
-            if  (_, 'True') then replication should be enabled:
-                Volume replica (secondary) should be created, and replication
-                should be setup between the volume and the newly created
-                replica
-                volume['replication_status'] = 'copying'
-                volume['replication_extended_status'] = driver specific value
-                volume['replication_driver_data'] = driver specific value
-
-        :param ctxt: Context
-        :param volume: A dictionary describing the volume to migrate
-        :param new_type: A dictionary describing the volume type to convert to
-        :param diff: A dictionary with the difference between the two types
-        :param host: A dictionary describing the host to migrate to, where
-                     host['host'] is its name, and host['capabilities'] is a
-                     dictionary of its reported capabilities.
-        """
-        return False, None
-
-
 @six.add_metaclass(abc.ABCMeta)
 class TransferVD(object):
     def accept_transfer(self, context, volume, new_user, new_project):
@@ -1297,7 +1264,7 @@ class ReplicaVD(object):
 
 class VolumeDriver(ConsistencyGroupVD, TransferVD, ManageableVD, ExtendVD,
                    CloneableVD, CloneableImageVD, SnapshotVD, ReplicaVD,
-                   RetypeVD, LocalVD, MigrateVD, BaseVD):
+                   LocalVD, MigrateVD, BaseVD):
     """This class will be deprecated soon.
 
     Please use the abstract classes above for new drivers.
index 1849c30ccb733df05e75134d7af1a29c278b6015..be952ceb2825ce808bf1e4d39fe0929655b0610b 100644 (file)
@@ -110,7 +110,7 @@ def _sizestr(size_in_g):
 class GPFSDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
                  driver.LocalVD, driver.TransferVD, driver.CloneableVD,
                  driver.CloneableImageVD, driver.SnapshotVD,
-                 driver.RetypeVD, driver.MigrateVD,
+                 driver.MigrateVD,
                  driver.BaseVD):
     """Implements volume functions using GPFS primitives.
 
index 5ef14515f7aece8f049ac798a9b99ce65a399c12..a1a8620fae7c7679d9d30e63608e502d3c92e133 100644 (file)
@@ -133,7 +133,6 @@ class StorwizeSVCDriver(san.SanDriver,
                         driver.MigrateVD, driver.ReplicaVD,
                         driver.ConsistencyGroupVD,
                         driver.CloneableVD, driver.CloneableImageVD,
-                        driver.RetypeVD,
                         driver.TransferVD):
     """IBM Storwize V7000 and SVC iSCSI/FC volume driver.
 
index 93a24e206e46aa77cce034a121174092d233ceb8..93caceaa4a45920985c10554bcfe3e23c06c5cf6 100644 (file)
@@ -67,7 +67,6 @@ class XIVDS8KDriver(san.SanDriver,
                     driver.ConsistencyGroupVD,
                     driver.CloneableVD,
                     driver.CloneableImageVD,
-                    driver.RetypeVD,
                     driver.TransferVD):
     """Unified IBM XIV and DS8K volume driver."""
 
index 6697cc986e00c124dbcb71d6db9b9df64d833c58..43751cbe3b56c6cfdec53622cd38dbf0ceb73702 100644 (file)
@@ -264,7 +264,7 @@ class RADOSClient(object):
         return int(features)
 
 
-class RBDDriver(driver.RetypeVD, driver.TransferVD, driver.ExtendVD,
+class RBDDriver(driver.TransferVD, driver.ExtendVD,
                 driver.CloneableVD, driver.CloneableImageVD, driver.SnapshotVD,
                 driver.BaseVD):
     """Implements RADOS block device (RBD) volume commands."""
index ed118ec5dc616b9457d33b57628dfc4b89e641cf..0a065207c15d1c2c5d3ff91e056821996f0d8dd3 100644 (file)
@@ -50,7 +50,6 @@ class HPLeftHandISCSIDriver(driver.TransferVD,
                             driver.ExtendVD,
                             driver.CloneableVD,
                             driver.SnapshotVD,
-                            driver.RetypeVD,
                             driver.MigrateVD,
                             driver.BaseVD):
     """Executes commands relating to HP/LeftHand SAN ISCSI volumes.