Bug 1662095

Summary: Incomplete backing-chain info got by "qemu-img info xxx -U --backing-chain"
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: aihua liang <aliang>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED NOTABUG QA Contact: aihua liang <aliang>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: aliang, chayang, coli, juzhang, michen, ngu, qzhang, rbalakri, ribarry, 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: Environment:
Last Closed: 2019-02-03 05:42:09 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:

Description aihua liang 2018-12-26 06:34:56 UTC
Description of problem:
 Incomplete backing-chain info got by "qemu-img info xxx -U --backing-chain"

Version-Release number of selected component (if applicable):
 kernel version: 4.18.0-57.el8.x86_64
 qemu-kvm version: qemu-kvm-3.1.0-2.module+el8+2606+2c716ad7.x86_64


How reproducible:
 100%

Steps to Reproduce:
1.Start guest with iscsi backend:
   /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1' \
    -machine q35  \
    -nodefaults \
    -device VGA,bus=pcie.0,addr=0x1 \
    -device pcie-root-port,id=pcie_root_port_0,slot=2,chassis=2,addr=0x2,bus=pcie.0 \
    -device pcie-root-port,id=pcie_root_port_1,slot=3,chassis=3,addr=0x3,bus=pcie.0 \
    -device pcie-root-port,id=pcie_root_port_2,slot=4,chassis=4,addr=0x4,bus=pcie.0  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/var/tmp/monitor-qmpmonitor1-20181225-045358-gDqDsfCu,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/var/tmp/monitor-catch_monitor-20181225-045358-gDqDsfCu,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control \
    -device pvpanic,ioport=0x505,id=idHtZPbY  \
    -chardev socket,id=serial_id_serial0,path=/var/tmp/serial-serial0-20181225-045358-gDqDsfCu,server,nowait \
    -device isa-serial,chardev=serial_id_serial0  \
    -chardev socket,id=seabioslog_id_20181225-045358-gDqDsfCu,path=/var/tmp/seabios-20181225-045358-gDqDsfCu,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20181225-045358-gDqDsfCu,iobase=0x402 \
    -device pcie-root-port,id=pcie.0-root-port-5,slot=5,chassis=5,addr=0x5,bus=pcie.0 \
    -device qemu-xhci,id=usb1,bus=pcie.0-root-port-5,addr=0x0 \
    -blockdev driver=file,node-name=driveimage1,filename=/mnt/test/rhel80-64-virtio.raw \
    -blockdev node-name=drive_image1,file=driveimage1,driver=raw \
    -device pcie-root-port,id=pcie.0-root-port-6,slot=6,chassis=6,addr=0x6,bus=pcie.0 \
    -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pcie.0-root-port-6,addr=0x0 \
    -device pcie-root-port,id=pcie.0-root-port-7,slot=7,chassis=7,addr=0x7,bus=pcie.0 \
    -device virtio-net-pci,mac=9a:14:15:16:17:18,id=idQJqHNz,vectors=4,netdev=idXGWoum,bus=pcie.0-root-port-7,addr=0x0  \
    -netdev tap,id=idXGWoum,vhost=on \
    -m 14336  \
    -smp 10,maxcpus=10,cores=5,threads=1,sockets=2  \
    -cpu 'Broadwell',+kvm_pv_unhalt \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -vnc :0  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -monitor stdio \
    -qmp tcp:0:3000,server,nowait \

2. Create snapshot image sn1,sn2,sn3,sn4 in previous
    {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn$i','size':21474836480},'job-id':'job1'}}
    {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn$i','filename':'/root/sn$i'}}
    {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn$i','size':21474836480},'job-id':'job2'}}
    {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn$i','file':'drive_sn$i'}}
    {'execute':'job-dismiss','arguments':{'id':'job1'}}
    {'execute':'job-dismiss','arguments':{'id':'job2'}}

3. Create snapshot chain "base->sn1->sn2->sn3->sn4"
   {"execute":"blockdev-snapshot","arguments":   {"node":"drive_image1","overlay":"sn1"}}
   {"execute":"blockdev-snapshot","arguments":{"node":"sn1","overlay":"sn2"}}
   {"execute":"blockdev-snapshot","arguments":{"node":"sn2","overlay":"sn3"}}
   {"execute":"blockdev-snapshot","arguments":{"node":"sn3","overlay":"sn4"}}

4. Check block info 
   4.1 (qemu)info block
         (qemu) info block
    sn4: /root/sn4 (qcow2)
    Attached to:      /machine/peripheral/image1/virtio-backend
    Cache mode:       writeback
    Backing file:     /root/sn3 (chain depth: 4)

   4.2 (host)#qemu-img info /root/sn4 -U --backing-chain
       # qemu-img info sn4 -U --backing-chain
         image: sn4
         file format: qcow2
         virtual size: 20G (21474836480 bytes)
         disk size: 196K
         cluster_size: 65536
         Format specific information:
           compat: 1.1
           lazy refcounts: false
           refcount bits: 16
           corrupt: false

5. Do block commit from sn3 to sn1:
    {'execute': 'block-commit', 'arguments': { 'device': 'sn4', 'base-node':'sn1', 'top-node':'sn3','job-id':'j1'}}

6. Check block info:
   6.1 (qemu)info block
    sn4: /root/sn4 (qcow2)
        Attached to:      /machine/peripheral/image1/virtio-backend
        Cache mode:       writeback
        Backing file:     /root/sn1 (chain depth: 2)

   6.2(qemu)#qemu-img info /root/sn4 -U --backing-chain
image: sn4
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 580K
cluster_size: 65536
backing file: /root/sn1
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

image: /root/sn1
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 2.0M
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
   
Actual results:
In step4.2, no backing-chains info displayed.

In step6.2, base info not displayed.


Expected results:

In step4.2, all snapshots info should be displayed.

In step6.2, base info should also be displayed.

Comment 1 aihua liang 2018-12-26 06:38:02 UTC
Run on qemu-kvm-2-12-0-42-module-el8-2173-537e5cb5-x86_64, don't hit this issue.

Comment 3 Ademar Reis 2019-01-03 16:31:19 UTC
(In reply to aihua liang from comment #1)
> Run on qemu-kvm-2-12-0-42-module-el8-2173-537e5cb5-x86_64, don't hit this
> issue.

Adding Regression keyword.

Comment 4 Kevin Wolf 2019-02-01 15:41:02 UTC
You didn't specify the 'backing-file' option for your 'blockdev-create' commands, so no backing file link is written into the image files. You can still setup a backing chain at runtime with 'blockdev-snapshot', but this doesn't and isn't supposed to update the backing file links.

I would normally close this as NOTABUG, but you claim in comment 1 that you found an old version where this doesn't happen. Can you confirm that you did the exact same steps on the old version? QEMU never had code that was supposed to update the backing file links during blockdev-snapshot.

Comment 5 aihua liang 2019-02-03 05:42:09 UTC
Retest it on qemu-kvm-2.12.0-60.module+el8+2725+0ab65287.x86_64, it has same result as qemu-kvm-3.1.0-2.module+el8+2606+2c716ad7.x86_64.

According to kevin's comment in comment4, close this bug as NOTABUG.