21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
authorQiang Strony Zhang <strony.zhang@oracle.com>
Wed, 11 Nov 2015 17:40:21 -0800
changeset 5082 6af6ba7e1697
parent 5081 198d4a3e4b73
child 5083 30d15206ebc4
21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
components/openstack/cinder/files/cinder.exec_attr
components/openstack/cinder/patches/06-enable-dd.patch
components/openstack/cinder/patches/09-launchpad-1414867.patch
--- a/components/openstack/cinder/files/cinder.exec_attr	Wed Nov 11 12:06:59 2015 -0800
+++ b/components/openstack/cinder/files/cinder.exec_attr	Wed Nov 11 17:40:21 2015 -0800
@@ -3,7 +3,7 @@
 
 cinder-volume:solaris:cmd:RO::/usr/bin/chown:euid=0
 
-cinder-volume:solaris:cmd:RO::/usr/bin/dd:privs=file_dac_read
+cinder-volume:solaris:cmd:RO::/usr/bin/dd:privs={zone}\:/devices/*
 
 cinder-volume:solaris:cmd:RO::/usr/sbin/fcadm:privs=file_dac_read,sys_devices
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/cinder/patches/06-enable-dd.patch	Wed Nov 11 17:40:21 2015 -0800
@@ -0,0 +1,13 @@
+In-house supporting volume_dd_blocksize ('1M', 'G') to enable 'dd' to run on Solaris. This patch
+is Solaris-specific and not suitable for upstream.
+
+--- cinder-2014.2.2/cinder/volume/utils.py.old	2015-10-20 12:55:15.089090904 -0700
++++ cinder-2014.2.2/cinder/volume/utils.py	2015-10-20 12:55:23.640892844 -0700
+@@ -281,6 +281,7 @@
+         bs = strutils.string_to_bytes('%sB' % blocksize)
+ 
+     count = math.ceil(size_in_m * units.Mi / bs)
++    blocksize = int(bs)
+ 
+     return blocksize, int(count)
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/cinder/patches/09-launchpad-1414867.patch	Wed Nov 11 17:40:21 2015 -0800
@@ -0,0 +1,37 @@
+This upstream patch addresses Launchpad bug 1414867. Although it's been
+addressed in Kilo, the patch below is still not yet released for Juno.
+
+commit 549144f754a8b3adb9d7fdfa8f8f9ee186a52f1e
+Author: wuyuting <email address hidden>
+Date: Tue Jan 27 02:50:28 2015 +0800
+
+    Fetch_to_volume_format calls copy_volume using wrong parameter
+
+    When creating a volume from an image, if qemu-img is not installed,
+    fetch_to_volume_format will call volume_utils.copy_volume to copy
+    image to volume. Copy_volume need the size of image in megabyte,
+    but fetch_to_volume_format call it using size in bytes.
+
+    Change-Id: Ia3b0f9168235a977a12232e27a5755ad11ec18f5
+    Closes-Bug: #1414867
+
+--- cinder-2014.2.2/cinder/image/image_utils.py.orig	2015-10-19 15:59:34.730112261 -0700
++++ cinder-2014.2.2/cinder/image/image_utils.py	2015-10-19 16:02:05.982843565 -0700
+@@ -25,6 +25,7 @@
+ 
+ 
+ import contextlib
++import math
+ import os
+ import tempfile
+ 
+@@ -238,7 +239,8 @@
+             LOG.debug('Copying image from %(tmp)s to volume %(dest)s - '
+                       'size: %(size)s' % {'tmp': tmp, 'dest': dest,
+                                           'size': image_meta['size']})
+-            volume_utils.copy_volume(tmp, dest, image_meta['size'], blocksize)
++            image_size_m = math.ceil(image_meta['size'] / units.Mi)
++            volume_utils.copy_volume(tmp, dest, image_size_m, blocksize)
+             return
+ 
+         data = qemu_img_info(tmp)