[libvirt] [PATCH 3/4] tests: add startuppolicy testcases for single harddisk

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


---
 tests/qemustartuppolicytest.c                      |  4 ++++
 .../domain-input-disk-absent-policy-mandatory.xml  | 27 +++++++++++++++++++++
 .../domain-input-disk-absent-policy-optional.xml   | 27 +++++++++++++++++++++
 .../domain-input-disk-present-policy-none.xml      | 27 +++++++++++++++++++++
 .../domain-output-disk-absent-policy-optional.xml  | 22 +++++++++++++++++
 .../domain-output-disk-present-policy-none.xml     | 28 ++++++++++++++++++++++
 6 files changed, 135 insertions(+)
 create mode 100644 tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-mandatory.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-optional.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-input-disk-present-policy-none.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-output-disk-absent-policy-optional.xml
 create mode 100644 tests/qemustartuppolicytestdata/domain-output-disk-present-policy-none.xml

diff --git a/tests/qemustartuppolicytest.c b/tests/qemustartuppolicytest.c
index df09507..7081400 100644
--- a/tests/qemustartuppolicytest.c
+++ b/tests/qemustartuppolicytest.c
@@ -201,6 +201,10 @@ mymain(void)
     DO_TEST_REQUISITE("cdrom-absent-policy-requisite", false, true, true);
     DO_TEST_REQUISITE("cdrom-absent-policy-requisite", false, false, false);
 
+    DO_TEST_OPTIONAL("disk-absent-policy-optional", false);
+    DO_TEST_OPTIONAL("disk-present-policy-none", true);
+    DO_TEST_MANDATORY("disk-absent-policy-mandatory", false, true);
+
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
     virObjectUnref(driver.config);
diff --git a/tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-mandatory.xml b/tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-mandatory.xml
new file mode 100644
index 0000000..5164a4e
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-mandatory.xml
@@ -0,0 +1,27 @@
+<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='disk'>
+      <target dev='hdc' bus='ide'/>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/disk-nonexist' startupPolicy='mandatory'/>
+      <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-disk-absent-policy-optional.xml b/tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-optional.xml
new file mode 100644
index 0000000..8d25ea9
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-input-disk-absent-policy-optional.xml
@@ -0,0 +1,27 @@
+<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='disk'>
+      <target dev='hdc' bus='ide'/>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/disk-nonexist' startupPolicy='optional'/>
+      <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-disk-present-policy-none.xml b/tests/qemustartuppolicytestdata/domain-input-disk-present-policy-none.xml
new file mode 100644
index 0000000..1ec6a90
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-input-disk-present-policy-none.xml
@@ -0,0 +1,27 @@
+<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='disk'>
+      <target dev='hdc' bus='ide'/>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/null'/>
+      <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-disk-absent-policy-optional.xml b/tests/qemustartuppolicytestdata/domain-output-disk-absent-policy-optional.xml
new file mode 100644
index 0000000..d68cd79
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-output-disk-absent-policy-optional.xml
@@ -0,0 +1,22 @@
+<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>
+    <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-disk-present-policy-none.xml b/tests/qemustartuppolicytestdata/domain-output-disk-present-policy-none.xml
new file mode 100644
index 0000000..8b0aeef
--- /dev/null
+++ b/tests/qemustartuppolicytestdata/domain-output-disk-present-policy-none.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='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/dev/null'/>
+      <target dev='hdc' bus='ide'/>
+      <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