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 1960993 - disk with storage slice with 0 offset doesn't conform to XML schema
Summary: disk with storage slice with 0 offset doesn't conform to XML schema
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: beta
: ---
Assignee: Peter Krempa
QA Contact: zhentang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-17 01:33 UTC by zhentang
Modified: 2021-12-07 22:01 UTC (History)
6 users (show)

Fixed In Version: libvirt-7.4.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-12-07 21:57:54 UTC
Type: Bug
Target Upstream Version: 7.4.0
Embargoed:


Attachments (Terms of Use)

Description zhentang 2021-05-17 01:33:56 UTC
Description of problem:


Version-Release number of selected component (if applicable):
libvirt 7.0.0

How reproducible:
100%

Steps to Reproduce:
1.prepare guest xml with
...
<disk type="file" device="disk">
  <driver name="qemu" type="raw" copy_on_read="off" cache="none" discard="ignore" detect_zeroes="on" io="native"/>
  <source file="/tmp/disk-raw">
    <slices>
      <slice type="storage" offset="0" size="104857600"/>
    </slices>
  </source>
  <backingStore/>
  <target dev="sdb" bus="scsi"/>
  <alias name="ua-slices"/>
  <iotune>
    <total_bytes_sec>10000000</total_bytes_sec>
    <group_name>slice</group_name>
  </iotune>
</disk>
...
2. virt-xml-validate tztest.xml
Relax-NG validity error : Extra element devices in interleave
tztest.xml:57: element devices: Relax-NG validity error : Element domain failed to validate content
tztest.xml fails to validate

3. remove slices part and then pass the validate



Actual results:
failed to validate with slices

Expected results:
should successfully pass the validate with slices

Additional info:

Comment 1 Peter Krempa 2021-05-17 07:19:57 UTC
The actual XML problem is that 'offset' is 0:

 error: value of attribute "offset" is invalid; must be an integer greater than or equal to 1

I need to check whether the rest of the code properly supports offset 0 though before fixing the schema.

Comment 2 Peter Krempa 2021-06-01 08:05:03 UTC
Fixed upstream:

commit fac773fab93dc526513d7ced40e1d685e193705c
Author: Peter Krempa <pkrempa>
Date:   Fri May 21 14:53:43 2021 +0200

    schema: Allow '0' offset for a <slice> of <disk>
    
    Using slice to cut off the end of the image is a perfectly vaid
    configuration. Use 'unsignedInt' instead of 'positiveInteger' for the
    'offset' attribute in the XML schema and modify one test case to cover
    this use case.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1960993
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Pavel Hrdina <phrdina>

v7.3.0-264-gfac773fab9

Comment 6 zhentang 2021-06-23 03:34:49 UTC
libvirtd 7.4.0-1.el9
qemu-kvm 6.0.0-2.el9
=========================================
verified

bug-check.xml
...
<disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' copy_on_read='off' discard='ignore' detect_zeroes='on'/>
      <source file='/tmp/disk-raw'>
        <slices>
          <slice type='storage' offset='0' size='104857600'/>
        </slices>
      </source>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <iotune>
        <total_bytes_sec>10000000</total_bytes_sec>
        <group_name>slice</group_name>
      </iotune>
      <alias name='ua-slices'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
...

#virt-xml-validate ~/bug_check.xml
/root/bug_check.xml validates
# virsh define ~/bug_check.xml
Domain 'tztest_ins_me' defined from /root/bug_check.xml


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