From cea1b86fa7f140a30220bb2efaece1d2890f2d91 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Fri, 17 Apr 2015 13:14:12 +0200 Subject: [PATCH] rng: Forbid to validate mismatched '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 --- docs/schemas/domaincommon.rng | 27 ++++++++++++------ ...uxml2argv-disk-device-lun-type-invalid.xml | 28 +++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 3 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e35323f3ca..9cc5e769aa 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1180,12 +1180,14 @@ + + + + - - lun - + lun @@ -1198,19 +1200,28 @@ + + + + + + + - - - - - + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml new file mode 100644 index 0000000000..ed3c89e23e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-device-lun-type-invalid.xml @@ -0,0 +1,28 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8d0a4aa319..63bf6ff710 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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, -- GitLab