]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Implement cloned volume for the RBD driver
authorleseb <sebastien.han@enovance.com>
Wed, 15 May 2013 11:45:45 +0000 (13:45 +0200)
committerleseb <sebastien.han@enovance.com>
Wed, 15 May 2013 11:45:45 +0000 (13:45 +0200)
This adds the support for cloned volume to the RBD driver. This is perform by the
create option --source-volid. Since the clone is pure copy of a volume,
we don't use the clone capability from RBD and simply copy the source
image.

Change-Id: I3b73bc77b74767ffe3583422f56b3603594589ce
Implements: blueprint implement-cloned-volume-for-rbd

cinder/volume/drivers/rbd.py

index 6a8f5c044204c65297c9f9fd5c1ad843b2c2779a..f31c4cdaeb078da743ee0375feafdcd6f7234d32 100644 (file)
@@ -99,7 +99,12 @@ class RBDDriver(driver.VolumeDriver):
         return 'clone' in stdout
 
     def create_cloned_volume(self, volume, src_vref):
-        raise NotImplementedError()
+        """Clone a logical volume"""
+        self._try_execute('rbd', 'cp',
+                          '--pool', self.configuration.rbd_pool,
+                          '--image', src_vref['name'],
+                          '--dest-pool', self.configuration.rbd_pool,
+                          '--dest', volume['name'])
 
     def create_volume(self, volume):
         """Creates a logical volume."""