Bug 1774375
| Summary: | Fail to create external snapshot after pivot blockcommit with -blockdev enabled | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Han Han <hhan> | ||||||||
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> | ||||||||
| Status: | CLOSED ERRATA | QA Contact: | Meina Li <meili> | ||||||||
| Severity: | unspecified | Docs Contact: | |||||||||
| Priority: | unspecified | ||||||||||
| Version: | 8.2 | CC: | aliang, coli, jdenemar, kwolf, lmen, rbalakri | ||||||||
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
||||||||
| Target Release: | 8.2 | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Whiteboard: | |||||||||||
| Fixed In Version: | libvirt-5.10.0-1.el8 | Doc Type: | If docs needed, set a value | ||||||||
| Doc Text: | Story Points: | --- | |||||||||
| Clone Of: | |||||||||||
| : | 1792195 (view as bug list) | Environment: | |||||||||
| Last Closed: | 2020-05-05 09:50:55 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: | |||||||||||
| Bug Blocks: | 1792195 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Han Han
2019-11-20 08:00:09 UTC
Could you please check, whether the active XML contains <readonly/> on the disk of the VM? If so it's probably a bug which was fixed by
commit b036834eaea6eeb514896310edd418686b82f64b
Author: Peter Krempa <pkrempa>
Date: Fri Nov 8 16:38:08 2019 +0100
qemu: blockjob: Transfer 'readonly' state of images after active layer block commit
When commiting a different image becomes the disk source. Since we store
the readonly flag per-image we must update it to the same state the
original image had.
https://libvirt.org/git/?p=libvirt.git;a=commit;h=b036834eaea6eeb514896310edd418686b82f64b
(In reply to Peter Krempa from comment #1) > Could you please check, whether the active XML contains <readonly/> on the > disk of the VM? If so it's probably a bug which was fixed by > > commit b036834eaea6eeb514896310edd418686b82f64b > Author: Peter Krempa <pkrempa> > Date: Fri Nov 8 16:38:08 2019 +0100 > > qemu: blockjob: Transfer 'readonly' state of images after active layer > block commit > > When commiting a different image becomes the disk source. Since we store > the readonly flag per-image we must update it to the same state the > original image had. > > https://libvirt.org/git/?p=libvirt.git;a=commit; > h=b036834eaea6eeb514896310edd418686b82f64b Active xml: <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/copy.qcow2' index='1'/> <backingStore/> <target dev='sda' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <readonly/> there 😃 Thank you for the confirmation! Changing product according to the libvirt and QEMU versions in the bug description. test failed on libvirt-6.0.0-1.module+el8.2.0+5453+31b2b136.x86_64 qemu-kvm-4.2.0-6.module+el8.2.0+5453+31b2b136.x86_64: Prepare an active vm: # virsh snapshot-create-as pc s1 --no-metadata --disk-only Domain snapshot s1 created # virsh blockcommit pc vda --active --wait --verbose error: internal error: unable to execute QEMU command 'block-commit': Need a root block node # virsh blockcommit pc vda --active --wait --verbose error: internal error: child reported (status=125): Requested operation is not valid: Setting different SELinux label on /var/lib/libvirt/images/RHEL-8.2-x86_64-latest.qcow2 which is already in use # virsh blockcommit pc vda --active --wait --verbose error: internal error: child reported (status=125): Requested operation is not valid: Setting different SELinux label on /var/lib/libvirt/images/RHEL-8.2-x86_64-latest.qcow2 which is already in use Created attachment 1652958 [details] domain xml and libvirtd log of comment6 The root cause of the problem in comment#6 is completely different from this bug. I filed https://bugzilla.redhat.com/show_bug.cgi?id=1792195 for that. Moving back to ON_QA. Please re-test this issue without 'copy_on_read' enabled on the disk. Created attachment 1652987 [details] domain xml, libvirtd log, disk.xml Blockcopy to nbd disk also shows the same error: version: the same as comment6 steps: 1. Create a full allocated qcow2 # qemu-img create /var/lib/libvirt/images/nbd.qcow2 10G -f qcow2 -o preallocation=full 2. Create nbd server # qemu-nbd -f raw /var/lib/libvirt/images/nbd.qcow2 -x test -t -e 10 -v 3. Start vm and do blockcopy # virsh list Id Name State ---------------------- 3 pc running # virsh dumpxml pc|xmllint --xpath '//disk' - <disk type="file" device="disk"> <driver name="qemu" type="qcow2" copy_on_read="on"/> <source file="/var/lib/libvirt/images/RHEL-8.2-x86_64-latest.qcow2" index="1"/> <backingStore/> <target dev="vda" bus="virtio"/> <alias name="virtio-disk0"/> <address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/> </disk># # cat nbd.xml <disk type='network'> <driver name="qemu" type="qcow2"/> <source protocol="nbd" name="test"> <host name="localhost"/> </source> <target dev="vda" bus="virtio"/> </disk> # virsh blockcopy pc vda --xml nbd.xml --transient-job --wait --verbose error: internal error: unable to execute QEMU command 'blockdev-mirror': Need a root block node However the connection is continued: # netstat -antp|grep 10809 tcp 0 0 0.0.0.0:10809 0.0.0.0:* LISTEN 26114/qemu-nbd tcp 0 0 127.0.0.1:40810 127.0.0.1:10809 ESTABLISHED 26950/qemu-kvm tcp 0 0 127.0.0.1:10809 127.0.0.1:40810 ESTABLISHED 26114/qemu-nbd That is also instance of https://bugzilla.redhat.com/show_bug.cgi?id=1792195 . The problem is with the copy_on_read part. Works on libvirt-6.0.0-1.module+el8.2.0+5453+31b2b136.x86_64 qemu-kvm-4.2.0-6.module+el8.2.0+5453+31b2b136.x86_64:
1. Start an VM
VM disk xml:
# virsh dumpxml pc|xmllint --xpath //disk -
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source protocol="nbd" name="test" tls="no">
<host name="localhost" port="10809"/>
</source>
<target dev="vda" bus="virtio"/>
<alias name="virtio-disk0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/>
</disk>
2. Create a snapshot
# virsh snapshot-create-as pc s1 --diskspec vda,file=/tmp/pc.s1 --no-metadata --disk-only
Domain snapshot s1 created
3. Do blockcommit:
# virsh blockcommit pc vda --active --wait --verbose --pivot
Block commit: [100 %]
Successfully pivoted
Worked well on version:
libvirt-6.0.0-10.el8.x86_64
Test Steps:
SC1: Create external snapshot for the guest with the simple file disk.
1. Start a guest.
# virsh dumpxml lmn | grep /disk -B7
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/lmn.qcow2' index='1'/>
<backingStore/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
2. Create an external snapshot, do blockcommit with --pivot.
# virsh snapshot-create-as lmn s1 --disk-only --no-metadata
Domain snapshot s1 created
# virsh blockcommit lmn vda --active --wait --verbose --pivot
Block commit: [100 %]
Successfully pivoted
3. Create another external snapshot again.
# virsh snapshot-create-as lmn s2 --disk-only --no-metadata
Domain snapshot s2 created
SC2: Create external snapshot for the guest with nbd network disk.
1. Create a full allocated qcow2 and nbd server in another terminal.
# qemu-img create /var/lib/libvirt/images/nbd.qcow2 2G -f qcow2 -o preallocation=full
Formatting '/var/lib/libvirt/images/nbd.qcow2', fmt=qcow2 size=2147483648 cluster_size=65536 preallocation=full lazy_refcounts=off refcount_bits=16
# qemu-nbd -f raw /var/lib/libvirt/images/nbd.qcow2 -x test -t -e 10 -v
2. Start the guest with nbd network disk.
# virsh dumpxml lmn | grep /disk -B8
<disk type='network' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source protocol='nbd' name='test' tls='no' index='1'>
<host name='localhost' port='10809'/>
</source>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
3. Create an external snapshot, do blockcommit with --pivot.
virsh snapshot-create-as lmn s1 --diskspec vda,file=/tmp/lmn.s1 --disk-only --no-metadata
Domain snapshot s1 created
# virsh blockcommit lmn vda --active --wait --verbose --pivot
Block commit: [100 %]
Successfully pivoted
4. Create another external snapshot again.
# virsh snapshot-create-as lmn s2 --diskspec vda,file=/tmp/lmn.s2 --disk-only --no-metadata
Domain snapshot s2 created
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:2017 |