[PATCH] schema: Allow '0' offset for a <slice> of <disk>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 docs/schemas/domaincommon.rng                          | 2 +-
 tests/qemuxml2argvdata/disk-slices.x86_64-latest.args  | 2 +-
 tests/qemuxml2argvdata/disk-slices.xml                 | 2 +-
 tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index a2e5c50c1d..475f7f1a42 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1638,7 +1638,7 @@

   <define name="diskSourceSlice">
     <attribute name="offset">
-      <ref name="positiveInteger"/>
+      <ref name="unsignedInt"/>
     </attribute>
     <attribute name="size">
       <ref name="positiveInteger"/>
diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
index d337ea91a7..f41bbeea09 100644
--- a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
@@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img","node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","offset":1234,"size":321,"file":"libvirt-6-storage"}' \
+-blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","offset":0,"size":321,"file":"libvirt-6-storage"}' \
 -device virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-6-format,id=virtio-disk0,bootindex=1 \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"driver":"raw","node-name":"libvirt-5-slice-sto","offset":9876,"size":123456789,"file":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \
diff --git a/tests/qemuxml2argvdata/disk-slices.xml b/tests/qemuxml2argvdata/disk-slices.xml
index 1675766a46..016aa1b905 100644
--- a/tests/qemuxml2argvdata/disk-slices.xml
+++ b/tests/qemuxml2argvdata/disk-slices.xml
@@ -18,7 +18,7 @@
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/raw.img'>
         <slices>
-          <slice type='storage' offset='1234' size='321'/>
+          <slice type='storage' offset='0' size='321'/>
         </slices>
       </source>
       <backingStore/>
diff --git a/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
index 5c200ad31c..be5cd25084 100644
--- a/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
@@ -21,7 +21,7 @@
       <driver name='qemu' type='raw'/>
       <source file='/var/lib/libvirt/images/raw.img'>
         <slices>
-          <slice type='storage' offset='1234' size='321'/>
+          <slice type='storage' offset='0' size='321'/>
         </slices>
       </source>
       <backingStore/>
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux