Bug 2078274
| Summary: | Blockcopy failed with catchXMLError | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Meina Li <meili> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| libvirt sub component: | Storage | QA Contact: | Meina Li <meili> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | jdenemar, lmen, nanli, pkrempa, virt-maint, xuzhang |
| Version: | 9.1 | Keywords: | Automation, Triaged |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-8.3.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-11-15 10:04:06 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: | 8.3.0 |
| Embargoed: | |||
Fixed upstream:
commit 9223ebbc85b024c114aab53a5fffc535e30b3082
Author: Peter Krempa <pkrempa>
Date: Mon Apr 25 10:16:13 2022 +0200
virsh: cmdBlockcopy: Fix generator of block copy disk XML
In a recent commit I've attempted to rewrite the XML generator to use
virXMLFormatElement instead of manual steps. Unfortunately the commit
had multiple problems resulting in a garbled XML:
1) in certain cases the wrong buffer was used resulting in misplaced
snippets
2) the child element buffer was improperly set up so sub-elements were
not indented
This resulted in following XML being generated:
$ virsh blockcopy cd vda /tmp/test.copy --raw --print-xml
type='file''/tmp/test.copy'/>
<driver type='raw'/>
<disk>
<source file=</disk>
To fix this we'll generate the '<source>' element in one go and use the
proper buffer for it and other places.
Fixes: 1cd95f858ab83f2baab0e35070d00766bb06ce3a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2078274
Signed-off-by: Peter Krempa <pkrempa>
Reviewed-by: Michal Privoznik <mprivozn>
v8.2.0-237-g9223ebbc85
Pre-verified Version:
libvirt-8.3.0-1.el9.x86_64
qemu-kvm-7.0.0-2.el9.x86_64
Pre-verified Steps:
1. Prepare a running guest.
# virsh domstate lmn
running
2. Do blockcopy for the disk.
# virsh blockcopy lmn vda /tmp/test.copy --wait --verbose --transient-job
Block Copy: [100 %]
Now in mirroring phase
# virsh blockjob lmn vda --pivot
3. Check the dumpxml.
# virsh dumpxml lmn | xmllint --xpath //disk -
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/tmp/test.copy" index="2"/>
<backingStore/>
<target dev="vda" bus="virtio"/>
<alias name="virtio-disk0"/>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>
Verified Version:
libvirt-8.3.0-1.el9.x86_64
qemu-kvm-7.0.0-4.el9.x86_64
Verified Steps:
S1: Do blockcopy to file disk.
1. Prepare a guest with snapshot.
# virsh domstate avocado-vt-vm1
running
# virsh snapshot-create-as avocado-vt-vm1 s1 --disk-only
Domain snapshot s1 created
2. Do blockcopy for the disk.
# virsh blockcopy avocado-vt-vm1 vda /tmp/test.copy --wait --verbose --transient-job
Block Copy: [100 %]
Now in mirroring phase
3. Pivot the job and check the dumpxml.
# virsh blockjob avocado-vt-vm1 vda --pivot
# virsh dumpxml avocado-vt-vm1 | xmllint --xpath //disk -
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/tmp/test.copy" index="3"/>
<backingStore/>
<target dev="vda" bus="virtio"/>
<alias name="virtio-disk0"/>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>
S2. Do blockcopy to block disk.
1. Prepare a guest with snapshot.
# virsh domstate avocado-vt-vm1
running
# virsh snapshot-create-as avocado-vt-vm1 s1 --disk-only
Domain snapshot s1 created
2. Do blockcopy for the disk.
# virsh blockcopy avocado-vt-vm1 vda /dev/sdb --wait --verbose --transient-job --blockdev
Block Copy: [100 %]
Now in mirroring phase
3. Pivot the job and check the dumpxml.
# virsh blockjob avocado-vt-vm1 vda --pivot
# virsh dumpxml avocado-vt-vm1 | xmllint --xpath //disk -
<disk type="block" device="disk">
<driver name="qemu" type="qcow2"/>
<source dev="/dev/sdb" index="3"/>
<backingStore/>
<target dev="vda" bus="virtio"/>
<alias name="virtio-disk0"/>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>
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 (Low: libvirt security, bug fix, and enhancement update), 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/RHSA-2022:8003 |
Description of problem: Blockcopy failed with catchXMLError Version-Release number of selected component (if applicable): libvirt-8.2.0-1.el9.x86_64 qemu-kvm-7.0.0-1.el9.x86_64 How reproducible: 100% Steps to Reproduce: 1. Prepare a running guest. # virsh domstate avocado-vt-vm1 running 2. Do blockcopy for the disk. # virsh blockcopy avocado-vt-vm1 vda /tmp/test.copy --wait --verbose --transient-job error: (disk_definition):1: Start tag expected, '<' not found type='file''/tmp/test.copy'/> -^ Actual results: Blockcopy failed Expected results: Can blockcopy successfully Additional info: 1. Can blockcopy with --xml option successfully. 2. Check the libvirtd log: ... 2022-04-24 09:40:27.391+0000: 113418: debug : virThreadJobSet:93 : Thread 113418 (rpc-virtqemud) is now running job remoteDispatchDomainBlockCopy 2022-04-24 09:40:27.391+0000: 113418: debug : virDomainBlockCopy:10613 : dom=0x7fbaa0006950, (VM: name=avocado-vt-vm1, uuid=bf74e948-5579-4f86-895d-168d56193853), disk=vda, destxml= type='file''/tmp/test.copy'/> <disk> <source file=</disk> , params=(nil), nparams=0, flags=0x4 2022-04-24 09:40:27.391+0000: 113418: error : catchXMLError:990 : (disk_definition):1: Start tag expected, '<' not found type='file''/tmp/test.copy'/> -^ 2022-04-24 09:40:27.391+0000: 113418: debug : virThreadJobClear:118 : Thread 113418 (rpc-virtqemud) finished job remoteDispatchDomainBlockCopy with ret=-1 3. May related with: commit 1cd95f858a Author: Peter Krempa <pkrempa> Date: Mon Feb 28 14:48:37 2022 +0100 virsh: cmdBlockcopy: Use virXMLFormatElement Rewrite the formatting of the block copy target xml using virXMLFormatElement.