]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add migrate_volume to BaseVD
authorEric Harney <eharney@redhat.com>
Tue, 8 Sep 2015 17:31:31 +0000 (13:31 -0400)
committerEric Harney <eharney@redhat.com>
Tue, 8 Sep 2015 18:12:08 +0000 (14:12 -0400)
migrate_volume() 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.migrate_volume().

I suspect this indicates that we should rework some of our
abc class structure a little bit, but this seems like a
reasonable fix for now.

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

Change-Id: I3d555507416606db265b8ebe335b51a08fe32328

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

index 776acafa28f0fd8fc566556839d585b2233b0f77..1ab471c4f607debfcd1fd25be3f54679c5e00fb3 100644 (file)
@@ -1792,3 +1792,16 @@ class GlusterFsDriverTestCase(test.TestCase):
             mock_upload_volume.assert_called_once_with(
                 mock.ANY, mock.ANY, mock.ANY, upload_path)
             self.assertEqual(1, mock_create_temporary_file.call_count)
+
+    def test_migrate_volume_is_there(self):
+        """Ensure that driver.migrate_volume() is there."""
+
+        drv = self._driver
+
+        ctxt = context.RequestContext('fake_user', 'fake_project')
+        volume = self._simple_volume()
+        ret = drv.migrate_volume(ctxt,
+                                 volume,
+                                 mock.sentinel.host)
+
+        self.assertEqual((False, None), ret)
index f8378871b4adebd38f3b9bc67040a0d8c8127f7f..2b3f2a540e9c3c4d79160b2c70229bcb238f8e6b 100644 (file)
@@ -1396,6 +1396,14 @@ class BaseVD(object):
         """
         return None
 
+    def migrate_volume(self, context, volume, host):
+        """Migrate volume stub.
+
+        This is for drivers that don't implement an enhanced version
+        of this operation.
+        """
+        return (False, None)
+
 
 @six.add_metaclass(abc.ABCMeta)
 class LocalVD(object):