mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
rng: Forbid to validate mismatched <disk> 'device' and 'type' attributes
According to docs, using 'lun' as a value for device attribute is only valid with disk types 'block' and 'network'. However current RNG schema also allows a combination type='file' device='lun' which results in a successfull xml validation, but fails at qemuBuildCommandLine. Besides fixing the RNG schema, this patch also adds a qemuxml2argvtest for this case. https://bugzilla.redhat.com/show_bug.cgi?id=1210669
This commit is contained in:
parent
e4725cdb12
commit
cea1b86fa7
@ -1180,12 +1180,14 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
<ref name="diskSource"/>
|
||||
<ref name="diskSpecsExtra"/>
|
||||
</interleave>
|
||||
</group>
|
||||
<group>
|
||||
<attribute name="device">
|
||||
<choice>
|
||||
<value>lun</value>
|
||||
</choice>
|
||||
<value>lun</value>
|
||||
</attribute>
|
||||
<optional>
|
||||
<ref name="rawIO"/>
|
||||
@ -1198,19 +1200,28 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
<choice>
|
||||
<ref name="diskSourceNetwork"/>
|
||||
<ref name="diskSourceBlock"/>
|
||||
</choice>
|
||||
<ref name="diskSpecsExtra"/>
|
||||
</interleave>
|
||||
</group>
|
||||
</choice>
|
||||
<optional>
|
||||
<ref name="snapshot"/>
|
||||
</optional>
|
||||
<interleave>
|
||||
<ref name="diskSource"/>
|
||||
<ref name="storageSourceExtra"/>
|
||||
<ref name="diskBackingChain"/>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="diskSpecsExtra">
|
||||
<interleave>
|
||||
<ref name="storageSourceExtra"/>
|
||||
<ref name="diskBackingChain"/>
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name="diskBackingChain">
|
||||
<choice>
|
||||
<ref name="diskBackingStore"/>
|
||||
|
@ -0,0 +1,28 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219100</memory>
|
||||
<currentMemory unit='KiB'>219100</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='file' device='lun' rawio='yes'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='ide' index='0'/>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>
|
@ -817,6 +817,8 @@ mymain(void)
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
|
||||
DO_TEST("disk-drive-no-boot",
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_BOOTINDEX);
|
||||
DO_TEST_FAILURE("disk-device-lun-type-invalid",
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_SCSI);
|
||||
DO_TEST("disk-usb", NONE);
|
||||
DO_TEST("disk-usb-device",
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_USB_STORAGE,
|
||||
|
Loading…
Reference in New Issue
Block a user