RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2121276 - Fail to validate the snapshot XML with inactiveDomain
Summary: Fail to validate the snapshot XML with inactiveDomain
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-25 03:18 UTC by Han Han
Modified: 2023-05-09 08:08 UTC (History)
6 users (show)

Fixed In Version: libvirt-8.8.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:27:05 UTC
Type: Bug
Target Upstream Version: 8.8.0
Embargoed:


Attachments (Terms of Use)
The snapshot XML (8.74 KB, text/plain)
2022-08-25 03:18 UTC, Han Han
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-132275 0 None None None 2022-08-25 03:22:12 UTC
Red Hat Product Errata RHBA-2023:2171 0 None None None 2023-05-09 07:27:29 UTC

Description Han Han 2022-08-25 03:18:30 UTC
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>

Comment 1 Peter Krempa 2022-09-01 11:24:10 UTC
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

Comment 2 yisun 2022-09-27 09:28:56 UTC
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

Comment 3 yisun 2022-10-13 09:13:37 UTC
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.

Comment 7 yisun 2022-11-10 04:27:12 UTC
verified as comment3

Comment 9 errata-xmlrpc 2023-05-09 07:27:05 UTC
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


Note You need to log in before you can comment on or make changes to this bug.