]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
RemoteFsDriver: copy_image_to_volume and copy_volume_to_image
authorEric Harney <eharney@redhat.com>
Fri, 17 May 2013 18:48:24 +0000 (14:48 -0400)
committerEric Harney <eharney@redhat.com>
Fri, 17 May 2013 19:17:53 +0000 (15:17 -0400)
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

index 90826451e0cf84f81ee8316c1a84890744db2ad4..5914ed72ab6294d92bdf9e2349bd28382fd20d59 100755 (executable)
@@ -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))