Bug 1773925 - Fail to do blockcommit with more than one snapshots
Summary: Fail to do blockcommit with more than one snapshots
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: 8.1
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: aihua liang
URL:
Whiteboard:
Depends On: 1763937
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-19 10:48 UTC by Peter Krempa
Modified: 2020-02-04 18:30 UTC (History)
12 users (show)

Fixed In Version: qemu-kvm-4.1.0-16.module+el8.1.1+4917+752cfd65
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1763937
Environment:
Last Closed: 2020-02-04 18:29:59 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-2020:0404 0 None None None 2020-02-04 18:30:31 UTC

Description Peter Krempa 2019-11-19 10:48:45 UTC
+++ This bug was initially created as a clone of Bug #1763937 +++

Description of problem:
As subject

Version-Release number of selected component (if applicable):
libvirt v5.8.0-304-g2cff65e4c6
qemu-kvm-4.1.0-13.module+el8.1.0+4313+ef76ec61.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start an VM with -blockdev enabled

2. Create 2 external snapshots, then do blockcommit:
virsh snapshot-create-as $VM s1 --no-metadata --disk-only
virsh snapshot-create-as $VM s2 --no-metadata --disk-only
virsh blockcommit $VM sda --active --wait --verbose

Actual results:
error: internal error: unable to execute QEMU command 'block-commit': 'libvirt-1-format' is not in this backing file chain

Expected results:
No error on blockcommit

Additional info:
The issue is not reproduced when -blockdev is disabled.

See the vm xml, libvirtd log(FILTER 2:util 1:qemu 1:security), reproducing script in attachment.

--- Additional comment from Han Han on 2019-10-22 04:21:13 CEST ---

BTW, the issue is not reproduced when only one external snapshot created before blockcommit.

--- Additional comment from Han Han on 2019-10-22 04:45:30 CEST ---

Steps:
Start vm with -blockdev enabled.
Create snapshots on it:
➜  ~ virsh snapshot-create-as copy s1 --no-metadata --disk-only
Domain snapshot s1 created
➜  ~ virsh snapshot-create-as copy s2 --no-metadata --disk-only
Domain snapshot s2 created
➜  ~ virsh snapshot-create-as copy s3 --no-metadata --disk-only
Domain snapshot s3 created

The do shallow blockcommit from mid layer:
➜  ~ virsh blockcommit copy sda --top /var/lib/libvirt/images/copy.s1 --shallow --wait --verbose
error: internal error: unable to execute QEMU command 'block-commit': 'libvirt-2-format' is not in this backing file chain

➜  ~ virsh blockcommit copy sda --top /var/lib/libvirt/images/copy.s1 --shallow --wait --verbose
error: internal error: child reported (status=125): Requested operation is not valid: Setting different SELinux label on /var/lib/libvirt/images/copy.qcow2 which is already in use

--- Additional comment from Peter Krempa on 2019-11-13 08:45:20 CET ---

This is a bug in qemu. When "backing: null" is used to attach the image which will become the overlay via blockdev-snapshot, qemu then during another snapshot applies that property and thus drops the backing chain.

I've described it more in depth here:

https://lists.gnu.org/archive/html/qemu-block/2019-10/msg01404.html

Kevin posted patches for this bug:

https://lists.gnu.org/archive/html/qemu-block/2019-11/msg00234.html

--- Additional comment from aihua liang on 2019-11-14 07:55:50 CET ---

Can reproduce this issue on qemu-kvm-4.1.0-14.module+el8.1.1+4632+a8269660.x86_64.

Reproduce steps:
 1. Start guest with qemu cmds:
      /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1' \
    -machine pc  \
    -nodefaults \
    -device VGA,bus=pci.0,addr=0x2 \
    -m 7168  \
    -smp 4,maxcpus=4,cores=2,threads=1,dies=1,sockets=2  \
    -cpu 'Skylake-Client',+kvm_pv_unhalt  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/var/tmp/monitor-qmpmonitor1-20191113-221853-WI9PnBdR,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/var/tmp/monitor-catch_monitor-20191113-221853-WI9PnBdR,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control \
    -device pvpanic,ioport=0x505,id=idUA0Y6Z \
    -chardev socket,server,nowait,id=chardev_serial0,path=/var/tmp/serial-serial0-20191113-221853-WI9PnBdR \
    -device isa-serial,id=serial0,chardev=chardev_serial0  \
    -chardev socket,id=seabioslog_id_20191113-221853-WI9PnBdR,path=/var/tmp/seabios-20191113-221853-WI9PnBdR,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20191113-221853-WI9PnBdR,iobase=0x402 \
    -device qemu-xhci,id=usb1,bus=pci.0,addr=0x3 \
    -blockdev driver=file,filename=/home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2,node-name=file_node \
    -blockdev driver=qcow2,file=file_node,node-name=drive_image1 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x4 \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device virtio-net-pci,mac=9a:9d:33:c3:3b:1a,id=idFXLnE7,netdev=idjZr0NP,bus=pci.0,addr=0x5  \
    -netdev tap,id=idjZr0NP,vhost=on \
    -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 \

  2. Create two snapshot nodes with blockdev-create with backing-file and backing-fmt set, but add the node with backing:null
     2.1 create sn1
        {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn1','size':21474836480},'job-id':'job1'}}
        {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn1','filename':'/root/sn1'}}
        {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn1','size':21474836480,'backing-file':'/home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2','backing-fmt':'qcow2'},'job-id':'job2'}}
        {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn1','file':'drive_sn1','backing':null}}
        {'execute':'job-dismiss','arguments':{'id':'job1'}}
        {'execute':'job-dismiss','arguments':{'id':'job2'}}

     2.2 check sn1 info online
         # qemu-img info sn1 -U
image: sn1
file format: qcow2
virtual size: 20 GiB (21474836480 bytes)
disk size: 256 KiB
cluster_size: 65536
backing file: /home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
     
    2.3 create sn2 
      {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn2','size':21474836480},'job-id':'job1'}}
        {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn2','filename':'/root/sn2'}}
        {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn2','size':21474836480,'backing-file':'/root/sn1','backing-fmt':'qcow2'},'job-id':'job2'}}
        {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn2','file':'drive_sn2','backing':null}}
        {'execute':'job-dismiss','arguments':{'id':'job1'}}
        {'execute':'job-dismiss','arguments':{'id':'job2'}}
  
    2.4 check sn2 info online
       # qemu-img info sn2 -U
image: sn2
file format: qcow2
virtual size: 20 GiB (21474836480 bytes)
disk size: 256 KiB
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

  3. Do snapshot on drive_image1, check block info
      {"execute":"blockdev-snapshot","arguments":{"node":"drive_image1","overlay":"sn1"}}
{"return": {}}
     (qemu) info block
sn1: /root/sn1 (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2 (chain depth: 1)

  4. Do snapshot on sn1, then check block info:
     {"execute":"blockdev-snapshot","arguments":{"node":"sn1","overlay":"sn2"}}
{"return": {}}
     (qemu) info block
sn2: json:{"backing": {"backing": null, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn1"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn2"}} (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /root/sn1 (chain depth: 1)

  5. Do live commit from sn2 to drive_image1
     {'execute': 'block-commit', 'arguments': { 'device': 'sn2','job-id':'j3'}}
{"timestamp": {"seconds": 1573713458, "microseconds": 106369}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "j3"}}
{"timestamp": {"seconds": 1573713458, "microseconds": 106407}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "j3"}}
{"return": {}}
{"timestamp": {"seconds": 1573713458, "microseconds": 107090}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "j3"}}
{"timestamp": {"seconds": 1573713458, "microseconds": 107115}, "event": "BLOCK_JOB_READY", "data": {"device": "j3", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}

  6. After commit job reach ready status, complete the job.
    { "execute": "block-job-complete", "arguments": { "device": "j3"}}
{"return": {}}
{"timestamp": {"seconds": 1573713484, "microseconds": 42008}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "j3"}}
{"timestamp": {"seconds": 1573713484, "microseconds": 42037}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "j3"}}
{"timestamp": {"seconds": 1573713484, "microseconds": 42143}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "j3", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
{"timestamp": {"seconds": 1573713484, "microseconds": 42191}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "j3"}}
{"timestamp": {"seconds": 1573713484, "microseconds": 42234}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "j3"}}

  7. Check block info:
     (qemu) info block
sn1: json:{"backing": null, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn1"}} (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2 (chain depth: 0)

[...snipped...]

--- Additional comment from Kevin Wolf on 2019-11-19 11:16:18 CET ---

The bug is fixed in upstream commit ae0f57f0aa.

Comment 1 Peter Krempa 2019-11-19 10:51:37 UTC
This clone specifically requests the backport to 8.1.1 as that version also includes fix for https://bugzilla.redhat.com/show_bug.cgi?id=1658981 . Libvirt's code which enables -blockdev assumes that those two fixes are present together and thus not backporting the patches would make libvirt enable blockdev on an unfixed qemu.

Comment 5 aihua liang 2019-11-29 06:10:04 UTC
Test on qemu-kvm-4.1.0-16.module+el8.1.1+4917+752cfd65.x86_64, live_commit works well, but other new issue needs kevin's confirmation.

Test Steps:
    1. Start guest with qemu cmds:
      /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1' \
    -machine pc  \
    -nodefaults \
    -device VGA,bus=pci.0,addr=0x2 \
    -m 7168  \
    -smp 4,maxcpus=4,cores=2,threads=1,dies=1,sockets=2  \
    -cpu 'Skylake-Client',+kvm_pv_unhalt  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/var/tmp/monitor-qmpmonitor1-20191113-221853-WI9PnBdR,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/var/tmp/monitor-catch_monitor-20191113-221853-WI9PnBdR,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control \
    -device pvpanic,ioport=0x505,id=idUA0Y6Z \
    -chardev socket,server,nowait,id=chardev_serial0,path=/var/tmp/serial-serial0-20191113-221853-WI9PnBdR \
    -device isa-serial,id=serial0,chardev=chardev_serial0  \
    -chardev socket,id=seabioslog_id_20191113-221853-WI9PnBdR,path=/var/tmp/seabios-20191113-221853-WI9PnBdR,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20191113-221853-WI9PnBdR,iobase=0x402 \
    -device qemu-xhci,id=usb1,bus=pci.0,addr=0x3 \
    -blockdev driver=file,filename=/home/kvm_autotest_root/images/rhel810-64-virtio.qcow2,node-name=file_node \
    -blockdev driver=qcow2,file=file_node,node-name=drive_image1 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x4 \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device virtio-net-pci,mac=9a:9d:33:c3:3b:1a,id=idFXLnE7,netdev=idjZr0NP,bus=pci.0,addr=0x5  \
    -netdev tap,id=idjZr0NP,vhost=on \
    -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 \

  2. Create two snapshot nodes with blockdev-create with backing-file and backing-fmt set, but add the node with backing:null
     2.1 create sn1
        {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn1','size':21474836480},'job-id':'job1'}}
        {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn1','filename':'/root/sn1'}}
        {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn1','size':21474836480,'backing-file':'/home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2','backing-fmt':'qcow2'},'job-id':'job2'}}
        {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn1','file':'drive_sn1','backing':null}}
        {'execute':'job-dismiss','arguments':{'id':'job1'}}
        {'execute':'job-dismiss','arguments':{'id':'job2'}}

    2.2 create sn2 
      {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn2','size':21474836480},'job-id':'job1'}}
        {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn2','filename':'/root/sn2'}}
        {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn2','size':21474836480,'backing-file':'/root/sn1','backing-fmt':'qcow2'},'job-id':'job2'}}
        {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn2','file':'drive_sn2','backing':null}}
        {'execute':'job-dismiss','arguments':{'id':'job1'}}
        {'execute':'job-dismiss','arguments':{'id':'job2'}}
 

  3. Do snapshot on drive_image1, check block info
      {"execute":"blockdev-snapshot","arguments":{"node":"drive_image1","overlay":"sn1"}}
{"return": {}}
     (qemu)info block
     sn1: json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "/home/kvm_autotest_root/images/rhel810-64-virtio.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn1"}} (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2 (chain depth: 1)

  4. Do snapshot on sn1, then check block info:
     {"execute":"blockdev-snapshot","arguments":{"node":"sn1","overlay":"sn2"}}
{"return": {}}
     (qemu) info block
      sn2: json:{"backing": {"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "/home/kvm_autotest_root/images/rhel810-64-virtio.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn1"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn2"}} (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "/home/kvm_autotest_root/images/rhel810-64-virtio.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "/root/sn1"}} (chain depth: 2)

  5. Do live commit from sn2 to drive_image1
     {"execute":"blockdev-snapshot","arguments":{"node":"drive_image1","overlay":"sn1"}}
{"return": {}}
{"execute":"blockdev-snapshot","arguments":{"node":"sn1","overlay":"sn2"}}
{"return": {}}
{'execute': 'block-commit', 'arguments': { 'device': 'sn2','job-id':'j3'}}
{"timestamp": {"seconds": 1575006984, "microseconds": 643263}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "j3"}}
{"timestamp": {"seconds": 1575006984, "microseconds": 643321}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "j3"}}
{"return": {}}
{"timestamp": {"seconds": 1575006984, "microseconds": 705842}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "j3"}}
{"timestamp": {"seconds": 1575006984, "microseconds": 705884}, "event": "BLOCK_JOB_READY", "data": {"device": "j3", "len": 524288, "offset": 524288, "speed": 0, "type": "commit"}}

  6. After commit job reach ready status, complete the job.
    { "execute": "block-job-complete", "arguments": { "device": "j3"}}
{"return": {}}
{"timestamp": {"seconds": 1575006999, "microseconds": 685866}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "j3"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 685906}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "j3"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 686007}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "j3", "len": 720896, "offset": 720896, "speed": 0, "type": "commit"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 686044}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "j3"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 686073}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "j3"}}

  7. Check block info:
      (qemu) info block
drive_image1: /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2 (qcow2)
    Attached to:      image1
    Cache mode:       writeback

Expected Result:
According to bz#1763937 comment12 & comment13,
  In step3, output of "info block" should be:
     (qemu)info block
     sn1: /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2 (chain depth: 1)

  And also in step4, output of "info block" should be:
     (qemu) info block
      sn2: /root/sn1
    Attached to:      image1
    Cache mode:       writeback
    Backing file: /root/sn1 (chain depth: 2)



Hi, Kevin

  Please help to check..

Thanks,
Aliang

Comment 6 Kevin Wolf 2019-11-29 11:21:53 UTC
I think the reason is that you used two different filenames:

1. /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2 for the original image
2. /home/kvm_autotest_root/images/rhel811-64-virtio-scsi.qcow2 as the backing file path stored in the overlay image

So it will use json: syntax to describe that you want to use a different backing file than is stored in the qcow2 header of the overlay.

(Your expected output isn't completely correct either, the first line should contain the file name of the image itself, not of its backing file.)

Comment 8 aihua liang 2019-12-02 02:41:43 UTC
As comment6, re-test it on qemu-kvm-4.1.0-16.module+el8.1.1+4917+752cfd65.x86_64, the problem has been resolved, set bug's status to "Verified".

Test Steps:
  1. Start guest with qemu cmds:
      /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1' \
    -machine pc  \
    -nodefaults \
    -device VGA,bus=pci.0,addr=0x2 \
    -m 7168  \
    -smp 4,maxcpus=4,cores=2,threads=1,dies=1,sockets=2  \
    -cpu 'Skylake-Client',+kvm_pv_unhalt  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/var/tmp/monitor-qmpmonitor1-20191113-221853-WI9PnBdR,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/var/tmp/monitor-catch_monitor-20191113-221853-WI9PnBdR,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control \
    -device pvpanic,ioport=0x505,id=idUA0Y6Z \
    -chardev socket,server,nowait,id=chardev_serial0,path=/var/tmp/serial-serial0-20191113-221853-WI9PnBdR \
    -device isa-serial,id=serial0,chardev=chardev_serial0  \
    -chardev socket,id=seabioslog_id_20191113-221853-WI9PnBdR,path=/var/tmp/seabios-20191113-221853-WI9PnBdR,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20191113-221853-WI9PnBdR,iobase=0x402 \
    -device qemu-xhci,id=usb1,bus=pci.0,addr=0x3 \
    -blockdev driver=file,filename=/home/kvm_autotest_root/images/rhel810-64-virtio.qcow2,node-name=file_node \
    -blockdev driver=qcow2,file=file_node,node-name=drive_image1 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x4 \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device virtio-net-pci,mac=9a:9d:33:c3:3b:1a,id=idFXLnE7,netdev=idjZr0NP,bus=pci.0,addr=0x5  \
    -netdev tap,id=idjZr0NP,vhost=on \
    -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 \

  2. Create two snapshot nodes with blockdev-create with backing-file and backing-fmt set, but add the node with backing:null
     2.1 create sn1
        {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn1','size':21474836480},'job-id':'job1'}}
        {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn1','filename':'/root/sn1'}}
        {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn1','size':21474836480,'backing-file':'/home/kvm_autotest_root/images/rhel810-64-virtio.qcow2','backing-fmt':'qcow2'},'job-id':'job2'}}
        {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn1','file':'drive_sn1','backing':null}}
        {'execute':'job-dismiss','arguments':{'id':'job1'}}
        {'execute':'job-dismiss','arguments':{'id':'job2'}}

    2.2 create sn2 
      {'execute':'blockdev-create','arguments':{'options': {'driver':'file','filename':'/root/sn2','size':21474836480},'job-id':'job1'}}
        {'execute':'blockdev-add','arguments':{'driver':'file','node-name':'drive_sn2','filename':'/root/sn2'}}
        {'execute':'blockdev-create','arguments':{'options': {'driver': 'qcow2','file':'drive_sn2','size':21474836480,'backing-file':'/root/sn1','backing-fmt':'qcow2'},'job-id':'job2'}}
        {'execute':'blockdev-add','arguments':{'driver':'qcow2','node-name':'sn2','file':'drive_sn2','backing':null}}
        {'execute':'job-dismiss','arguments':{'id':'job1'}}
        {'execute':'job-dismiss','arguments':{'id':'job2'}}
 

  3. Do snapshot on drive_image1, check block info
      {"execute":"blockdev-snapshot","arguments":{"node":"drive_image1","overlay":"sn1"}}
{"return": {}}
    (qemu) info block
sn1: /root/sn1 (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2 (chain depth: 1)

  4. DD on sn1
     (guest)# dd if=/dev/urandom of=a bs=1M count=300
            #md5sum a > sum2

  5. Do snapshot on sn1, then check block info:
     {"execute":"blockdev-snapshot","arguments":{"node":"sn1","overlay":"sn2"}}
{"return": {}}
     (qemu) info block
     sn2: /root/sn2 (qcow2)
    Attached to:      image1
    Cache mode:       writeback
    Backing file:     /root/sn1 (chain depth: 2)

  6. DD on sn2.
     (guest)# dd if=/dev/urandom of=1 bs=1M count=100
            #md5sum b > sum3

  7. Do live commit from sn2 to drive_image1
     {"execute":"blockdev-snapshot","arguments":{"node":"drive_image1","overlay":"sn1"}}
{"return": {}}
{"execute":"blockdev-snapshot","arguments":{"node":"sn1","overlay":"sn2"}}
{"return": {}}
{'execute': 'block-commit', 'arguments': { 'device': 'sn2','job-id':'j3'}}
{"timestamp": {"seconds": 1575006984, "microseconds": 643263}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "j3"}}
{"timestamp": {"seconds": 1575006984, "microseconds": 643321}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "j3"}}
{"return": {}}
{"timestamp": {"seconds": 1575006984, "microseconds": 705842}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "j3"}}
{"timestamp": {"seconds": 1575006984, "microseconds": 705884}, "event": "BLOCK_JOB_READY", "data": {"device": "j3", "len": 524288, "offset": 524288, "speed": 0, "type": "commit"}}

  8. After commit job reach ready status, complete the job.
    { "execute": "block-job-complete", "arguments": { "device": "j3"}}
{"return": {}}
{"timestamp": {"seconds": 1575006999, "microseconds": 685866}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "j3"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 685906}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "j3"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 686007}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "j3", "len": 720896, "offset": 720896, "speed": 0, "type": "commit"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 686044}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "j3"}}
{"timestamp": {"seconds": 1575006999, "microseconds": 686073}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "j3"}}

  7. Check block info:
      (qemu) info block
drive_image1: /home/kvm_autotest_root/images/rhel810-64-virtio.qcow2 (qcow2)
    Attached to:      image1
    Cache mode:       writeback

  8. Reset vm, check files' md5sum value after guest reboot.
     (qemu)system_reset

Test Result:
  After step8, guest can boot up successfully and files' md5sum value keep the same with that in step4 and step6.

Comment 10 errata-xmlrpc 2020-02-04 18:29:59 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-2020:0404


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