]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
optimize the copy_image_to_volume method of sheepdogdriver
authorzhangsong <zhangsong@cmss.chinamobile.com>
Sat, 24 Oct 2015 16:47:47 +0000 (00:47 +0800)
committerIvan Kolodyazhny <e0ne@e0ne.info>
Wed, 28 Oct 2015 09:14:02 +0000 (09:14 +0000)
the current copy_image_to_volume method of sheepdogdriver can only
write the image file to local sheepdog, with this patch, it supports
write image file to remote sheepdog node.

Closes-Bug: #1509910
Change-Id: I5084ef2c048439ad8b9d6ae56ce8cccaadc26262

cinder/volume/drivers/sheepdog.py

index 217890664fb65fbb2749981deec02b7ce87d7195..21956cdd5768c8dbc62440ec24b69dfeb6de9823 100644 (file)
@@ -529,8 +529,13 @@ class SheepdogDriver(driver.VolumeDriver):
             # see volume/drivers/manager.py:_create_volume
             self.client.delete(volume.name)
             # convert and store into sheepdog
-            image_utils.convert_image(tmp, 'sheepdog:%s' % volume['name'],
-                                      'raw')
+            image_utils.convert_image(
+                tmp,
+                'sheepdog:%(addr)s:%(port)d:%(name)s' % {
+                    'addr': CONF.sheepdog_store_address,
+                    'port': CONF.sheepdog_store_port,
+                    'name': volume['name']},
+                'raw')
             self.client.resize(volume.name, volume.size)
 
     def copy_volume_to_image(self, context, volume, image_service, image_meta):