Bug 1589738 - Failure to run qemu-img map on a file with multiple blocks
Summary: Failure to run qemu-img map on a file with multiple blocks
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 28
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1590024
TreeView+ depends on / blocked
 
Reported: 2018-06-11 09:57 UTC by Maor
Modified: 2018-08-21 13:33 UTC (History)
13 users (show)

Fixed In Version:
Clone Of:
: 1590024 (view as bug list)
Environment:
Last Closed: 2018-08-21 13:15:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Maor 2018-06-11 09:57:18 UTC
Description of problem:
We have encountered a failure running qemu-img map on a file with multiple blocks.

Failure qemu-img map on FC28:

# rpm -qa | grep qemu
qemu-audio-alsa-2.12.0-0.5.rc1.fc28.x86_64
qemu-block-curl-2.12.0-0.5.rc1.fc28.x86_64
qemu-block-nfs-2.12.0-0.5.rc1.fc28.x86_64
qemu-ui-sdl-2.12.0-0.5.rc1.fc28.x86_64
qemu-img-2.12.0-0.5.rc1.fc28.x86_64
qemu-common-2.12.0-0.5.rc1.fc28.x86_64
qemu-audio-oss-2.12.0-0.5.rc1.fc28.x86_64
qemu-audio-sdl-2.12.0-0.5.rc1.fc28.x86_64
qemu-block-dmg-2.12.0-0.5.rc1.fc28.x86_64
qemu-block-iscsi-2.12.0-0.5.rc1.fc28.x86_64
qemu-block-rbd-2.12.0-0.5.rc1.fc28.x86_64
qemu-ui-gtk-2.12.0-0.5.rc1.fc28.x86_64
qemu-system-x86-core-2.12.0-0.5.rc1.fc28.x86_64
qemu-kvm-2.12.0-0.5.rc1.fc28.x86_64
libvirt-daemon-driver-qemu-4.2.0-1.fc28.x86_64
ipxe-roms-qemu-20170710-3.git0600d3ae.fc28.noarch
qemu-audio-pa-2.12.0-0.5.rc1.fc28.x86_64
qemu-block-gluster-2.12.0-0.5.rc1.fc28.x86_64
qemu-ui-curses-2.12.0-0.5.rc1.fc28.x86_64
qemu-system-x86-2.12.0-0.5.rc1.fc28.x86_64

[root@dhcp163-43 vdsm]# python
Python 2.7.15 (default, May 16 2018, 17:50:09) 
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> filename = "/tmp/test2"
>>> with io.open(filename, "wb") as f:
...     f.write(b"x")
...     f.seek(16 * 1024)
...     f.write(b"x")
...     f.seek(42 * 1024)
...     f.write(b"x")
... 
1L
16384L
1L
43008L
1L
>>> 

Run the following command on that file:
    /usr/bin/qemu-img map --output json /tmp/test2

/usr/bin/qemu-img map --output json /tmp/test2
[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 0},
{ "start": 4096, "length": 12288, "depth": 0, "zero": true, "data": false, "offset": 4096},
{ "start": 16384, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 16384},
qemu-img: /builddir/build/BUILD/qemu-2.12.0-rc1/qemu-img.c:2680: get_block_status: Assertion `bytes' failed.
Aborted (core dumped)


A successful qemu-img map on FC27
# rpm -qa | grep qemu
qemu-system-x86-2.11.0-4.fc27.x86_64
qemu-guest-agent-2.11.0-4.fc27.x86_64
qemu-block-rbd-2.11.0-4.fc27.x86_64
qemu-img-2.11.0-4.fc27.x86_64
qemu-system-x86-core-2.11.0-4.fc27.x86_64
qemu-block-iscsi-2.11.0-4.fc27.x86_64
libvirt-daemon-driver-qemu-4.0.0-2.fc27.x86_64
ipxe-roms-qemu-20170710-3.git0600d3ae.fc27.noarch
qemu-sanity-check-nodeps-1.1.5-8.fc27.x86_64
qemu-kvm-2.11.0-4.fc27.x86_64
qemu-block-dmg-2.11.0-4.fc27.x86_64
qemu-common-2.11.0-4.fc27.x86_64
qemu-block-nfs-2.11.0-4.fc27.x86_64
qemu-block-ssh-2.11.0-4.fc27.x86_64
qemu-block-gluster-2.11.0-4.fc27.x86_64
qemu-block-curl-2.11.0-4.fc27.x86_64

Creating a file with the following python script:

>>> import io
>>> filename = "/tmp/test"
>>> with io.open(filename, "wb") as f:
...     f.write(b"x")
...     f.seek(16 * 1024)
...     f.write(b"x")
...     f.seek(42 * 1024)
...     f.write(b"x")
... 
1L
16384L
1L
43008L
1L

Run the following command on that file:
    /usr/bin/qemu-img map --output json /tmp/test

Output:
[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 0},
{ "start": 4096, "length": 12288, "depth": 0, "zero": true, "data": false, "offset": 4096},
{ "start": 16384, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 16384},
{ "start": 20480, "length": 20480, "depth": 0, "zero": true, "data": false, "offset": 20480},
{ "start": 40960, "length": 2560, "depth": 0, "zero": false, "data": true, "offset": 40960}]

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


How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Nir Soffer 2018-06-11 10:42:43 UTC
Kevin, can you take a look?

Comment 2 Eric Blake 2018-06-11 21:46:07 UTC
Patch posted upstream:
https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg02905.html

Comment 3 Nir Soffer 2018-08-19 18:53:09 UTC
Eric, is this fixed in Fedora 28?

Comment 4 Eric Blake 2018-08-21 12:18:55 UTC
Confirmed that qemu-img.x86_64 2:2.11.2-1.fc28 contains the fix

Comment 5 Eric Blake 2018-08-21 12:21:45 UTC
However, fedora-virt-preview ships qemu-img.x86_64 2:2.12.0-0.5.rc1.fc28 which still has the bug. Cole?

Comment 6 Cole Robinson 2018-08-21 13:15:24 UTC
(In reply to Eric Blake from comment #5)
> However, fedora-virt-preview ships qemu-img.x86_64 2:2.12.0-0.5.rc1.fc28
> which still has the bug. Cole?

virt-preview has moved to a copr repo now, the old location is discontinued and isn't being updated anymore. So remove the old one and do: sudo dnf copr enable @virtmaint-sig/virt-preview

Latest details are here: https://fedoraproject.org/wiki/Virtualization_Preview_Repository

Comment 7 Eric Blake 2018-08-21 13:33:36 UTC
Indeed, that ships with qemu-img.x86_64 2:3.0.0-1.fc28, where the problem is fixed.


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