components/openstack/cinder/patches/09-launchpad-1414867.patch
author Qiang Strony Zhang <strony.zhang@oracle.com>
Wed, 11 Nov 2015 17:40:21 -0800
changeset 5082 6af6ba7e1697
permissions -rw-r--r--
21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5082
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     1
This upstream patch addresses Launchpad bug 1414867. Although it's been
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     2
addressed in Kilo, the patch below is still not yet released for Juno.
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     3
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     4
commit 549144f754a8b3adb9d7fdfa8f8f9ee186a52f1e
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     5
Author: wuyuting <email address hidden>
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     6
Date: Tue Jan 27 02:50:28 2015 +0800
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     7
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     8
    Fetch_to_volume_format calls copy_volume using wrong parameter
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
     9
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    10
    When creating a volume from an image, if qemu-img is not installed,
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    11
    fetch_to_volume_format will call volume_utils.copy_volume to copy
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    12
    image to volume. Copy_volume need the size of image in megabyte,
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    13
    but fetch_to_volume_format call it using size in bytes.
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    14
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    15
    Change-Id: Ia3b0f9168235a977a12232e27a5755ad11ec18f5
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    16
    Closes-Bug: #1414867
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    17
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    18
--- cinder-2014.2.2/cinder/image/image_utils.py.orig	2015-10-19 15:59:34.730112261 -0700
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    19
+++ cinder-2014.2.2/cinder/image/image_utils.py	2015-10-19 16:02:05.982843565 -0700
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    20
@@ -25,6 +25,7 @@
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    21
 
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    22
 
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    23
 import contextlib
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    24
+import math
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    25
 import os
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    26
 import tempfile
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    27
 
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    28
@@ -238,7 +239,8 @@
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    29
             LOG.debug('Copying image from %(tmp)s to volume %(dest)s - '
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    30
                       'size: %(size)s' % {'tmp': tmp, 'dest': dest,
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    31
                                           'size': image_meta['size']})
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    32
-            volume_utils.copy_volume(tmp, dest, image_meta['size'], blocksize)
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    33
+            image_size_m = math.ceil(image_meta['size'] / units.Mi)
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    34
+            volume_utils.copy_volume(tmp, dest, image_size_m, blocksize)
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    35
             return
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    36
 
6af6ba7e1697 21952273 default value in volume_dd_blocksize=1M in cinder.conf not supported by solaris
Qiang Strony Zhang <strony.zhang@oracle.com>
parents:
diff changeset
    37
         data = qemu_img_info(tmp)