Bug 2121276
| Summary: | Fail to validate the snapshot XML with inactiveDomain | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Han Han <hhan> | ||||
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> | ||||
| libvirt sub component: | General | QA Contact: | yisun | ||||
| Status: | CLOSED ERRATA | Docs Contact: | |||||
| Severity: | unspecified | ||||||
| Priority: | unspecified | CC: | jdenemar, lmen, pkrempa, virt-maint, xuzhang, yalzhang | ||||
| Version: | 9.1 | Keywords: | Triaged | ||||
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | libvirt-8.8.0-1.el9 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2023-05-09 07:27:05 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.8.0 | ||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Fixed upstream:
commit f46088e22eac4737e59366d0b3f75b3e057decfc
Author: Peter Krempa <pkrempa>
Date: Thu Aug 25 11:29:30 2022 +0200
schema: Add schema for '<inactiveDomain>' element used in the snapshot definition
The '<inactiveDomain>' element stores the next-start definition of a VM
on snapshot. It was not covered by the schema when it was introduced.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121276
Fixes: 152c165d34cb6dcd21d08427422850f406cd0643
Signed-off-by: Peter Krempa <pkrempa>
Reviewed-by: Ján Tomko <jtomko>
v8.7.0-18-gf46088e22e
Preverified with upstream build:
libvirt-libs-8.8.0-1.fc35.x86_64
libvirt-8.8.0-1.fc35.x86_64
Result is PASS
[root@yisun-001 schemas]# cat domaincommon.rng | grep -i inactivedomain -a5
...
<!-- this element is used as a child of a snapshot definition -->
<define name="inactiveDomain">
<element name="inactiveDomain">
<ref name="domaincontents"/>
</element>
</define>
[root@yisun-001 schemas]# cat domainsnapshot.rng | grep -i inactivedomain -a5
...
<optional>
<grammar>
<include href="inactiveDomain.rng"/>
</grammar>
</optional>
<optional>
<element name="parent">
<element name="name">
[root@yisun-001 schemas]# cat inactiveDomain.rng | grep -i inactivedomain -a5
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- inactiveDomain element grammar is included into domainsnapshot.rng -->
<start>
<ref name="inactiveDomain"/>
</start>
[root@yisun-001 schemas]# virsh snapshot-create-as rhel snap1
Domain snapshot snap1 created
[root@yisun-001 schemas]# virsh snapshot-dumpxml rhel snap1 --security-info | grep -i inactivedomain
<inactiveDomain type='kvm'>
</inactiveDomain>
[root@yisun-001 schemas]# virsh snapshot-dumpxml rhel snap1 --security-info | virt-xml-validate -
- validates
tested with libvirt-8.8.0-1.el9.x86_64 and result is PASS. This is a RNG file modification so we don't need to add a specific testcase in polarion for future test. 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 (libvirt 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/RHBA-2023:2171 |
Created attachment 1907473 [details] The snapshot XML Description of problem: As subject Version-Release number of selected component (if applicable): libvirt-8.5.0-5.el9.x86_64 How reproducible: 100% Steps to Reproduce: 1. Create a snapshot for a running VM: ➜ ~ virsh list Id Name State ------------------------ 1 cephfs running ➜ ~ virsh snapshot-create cephfs Domain snapshot 1661397281 created 2. Validate the snapshot XML: ➜ ~ virsh snapshot-dumpxml cephfs 1661397281 --security-info|virt-xml-validate - -:124: element inactiveDomain: Relax-NG validity error : Element domainsnapshot has extra content: inactiveDomain - fails to validate Actual results: As above Expected results: No error for validating Additional info: See the snapshot XML in the attachment. The inactiveDomain is from this commit: commit 152c165d34 Author: Maxiwell S. Garcia <maxiwell.com> Date: Thu Aug 29 17:55:43 2019 -0300 snapshot: Store both config and live XML in the snapshot domain The snapshot-create operation of running guests saves the live XML and uses it to replace the active and inactive domain in case of revert. So, the config XML is ignored by the snapshot process. This commit changes it and adds the config XML in the snapshot XML as the <inactiveDomain> entry. In case of offline guest, the behavior remains the same and the config XML is saved in the snapshot XML as <domain> entry. The behavior of older snapshots of running guests, that don't have the new <inactiveDomain>, remains the same too. The revert, in this case, overrides both active and inactive domain with the <domain> entry. So, the <inactiveDomain> in the snapshot XML is not required to snapshot work, but it's useful to preserve the config XML of running guests. Signed-off-by: Maxiwell S. Garcia <maxiwell.com> Reviewed-by: Daniel Henrique Barboza <danielhb413> Tested-by: Daniel Henrique Barboza <danielhb413> Reviewed-by: Jiri Denemark <jdenemar>