From 615b4508a5608301c4f6962f0d11bdca31a70c11 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Fri, 17 May 2013 14:48:24 -0400 Subject: [PATCH] RemoteFsDriver: copy_image_to_volume and copy_volume_to_image This functionality was recently added to the NFS driver -- it should instead be added to the RemoteFsDriver class to cover both NFS and GlusterFS drivers. Change-Id: I10136f8d1628128a93c4adfe2cb9447b99720558 --- cinder/volume/drivers/nfs.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 90826451e..5914ed72a 100755 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -110,6 +110,20 @@ class RemoteFsDriver(driver.VolumeDriver): (in a hex format).""" return hashlib.md5(base_str).hexdigest() + def copy_image_to_volume(self, context, volume, image_service, image_id): + """Fetch the image from image_service and write it to the volume.""" + image_utils.fetch_to_raw(context, + image_service, + image_id, + self.local_path(volume)) + + def copy_volume_to_image(self, context, volume, image_service, image_meta): + """Copy the volume to the specified image.""" + image_utils.upload_volume(context, + image_service, + image_meta, + self.local_path(volume)) + class NfsDriver(RemoteFsDriver): """NFS based cinder driver. Creates file on NFS share for using it @@ -341,17 +355,3 @@ class NfsDriver(RemoteFsDriver): data['reserved_percentage'] = 0 data['QoS_support'] = False self._stats = data - - def copy_image_to_volume(self, context, volume, image_service, image_id): - """Fetch the image from image_service and write it to the volume.""" - image_utils.fetch_to_raw(context, - image_service, - image_id, - self.local_path(volume)) - - def copy_volume_to_image(self, context, volume, image_service, image_meta): - """Copy the volume to the specified image.""" - image_utils.upload_volume(context, - image_service, - image_meta, - self.local_path(volume)) -- 2.45.2