]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add unmanage default implementation to VolumeDriver
authorEric Harney <eharney@redhat.com>
Tue, 8 Sep 2015 20:23:45 +0000 (16:23 -0400)
committerEric Harney <eharney@redhat.com>
Tue, 8 Sep 2015 20:38:00 +0000 (16:38 -0400)
Currently, only drivers that inherit from ManageableVD
get the default unmanage() implementation.

This is not correct, because drivers can support unmanage
without driver code.  Fix unmanage() in VolumeDriver to
support the LVM driver's unmanage operation.

(Regression from the refactoring done when introducing
abc classes.)

Closes-Bug: #1493544

Change-Id: Iaacf10141559a2c88b5873722d1e237dc9223f27

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

index 53456c909b9e237d4ae320ed306878436e732cad..651300677484619ed90d10227539f379268942a0 100644 (file)
@@ -6695,6 +6695,12 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
                           self.volume.driver.manage_existing_snapshot_get_size,
                           snp, ref)
 
+    def test_lvm_unmanage(self):
+        volume = tests_utils.create_volume(self.context, status='available',
+                                           size=1, host=CONF.host)
+        ret = self.volume.driver.unmanage(volume)
+        self.assertEqual(ret, None)
+
 
 class LVMVolumeDriverTestCase(DriverTestCase):
     """Test case for VolumeDriver"""
index 36111157e668e527dd1cff7d7f2ad42d99d73af8..ce11e75257d4ed6a7dea753165923366ced6ee49 100644 (file)
@@ -1957,8 +1957,7 @@ class VolumeDriver(ConsistencyGroupVD, TransferVD, ManageableVD, ExtendVD,
         raise NotImplementedError(msg)
 
     def unmanage(self, volume):
-        msg = _("Unmanage volume not implemented.")
-        raise NotImplementedError(msg)
+        pass
 
     def manage_existing_snapshot(self, snapshot, existing_ref):
         msg = _("Manage existing snapshot not implemented.")