Bug 1699858 - Improve the dump info of qcow2: external data file images with different preallocation modes
Summary: Improve the dump info of qcow2: external data file images with different prea...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: Tingting Mao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-15 11:56 UTC by Tingting Mao
Modified: 2019-11-06 07:14 UTC (History)
9 users (show)

Fixed In Version: qemu-kvm-4.1.0-1.module+el8.1.0+3966+4a23dca1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:14:08 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:14:36 UTC

Description Tingting Mao 2019-04-15 11:56:55 UTC
Description of problem:
The dump info for qcow2: external data file images is a little hard to understand, which needs to improve.


Version-Release number of selected component (if applicable):
kernel-4.18.0-80.el8
qemu: upstream with latest commit id - afccfc0c4c6134a7bc9da6375996b3b91d291de4


How reproducible:
100%


Steps to Reproduce:

Metadata:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=metadata base.qcow2 5G

# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 0},
{ "start": 2147479552, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 2147479552},
{ "start": 2147483648, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 2147483648},
{ "start": 4294963200, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 4294963200},
{ "start": 4294967296, "length": 1073741824, "depth": 0, "zero": true, "data": true, "offset": 4294967296}]


Falloc:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=falloc base.qcow2 5G

# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 0},
{ "start": 2147479552, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 2147479552},
{ "start": 2147483648, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 2147483648},
{ "start": 4294963200, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 4294963200},
{ "start": 4294967296, "length": 1073741824, "depth": 0, "zero": true, "data": true, "offset": 4294967296}]


Full:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=full base.qcow2 5G
# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 0},
{ "start": 2147479552, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 2147479552},
{ "start": 2147483648, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 2147483648},
{ "start": 4294963200, "length": 1073745920, "depth": 0, "zero": false, "data": true, "offset": 4294963200}]


Actual results:
As above.


Expected results:
Maybe the dump info should be like the one of the normal qcow2 files:

    Full:
    # qemu-img create -f qcow2 -o preallocation=full test.qcow2 5G
    Formatting 'test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=full lazy_refcounts=off refcount_bits=16
    # qemu-img map --output=json test.qcow2
    [{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 458752}]
    
    Metadata:    
    # qemu-img create -f qcow2 -o preallocation=metadata test.qcow2 5G
    Formatting 'test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16
    # qemu-img map --output=json test.qcow2
    [{ "start": 0, "length": 458752, "depth": 0, "zero": false, "data": true, "offset": 327680},
    { "start": 458752, "length": 536412160, "depth": 0, "zero": true, "data": true, "offset": 786432},
    { "start": 536870912, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 537264128},
    { "start": 1073741824, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 1074200576},
    { "start": 1610612736, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 1611137024},
    { "start": 2147483648, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": 2148139008},
    { "start": 2147549184, "length": 536805376, "depth": 0, "zero": true, "data": true, "offset": 2148204544},
    { "start": 2684354560, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 2685075456},
    { "start": 3221225472, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 3222011904},
    { "start": 3758096384, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 3758948352},
    { "start": 4294967296, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": 4295950336},
    { "start": 4295032832, "length": 536805376, "depth": 0, "zero": true, "data": true, "offset": 4296015872},
    { "start": 4831838208, "length": 536866816, "depth": 0, "zero": true, "data": true, "offset": 4832886784},
    { "start": 5368705024, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 5369753600}]
       
    Falloc: 
    # qemu-img create -f qcow2 -o preallocation=falloc test.qcow2 5G
    Formatting 'test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=falloc lazy_refcounts=off refcount_bits=16
    # qemu-img map --output=json test.qcow2
    [{ "start": 0, "length": 327680, "depth": 0, "zero": false, "data": true, "offset": 458752},
    { "start": 327680, "length": 5368381440, "depth": 0, "zero": true, "data": true, "offset": 786432}]


Additional info:

Comment 1 Kevin Wolf 2019-04-15 16:16:24 UTC
Preallocation turned out to have real bugs. Unfortunately, it's probably a bit too late for 4.0, but I sent patches upstream: https://lists.gnu.org/archive/html/qemu-block/2019-04/msg00443.html

Comment 6 Tingting Mao 2019-08-20 06:08:30 UTC
Tried to verify this bug as below:


Tested with:
qemu-kvm-4.1.0-1.module+el8.1.0+3966+4a23dca1
kernel-4.18.0-134.el8


Steps:
Default/off:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=off base.qcow2 5G

# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 5368709120, "depth": 0, "zero": true, "data": false}]


Full:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=full base.qcow2 5G

# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 0}]


Folloc:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=falloc base.qcow2 5G

# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 0}]

# qemu-img map base.img --output=json
[{ "start": 0, "length": 16384, "depth": 0, "zero": false, "data": true, "offset": 0},
{ "start": 16384, "length": 5368692736, "depth": 0, "zero": true, "data": false, "offset": 16384}]


Metadata:
# qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=metadata base.qcow2 5G

# qemu-img map base.qcow2 --output=json
[{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 0}]

Comment 10 errata-xmlrpc 2019-11-06 07:14:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3723


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