From: Mehdi Abaakouk Date: Tue, 7 May 2013 08:37:10 +0000 (+0200) Subject: Implement copy_image_to_volume and copy_volume_to_image on nfs backends X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7ad6ac41c45e5792c6d9cdac0bcce21976e4ef62;p=openstack-build%2Fcinder-build.git Implement copy_image_to_volume and copy_volume_to_image on nfs backends Fixes: bug #1177288 Change-Id: I1c034de4acf13c52e399ba4623a0c8f2110fd695 --- diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 4638e1268..ac98b972e 100755 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -22,6 +22,7 @@ import os from oslo.config import cfg from cinder import exception +from cinder.image import image_utils from cinder.openstack.common import log as logging from cinder.volume import driver @@ -340,3 +341,17 @@ 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))