]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add manage_existing and unmanage to BaseVD
authorEric Harney <eharney@redhat.com>
Tue, 8 Sep 2015 18:10:55 +0000 (14:10 -0400)
committerEric Harney <eharney@redhat.com>
Tue, 8 Sep 2015 18:25:06 +0000 (14:25 -0400)
manage_existing() and unmanage() only exist in the deprecated
VolumeDriver() class and not BaseVD.  This means that drivers
inheriting from *VD hit attribute errors when trying to call
either of these methods.

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

Change-Id: Ie8aba971b51e1f5eaac5a4e681ea06b358ebb7b8

cinder/tests/unit/test_glusterfs.py
cinder/volume/driver.py

index 1ab471c4f607debfcd1fd25be3f54679c5e00fb3..ccc424d049dfddd80b3fa008da97a6f2d16caeb9 100644 (file)
@@ -1805,3 +1805,24 @@ class GlusterFsDriverTestCase(test.TestCase):
                                  mock.sentinel.host)
 
         self.assertEqual((False, None), ret)
+
+    def test_manage_existing_is_there(self):
+        """Ensure that driver.manage_existing() is there."""
+
+        drv = self._driver
+
+        volume = self._simple_volume(id=mock.sentinel.manage_id)
+
+        self.assertRaises(NotImplementedError,
+                          drv.manage_existing,
+                          volume, mock.sentinel.existing_ref)
+
+    def test_unmanage_is_there(self):
+        """Ensure that driver.unmanage() is there."""
+
+        drv = self._driver
+
+        volume = self._simple_volume(id=mock.sentinel.unmanage_id)
+        self.assertRaises(NotImplementedError,
+                          drv.unmanage,
+                          volume)
index 2b3f2a540e9c3c4d79160b2c70229bcb238f8e6b..246f25a93201be9d9ff07758a2756fe15794217d 100644 (file)
@@ -1404,6 +1404,22 @@ class BaseVD(object):
         """
         return (False, None)
 
+    def manage_existing(self, volume, existing_ref):
+        """Manage exiting stub.
+
+        This is for drivers that don't implement manage_existing().
+        """
+        msg = _("Manage existing volume not implemented.")
+        raise NotImplementedError(msg)
+
+    def unmanage(self, volume):
+        """Unmanage stub.
+
+        This is for drivers that don't implement unmanage().
+        """
+        msg = _("Unmanage volume not implemented.")
+        raise NotImplementedError(msg)
+
 
 @six.add_metaclass(abc.ABCMeta)
 class LocalVD(object):