Add full and empty cdroms on 'usb', 'virtio', and 'sd' bus to have
test
coverage. Note that this does not guarantee that qemu will accept them.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../disk-cdrom-bus-other.x86_64-latest.args | 45 +++++++++++++
.../qemuxml2argvdata/disk-cdrom-bus-other.xml | 58 +++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../disk-cdrom-bus-other.xml | 64 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
5 files changed, 169 insertions(+)
create mode 100644 tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
new file mode 100644
index 0000000000..9dd45133fc
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.x86_64-latest.args
@@ -0,0 +1,45 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-drive file=/root/boot.iso,format=raw,if=none,id=drive-usb-disk0,media=cdrom,\
+readonly=on \
+-device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0,\
+removable=off \
+-drive if=none,id=drive-usb-disk1,media=cdrom,readonly=on \
+-device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1,\
+removable=off \
+-drive file=/root/boot1.iso,format=raw,if=none,id=drive-virtio-disk0,\
+media=cdrom,readonly=on,cache=none \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
+id=virtio-disk0,write-cache=on \
+-drive if=none,id=drive-virtio-disk1,media=cdrom,readonly=on \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
+id=virtio-disk1,write-cache=on \
+-drive file=/root/boot2.iso,format=raw,if=sd,index=2,media=cdrom,readonly=on \
+-drive if=sd,index=3,media=cdrom,readonly=on \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
new file mode 100644
index 0000000000..2ed86b0900
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-cdrom-bus-other.xml
@@ -0,0 +1,58 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <description>This test is meant for testing CDROMS with buses which don't
really support them</description>
+ <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-system-i686</emulator>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/root/boot.iso'/>
+ <target dev='sda' bus='usb'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <target dev='sdb' bus='usb'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/root/boot1.iso'/>
+ <target dev='vda' bus='virtio'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <target dev='vdb' bus='virtio'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/root/boot2.iso'/>
+ <target dev='sdc' bus='sd'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <target dev='sdd' bus='sd'/>
+ <readonly/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b42dd0b28e..dd4f73a5fb 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1011,6 +1011,7 @@ mymain(void)
DO_TEST("disk-cdrom", NONE);
DO_TEST_CAPS_VER("disk-cdrom", "2.12.0");
DO_TEST_CAPS_LATEST("disk-cdrom");
+ DO_TEST_CAPS_LATEST("disk-cdrom-bus-other");
DO_TEST("disk-iscsi", NONE);
DO_TEST("disk-cdrom-network", QEMU_CAPS_KVM);
DO_TEST_CAPS_VER("disk-cdrom-network", "2.12.0");
diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
new file mode 100644
index 0000000000..a9f2806777
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-cdrom-bus-other.xml
@@ -0,0 +1,64 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <description>This test is meant for testing CDROMS with buses which
don't really support them</description>
+ <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-system-i686</emulator>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/root/boot.iso'/>
+ <target dev='sda' bus='usb'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <target dev='sdb' bus='usb'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/root/boot1.iso'/>
+ <target dev='vda' bus='virtio'/>
+ <readonly/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <target dev='vdb' bus='virtio'/>
+ <readonly/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/root/boot2.iso'/>
+ <target dev='sdc' bus='sd'/>
+ <readonly/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <target dev='sdd' bus='sd'/>
+ <readonly/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 370920f926..b38cbd6994 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -346,6 +346,7 @@ mymain(void)
DO_TEST("qemu-ns-no-env", NONE);
DO_TEST("disk-aio", NONE);
DO_TEST("disk-cdrom", NONE);
+ DO_TEST("disk-cdrom-bus-other", NONE);
DO_TEST("disk-floppy", NONE);
DO_TEST("disk-usb-device", NONE);
DO_TEST("disk-virtio", NONE);
--
2.20.1