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 1594266 - virt-xml-validate validate fails for volume having backing file
Summary: virt-xml-validate validate fails for volume having backing file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-22 13:23 UTC by yafu
Modified: 2019-08-06 13:14 UTC (History)
6 users (show)

Fixed In Version: libvirt-4.5.0-12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:13:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2294 0 None None None 2019-08-06 13:14:21 UTC

Description yafu 2018-06-22 13:23:02 UTC
Description of problem:
virt-xml-validate validate fails for volume having backing file

Version-Release number of selected component (if applicable):
libvirt-4.4.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.#qemu-img create -f qcow2 -o backing_file=/var/lib/libvirt/images/test1.img -F qcow2 /var/lib/libvirt/images/s1.img
Formatting '/var/lib/libvirt/images/s1.img', fmt=qcow2 size=9663676416 backing_file=/var/lib/libvirt/images/test1.img backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16

2.#virsh pool-refresh default

3.#virsh vol-dumpxml s1.img default> vol-s1.xml

4.#cat vol-s1.xml
<volume type='file'>
  <name>s1.img</name>
  <key>/var/lib/libvirt/images/s1.img</key>
  <source>
  </source>
  <capacity unit='bytes'>9663676416</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196752</physical>
  <target>
    <path>/var/lib/libvirt/images/s1.img</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0644</mode>
      <owner>0</owner>
      <group>0</group>
      <label>unconfined_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1529670693.131883698</atime>
      <mtime>1529670693.128883709</mtime>
      <ctime>1529670693.128883709</ctime>
    </timestamps>
    <compat>1.1</compat>
    <features/>
  </target>
  <backingStore>
    <path>/var/lib/libvirt/images/test1.img</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0777</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1529662109.606056087</atime>
      <mtime>1513831365.421893800</mtime>
      <ctime>1528767814.814001686</ctime>
    </timestamps>
  </backingStore>
</volume>

5.# virt-xml-validate vol-s1.xml
Relax-NG validity error : Extra element backingStore in interleave
vol-s1.xml:1: element volume: Relax-NG validity error : Element volume failed to validate content
vol-s1.xml fails to validate

Actual results:
virt-xml-validate validate fails for volume having backing file

Expected results:
virt-xml-validate works well for volume having backing file

Additional info:

Comment 2 Erik Skultety 2018-09-11 08:45:52 UTC
Fixed upstream by:
commit 0376939dd03f490ff54398d569ec17b0a1150b49
Refs: v4.7.0-81-g0376939dd0
Author:     Julio Faracco <jcfaracco>
AuthorDate: Mon Sep 10 23:57:13 2018 -0300
Commit:     Erik Skultety <eskultet>
CommitDate: Tue Sep 11 10:44:26 2018 +0200

    docs: schemas: Fix missing timestamp inside backingStore

    All backingStore XML definitions have a XML tag with the timestamp. This
    timestamp is not defined insinde RNG volume storage schema and it is
    causing some problems to validate and check volume XMLs.

    https://bugzilla.redhat.com/show_bug.cgi?id=1594266

    Signed-off-by: Julio Faracco <jcfaracco>
    Reviewed-by: Erik Skultety <eskultet>

Comment 6 Han Han 2019-04-23 03:58:20 UTC
Verified on libvirt-4.5.0-12.el7.x86_64:

1. Prepare this xml
# cat /tmp/schema.xml
<volume type='file'>
  <name>s1.img</name>
  <key>/var/lib/libvirt/images/s1.img</key>
  <source>
  </source>
  <capacity unit='bytes'>9663676416</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196752</physical>
  <target>
    <path>/var/lib/libvirt/images/s1.img</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0644</mode>
      <owner>0</owner>
      <group>0</group>
      <label>unconfined_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1529670693.131883698</atime>
      <mtime>1529670693.128883709</mtime>
      <ctime>1529670693.128883709</ctime>
    </timestamps>
    <compat>1.1</compat>
    <features/>
  </target>
  <backingStore>
    <path>/var/lib/libvirt/images/test1.img</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0777</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1529662109.606056087</atime>
      <mtime>1513831365.421893800</mtime>
      <ctime>1528767814.814001686</ctime>
    </timestamps>
  </backingStore>
</volume>

2. Validate the xml:
# virt-xml-validate /tmp/schema.xml
/tmp/schema.xml validates

Comment 8 errata-xmlrpc 2019-08-06 13:13:52 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, 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-2019:2294


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