From 7ad6ac41c45e5792c6d9cdac0bcce21976e4ef62 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Tue, 7 May 2013 10:37:10 +0200 Subject: [PATCH] Implement copy_image_to_volume and copy_volume_to_image on nfs backends Fixes: bug #1177288 Change-Id: I1c034de4acf13c52e399ba4623a0c8f2110fd695 --- cinder/volume/drivers/nfs.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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)) -- 2.45.2