[libvirt] [PATCH 2/4] tests: add startuppolicy testcases for cdrom

Guannan Ren gren at redhat.com
Fri Aug 16 07:52:50 UTC 2013


---
 tests/qemustartuppolicytest.c                      |  4 +++
 .../domain-input-cdrom-absent-policy-mandatory.xml | 28 +++++++++++++++++++++
 .../domain-input-cdrom-absent-policy-optional.xml  | 28 +++++++++++++++++++++
 .../domain-input-cdrom-absent-policy-requisite.xml | 28 +++++++++++++++++++++
 .../domain-output-cdrom-absent-policy-optional.xml | 29 ++++++++++++++++++++++
 ...domain-output-cdrom-absent-policy-requisite.xml | 29 ++++++++++++++++++++++
 6 files changed, 146 insertions(+)
 create mode 100644 tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-mandatory.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-optional.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-requisite.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-optional.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-requisite.xml

diff --git a/tests/qemustartuppolicytest.c b/tests/qemustartuppolicytest.c
index 0f0d4b8..df09507 100644
--- a/tests/qemustartuppolicytest.c
+++ b/tests/qemustartuppolicytest.c
@@ -196,6 +196,10 @@ mymain(void)
     } while (0)
 
     DO_TEST_OPTIONAL("cdrom-present-policy-optional", false);
+    DO_TEST_OPTIONAL("cdrom-absent-policy-optional", false);
+    DO_TEST_MANDATORY("cdrom-absent-policy-mandatory", false, true);
+    DO_TEST_REQUISITE("cdrom-absent-policy-requisite", false, true, true);
+    DO_TEST_REQUISITE("cdrom-absent-policy-requisite", false, false, false);
 
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
diff --git a/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-mandatory.xml b/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-mandatory.xml
new file mode 100644
index 0000000..0999aef
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-mandatory.xml
@@ -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='cdrom'>
+      <target dev='hdc' bus='ide'/>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/cdrom-nonexist' startupPolicy='mandatory'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-optional.xml b/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-optional.xml
new file mode 100644
index 0000000..cdcc96b
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-optional.xml
@@ -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='cdrom'>
+      <target dev='hdc' bus='ide'/>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/cdrom-nonexist' startupPolicy='optional'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-requisite.xml b/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-requisite.xml
new file mode 100644
index 0000000..8035dfb
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-input-cdrom-absent-policy-requisite.xml
@@ -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='cdrom'>
+      <target dev='hdc' bus='ide'/>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/cdrom-nonexist' startupPolicy='requisite'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-optional.xml b/tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-optional.xml
new file mode 100644
index 0000000..fab116e
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-optional.xml
@@ -0,0 +1,29 @@
+<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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source startupPolicy='optional'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-requisite.xml b/tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-requisite.xml
new file mode 100644
index 0000000..7d40817
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-output-cdrom-absent-policy-requisite.xml
@@ -0,0 +1,29 @@
+<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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source startupPolicy='requisite'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
-- 
1.8.3.1




More information about the libvir-list mailing list