From 4d522b9dc2cf0c727ff65e533241a8302b68ddf8 Mon Sep 17 00:00:00 2001 From: leseb Date: Wed, 15 May 2013 13:45:45 +0200 Subject: [PATCH] Implement cloned volume for the RBD driver 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 6a8f5c044..f31c4cdae 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -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.""" -- 2.45.2