Bug 2174397
| Summary: | [snapshot] failed to validate snapshot xml with "<snapshotDeleteInProgress/>" | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | yisun |
| Component: | libvirt | Assignee: | Pavel Hrdina <phrdina> |
| libvirt sub component: | General | QA Contact: | yisun |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | low | ||
| Priority: | low | CC: | jdenemar, lmen, pkrempa, virt-maint, ymankad |
| Version: | 9.2 | Keywords: | Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-9.2.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-11-07 08:30:47 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: | 9.2.0 |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1519002 | ||
In cases when the user want's to redefine such a snapshot we need to allow it wven with validation. Upstream commit:
commit 61d51c9c418dd3c77794519a5f66a02118b11326
Author: Pavel Hrdina <phrdina>
Date: Wed Mar 8 13:02:37 2023 +0100
domainsnapshot: add snapshotDeleteInProgress to RNG schema
preverified with libvirt-9.2.0-1.el9.x86_64:
1. check rng file
# cat /usr/share/libvirt/schemas/domainsnapshot.rng
...
<define name="snapshotDeleteInProgress">
<optional>
<element name="snapshotDeleteInProgress">
<empty/>
</element>
</optional>
</define>
…
<ref name="storageSourceExtra"/>
<ref name="snapshotDeleteInProgress"/>
…
<ref name="storageSourceExtra"/>
<ref name="snapshotDeleteInProgress"/>
</interleave>
2. use same steps as comment0, from step 6 it works as follow:
[root@lenovo-sr630-14 ~]# virsh snapshot-delete vm1 s2
error: Failed to delete snapshot s2
error: operation failed: domain is no longer running
[root@lenovo-sr630-14 ~]# virsh snapshot-dumpxml vm1 s1 | grep InProgress -a10
<domainsnapshot>
<name>s1</name>
<state>disk-snapshot</state>
<creationTime>1681133878</creationTime>
<memory snapshot='no'/>
<disks>
<disk name='vda' snapshot='external' type='file'>
<snapshotDeleteInProgress/>
<driver type='qcow2'/>
<source file='/var/lib/libvirt/images/jeos-27-x86_64.s1'/>
</disk>
</disks>
<domain type='kvm'>
<name>vm1</name>
<uuid>6b71c477-6392-4305-be34-11a4672aab73</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://redhat.com/rhel/9.2"/>
[root@lenovo-sr630-14 ~]# virsh snapshot-dumpxml vm1 s1 --security-info|virt-xml-validate -
- validates
<=== it's correct now
test with libvirt-9.3.0-2.el9.x86_64 and result is PASS 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 (Moderate: 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-2023:6409 |
Description of problem: failed to validate snapshot xml with "<snapshotDeleteInProgress/>" Version-Release number of selected component (if applicable): libvirt-libs-9.0.0-7.el9.x86_64 libvirt-9.0.0-7.el9.x86_64 How reproducible: 100% Steps to Reproduce: with commit 565bcb5d79, there is a new element <snapshotDeleteInProgress/> introduced to snapshot xml, which indicate the parent snapshot is invalid when a snapshot-delete failed. But this element is not defined in domainsnapshot.rng 1. have a running vm = vm1 2. create first diskonly snapshot for vm # virsh snapshot-create-as vm1 s1 --disk-only 3. create second diskonly snapshot for vm # virsh snapshot-create-as vm1 s1 --disk-only 4. generate some data in vm's vda in_vm# dd if=/dev/urandom of=/tmp/test.data bs=1M count=5000; sync 5. create third diskonly snapshot for vm # virsh snapshot-create-as vm1 s3 --disk-only 6. delete snapshot=s2, and during the same time, in anthoer terminal, turnoff the vm T1 # virsh snapshot-delete vm1 s2 T2 # virsh destroy vm1 T1 will get snapshot-delete error 7. check the snapshot xml of s1, it will have tag <snapshotDeleteInProgress/> # virsh snapshot-dumpxml vm1 s1 | grep InProgress -a10 ... <disks> <disk name='vda' snapshot='external' type='file'> <snapshotDeleteInProgress/> <driver type='qcow2'/> <source file='/var/lib/libvirt/images/vm1.s1'/> </disk> ... 8. try to validate the xml, it'll be failed # virsh snapshot-dumpxml vm1 s1 --security-info|virt-xml-validate - Relax-NG validity error : Extra element disks in interleave -:6: element disks: Relax-NG validity error : Element domainsnapshot failed to validate content - fails to validate Actual results: virt-xml-validate failed when snapshot xml has <snapshotDeleteInProgress/> Expected results: virt-xml-validate passed