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@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2021-05-21 14:53:43 +02:00
parent 4b3dc045b9
commit fac773fab9
4 changed files with 4 additions and 4 deletions

View File

@ -1638,7 +1638,7 @@
<define name="diskSourceSlice">
<attribute name="offset">
<ref name="positiveInteger"/>
<ref name="unsignedInt"/>
</attribute>
<attribute name="size">
<ref name="positiveInteger"/>

View File

@ -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"}' \

View File

@ -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/>

View File

@ -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/>