]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add retype in lvm driver
authorLisaLi <xiaoyan.li@intel.com>
Fri, 13 Nov 2015 02:09:03 +0000 (02:09 +0000)
committerLisaLi <xiaoyan.li@intel.com>
Tue, 1 Dec 2015 02:17:10 +0000 (02:17 +0000)
During retype operation, it makes sure that volume
types have same encryption, and same backend qos
before moving on.

In lvm driver, no extra_spec and qos are used. As
a result, if retype a volume to same host, it just
needs to return True, and no needs to migrate the
volume.

Change-Id: Id6273046424190ee3e36dabd4bfcf69466bf23ad
Closes-Bug: #1515840

cinder/tests/unit/test_volume.py
cinder/volume/drivers/lvm.py

index 112f436a3a05dc7d33525bff7132b55bf2631399..12477fe3c2df0bcf8aa607904dc55b2519fbe208 100644 (file)
@@ -7104,6 +7104,15 @@ class LVMVolumeDriverTestCase(DriverTestCase):
 
         mock_volume_get.assert_called_with(self.context, vol['id'])
 
+    def test_retype_volume(self):
+        vol = tests_utils.create_volume(self.context)
+        new_type = 'fake'
+        diff = {}
+        host = 'fake_host'
+        retyped = self.volume.driver.retype(self.context, vol, new_type,
+                                            diff, host)
+        self.assertTrue(retyped)
+
     def test_update_migrated_volume(self):
         fake_volume_id = 'vol1'
         fake_new_volume_id = 'vol2'
index 2c163788f64de919fba25b61aef2dc1ff79b88e6..0c1d2d1a2fa953c3a9bbc5486e45edea07683b70 100644 (file)
@@ -625,6 +625,14 @@ class LVMVolumeDriver(driver.VolumeDriver):
             existing_ref = {"source-name": existing_ref}
         return self.manage_existing(snapshot_temp, existing_ref)
 
+    def retype(self, context, volume, new_type, diff, host):
+        """Retypes a volume, allow QoS and extra_specs change."""
+
+        LOG.debug('LVM retype called for volume %s. No action '
+                  'required for LVM volumes.',
+                  volume['id'])
+        return True
+
     def migrate_volume(self, ctxt, volume, host, thin=False, mirror_count=0):
         """Optimize the migration if the destination is on the same server.