From: Eric Harney Date: Tue, 8 Sep 2015 20:23:45 +0000 (-0400) Subject: Add unmanage default implementation to VolumeDriver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=bf22aeb185afe8de0db526c83e50c15113f84d88;p=openstack-build%2Fcinder-build.git Add unmanage default implementation to VolumeDriver 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 --- diff --git a/cinder/tests/unit/test_volume.py b/cinder/tests/unit/test_volume.py index 53456c909..651300677 100644 --- a/cinder/tests/unit/test_volume.py +++ b/cinder/tests/unit/test_volume.py @@ -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""" diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 36111157e..ce11e7525 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -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.")