From: Eric Harney Date: Fri, 17 May 2013 18:48:24 +0000 (-0400) Subject: RemoteFsDriver: copy_image_to_volume and copy_volume_to_image X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=615b4508a5608301c4f6962f0d11bdca31a70c11;p=openstack-build%2Fcinder-build.git 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 --- 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))