Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1590024

Summary: Failure to run qemu-img map on a file with multiple blocks
Product: Red Hat Enterprise Linux 7 Reporter: Ademar Reis <areis>
Component: qemu-kvm-rhevAssignee: Eric Blake <eblake>
Status: CLOSED DUPLICATE QA Contact: Tingting Mao <timao>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: amit, berrange, cfergeau, chayang, coli, danken, dwmw2, eblake, extras-qa, itamar, juzhang, kwolf, michen, mlipchuk, ngu, nsoffer, pbonzini, pingl, qzhang, rjones, virt-maint, virt-maint
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1589738 Environment:
Last Closed: 2018-08-21 12:30:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1589738    
Bug Blocks:    

Description Ademar Reis 2018-06-11 22:21:55 UTC
+++ This bug was initially created as a clone of Bug #1589738 +++

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:

--- Additional comment from Nir Soffer on 2018-06-11 07:42:43 BRT ---

Kevin, can you take a look?

--- Additional comment from Eric Blake on 2018-06-11 18:46:07 BRT ---

Patch posted upstream:
https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg02905.html

Comment 2 Nir Soffer 2018-08-19 18:53:57 UTC
Eric, is this fixed in RHEL 7.6?

Comment 3 Eric Blake 2018-08-21 12:30:47 UTC

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