Bug 1196698 - qemu: qemu-img isn't equipped to handle many sectors resulting in error on writing
Summary: qemu: qemu-img isn't equipped to handle many sectors resulting in error on wr...
Status: CLOSED DUPLICATE of bug 1196688
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: qemu-kvm-rhev
Version: unspecified
Hardware: x86_64
OS: Linux
Target Milestone: ---
: 7.0 (Kilo)
Assignee: Virtualization Maintenance
QA Contact: Ami Jeain
Depends On:
Blocks: Red Hat1194743
TreeView+ depends on / blocked
Reported: 2015-02-26 14:44 UTC by Dafna Ron
Modified: 2015-02-27 12:18 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-02-27 12:18:16 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Dafna Ron 2015-02-26 14:44:04 UTC
Description of problem:

Based on bug: 1194743 cinder storage team has been investigating along with Stephan. 

The issue appears in cinder when we try to copy an image to a newly created cinder volume and we get an error from qemu. 

2015-02-20 18:33:45.841 4784 TRACE oslo.messaging.rpc.dispatcher ImageCopyFailure: Failed to copy image to volume: qemu-img: error writing zeroes at sector 0: Invalid argument

following investigating, Eric and Stephan agree on the following: 

qemu-img's img_convert calls bdrv_make_zero/bdrv_write_zeroes().  This
results in a call to bdrv_rw_co with nb_sectors=20971520.  The block
device is of length 10737418240 with 512 byte sectors AFAICT from
looking at an strace of qemu-img:

32679 lseek(8, 0, SEEK_END)             = 10737418240
32679 ioctl(8, BLKSSZGET, 512)          = 0

This means nb_sectors is greater than INT_MAX / BDRV_SECTOR_SIZE so
bdrv_rw_co() returns -EINVAL.  [1]

Not really sure how to interpret this, but it seems to be the root
failure.  It looks like qemu-img isn't equipped to handle that many
sectors, basically?  What should we do about this?

#0  bdrv_rw_co (bs=bs@entry=0x555555db4cb0,
sector_num=sector_num@entry=0, buf=buf@entry=0x0, nb_sectors=20971520,
    flags=flags@entry=(BDRV_REQ_ZERO_WRITE | BDRV_REQ_MAY_UNMAP)) at
#1  0x0000555555572a33 in bdrv_write_zeroes (flags=<optimized out>,
nb_sectors=<optimized out>, sector_num=0, bs=0x555555db4cb0) at block.c:2814
#2  bdrv_make_zero (bs=0x555555db4cb0, flags=<optimized out>) at
#3  0x00005555555691a1 in img_convert (argc=<optimized out>,
argv=<optimized out>) at qemu-img.c:1609
#4  0x00007ffff311baf5 in __libc_start_main () from /lib64/libc.so.6
#5  0x000055555556594d in _start ()

Version-Release number of selected component (if applicable):


How reproducible:

100% on all in one openstack 

Steps to Reproduce:
1. install all in one openstack on bare metal machine
2. create an image
3. create a new cinder volume from an image 

Actual results:

we fail to create the cinder volume with error from qemu on writing

Expected results:

we should succeed to create the volume 

Additional info:

Stephan mentioned that there is a patch on line for this that needs to be backported: 

Thanks for investigating this!  I agree with your analysis and there is
a fix upstream which will be backported:



Comment 3 Stefan Hajnoczi 2015-02-27 12:18:16 UTC

*** This bug has been marked as a duplicate of bug 1196688 ***

Note You need to log in before you can comment on or make changes to this bug.