Bug 1773925
| Summary: | Fail to do blockcommit with more than one snapshots | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Peter Krempa <pkrempa> |
| Component: | qemu-kvm | Assignee: | Kevin Wolf <kwolf> |
| Status: | CLOSED ERRATA | QA Contact: | aihua liang <aliang> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | high | ||
| Version: | 8.1 | CC: | aliang, coli, dyuan, hhan, juzhang, kwolf, libvirt-maint, lmen, tburke, virt-maint, xuzhang, yisun |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| 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: | Story Points: | --- | |
| Clone Of: | 1763937 | Environment: | |
| Last Closed: | 2020-02-04 18:29:59 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: | 1763937 | ||
| Bug Blocks: | |||
|
Description
Peter Krempa
2019-11-19 10:48:45 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. 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
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.) 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. 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 |