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