[libvirt] [PATCH 1/4] tests: qemuxml2argv: Unify all tests for disk error policy

Peter Krempa pkrempa at redhat.com
Mon Jul 9 15:56:21 UTC 2018


Add multiple drives with the various configurations rather than having
multiple tests.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 .../disk-drive-error-policy-enospace.args          | 30 ----------------
 .../disk-drive-error-policy-enospace.xml           | 37 -------------------
 .../disk-drive-error-policy-stop.args              | 30 ----------------
 .../disk-drive-error-policy-stop.xml               | 37 -------------------
 ...t-rignore.args => disk-drive-error-policy.args} |  9 +++--
 ...ort-rignore.xml => disk-drive-error-policy.xml} | 13 ++++---
 tests/qemuxml2argvtest.c                           |  4 +--
 .../disk-drive-error-policy-enospace.xml           | 41 ----------------------
 .../disk-drive-error-policy-stop.xml               | 41 ----------------------
 ...ort-rignore.xml => disk-drive-error-policy.xml} | 13 ++++---
 tests/qemuxml2xmltest.c                            |  4 +--
 11 files changed, 26 insertions(+), 233 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/disk-drive-error-policy-enospace.args
 delete mode 100644 tests/qemuxml2argvdata/disk-drive-error-policy-enospace.xml
 delete mode 100644 tests/qemuxml2argvdata/disk-drive-error-policy-stop.args
 delete mode 100644 tests/qemuxml2argvdata/disk-drive-error-policy-stop.xml
 rename tests/qemuxml2argvdata/{disk-drive-error-policy-wreport-rignore.args => disk-drive-error-policy.args} (73%)
 rename tests/qemuxml2argvdata/{disk-drive-error-policy-wreport-rignore.xml => disk-drive-error-policy.xml} (75%)
 delete mode 100644 tests/qemuxml2xmloutdata/disk-drive-error-policy-enospace.xml
 delete mode 100644 tests/qemuxml2xmloutdata/disk-drive-error-policy-stop.xml
 rename tests/qemuxml2xmloutdata/{disk-drive-error-policy-wreport-rignore.xml => disk-drive-error-policy.xml} (78%)

diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy-enospace.args b/tests/qemuxml2argvdata/disk-drive-error-policy-enospace.args
deleted file mode 100644
index 3b7f54c975..0000000000
--- a/tests/qemuxml2argvdata/disk-drive-error-policy-enospace.args
+++ /dev/null
@@ -1,30 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/home/test \
-USER=test \
-LOGNAME=test \
-QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-i686 \
--name QEMUGuest1 \
--S \
--machine pc,accel=tcg,usb=off,dump-guest-core=off \
--m 214 \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
-server,nowait \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot c \
--usb \
--drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
-werror=enospc,cache=none \
--device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-1-0,\
-media=cdrom,readonly=on \
--device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy-enospace.xml b/tests/qemuxml2argvdata/disk-drive-error-policy-enospace.xml
deleted file mode 100644
index dcde3fd2ed..0000000000
--- a/tests/qemuxml2argvdata/disk-drive-error-policy-enospace.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</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='block' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' error_policy='enospace'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='block' device='cdrom'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <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'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy-stop.args b/tests/qemuxml2argvdata/disk-drive-error-policy-stop.args
deleted file mode 100644
index 28a9727c67..0000000000
--- a/tests/qemuxml2argvdata/disk-drive-error-policy-stop.args
+++ /dev/null
@@ -1,30 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/home/test \
-USER=test \
-LOGNAME=test \
-QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-i686 \
--name QEMUGuest1 \
--S \
--machine pc,accel=tcg,usb=off,dump-guest-core=off \
--m 214 \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
-server,nowait \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot c \
--usb \
--drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
-werror=stop,rerror=stop,cache=none \
--device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-1-0,\
-media=cdrom,readonly=on \
--device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy-stop.xml b/tests/qemuxml2argvdata/disk-drive-error-policy-stop.xml
deleted file mode 100644
index 004dc974cd..0000000000
--- a/tests/qemuxml2argvdata/disk-drive-error-policy-stop.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</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='block' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' error_policy='stop'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='block' device='cdrom'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <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'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy-wreport-rignore.args b/tests/qemuxml2argvdata/disk-drive-error-policy.args
similarity index 73%
rename from tests/qemuxml2argvdata/disk-drive-error-policy-wreport-rignore.args
rename to tests/qemuxml2argvdata/disk-drive-error-policy.args
index b570de2ed6..9d510015f6 100644
--- a/tests/qemuxml2argvdata/disk-drive-error-policy-wreport-rignore.args
+++ b/tests/qemuxml2argvdata/disk-drive-error-policy.args
@@ -23,8 +23,11 @@ server,nowait \
 -boot c \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
-werror=report,rerror=ignore,cache=none \
+werror=stop,rerror=stop,cache=none \
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-1-0,\
-media=cdrom,readonly=on \
+-drive file=/dev/HostVG/QEMUGuest2,format=qcow2,if=none,id=drive-ide0-0-1,\
+werror=enospc,cache=none \
+-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
+-drive file=/dev/HostVG/QEMUGuest3,format=qcow2,if=none,id=drive-ide0-1-0,\
+werror=report,rerror=ignore,cache=none \
 -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
diff --git a/tests/qemuxml2argvdata/disk-drive-error-policy-wreport-rignore.xml b/tests/qemuxml2argvdata/disk-drive-error-policy.xml
similarity index 75%
rename from tests/qemuxml2argvdata/disk-drive-error-policy-wreport-rignore.xml
rename to tests/qemuxml2argvdata/disk-drive-error-policy.xml
index 98d2be9f2e..708c13fc0e 100644
--- a/tests/qemuxml2argvdata/disk-drive-error-policy-wreport-rignore.xml
+++ b/tests/qemuxml2argvdata/disk-drive-error-policy.xml
@@ -15,16 +15,21 @@
   <devices>
     <emulator>/usr/bin/qemu-system-i686</emulator>
     <disk type='block' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' error_policy='report' rerror_policy='ignore'/>
+      <driver name='qemu' type='qcow2' cache='none' error_policy='stop'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <disk type='block' device='cdrom'>
-      <driver name='qemu' type='raw'/>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none' error_policy='enospace'/>
       <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdb' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none' error_policy='report' rerror_policy='ignore'/>
+      <source dev='/dev/HostVG/QEMUGuest3'/>
       <target dev='hdc' bus='ide'/>
-      <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
     <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3be5af03aa..65b034a75c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1035,9 +1035,7 @@ mymain(void)
     DO_TEST_PARSE_ERROR("disk-drive-shared-qcow", NONE);
     DO_TEST("disk-drive-shared-locking",
             QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DISK_SHARE_RW);
-    DO_TEST("disk-drive-error-policy-stop", NONE);
-    DO_TEST("disk-drive-error-policy-enospace", NONE);
-    DO_TEST("disk-drive-error-policy-wreport-rignore", NONE);
+    DO_TEST("disk-drive-error-policy", NONE);
     DO_TEST("disk-drive-cache-v2-wt", NONE);
     DO_TEST("disk-drive-cache-v2-wb", NONE);
     DO_TEST("disk-drive-cache-v2-none", NONE);
diff --git a/tests/qemuxml2xmloutdata/disk-drive-error-policy-enospace.xml b/tests/qemuxml2xmloutdata/disk-drive-error-policy-enospace.xml
deleted file mode 100644
index 6ec367c76e..0000000000
--- a/tests/qemuxml2xmloutdata/disk-drive-error-policy-enospace.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</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='block' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' error_policy='enospace'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='block' device='cdrom'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <target dev='hdc' bus='ide'/>
-      <readonly/>
-      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
-    </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/qemuxml2xmloutdata/disk-drive-error-policy-stop.xml b/tests/qemuxml2xmloutdata/disk-drive-error-policy-stop.xml
deleted file mode 100644
index 51bd87fa6c..0000000000
--- a/tests/qemuxml2xmloutdata/disk-drive-error-policy-stop.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</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='block' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' error_policy='stop'/>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='block' device='cdrom'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <target dev='hdc' bus='ide'/>
-      <readonly/>
-      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
-    </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/qemuxml2xmloutdata/disk-drive-error-policy-wreport-rignore.xml b/tests/qemuxml2xmloutdata/disk-drive-error-policy.xml
similarity index 78%
rename from tests/qemuxml2xmloutdata/disk-drive-error-policy-wreport-rignore.xml
rename to tests/qemuxml2xmloutdata/disk-drive-error-policy.xml
index e4a21f4f11..0e534a1add 100644
--- a/tests/qemuxml2xmloutdata/disk-drive-error-policy-wreport-rignore.xml
+++ b/tests/qemuxml2xmloutdata/disk-drive-error-policy.xml
@@ -15,16 +15,21 @@
   <devices>
     <emulator>/usr/bin/qemu-system-i686</emulator>
     <disk type='block' device='disk'>
-      <driver name='qemu' type='qcow2' cache='none' error_policy='report' rerror_policy='ignore'/>
+      <driver name='qemu' type='qcow2' cache='none' error_policy='stop'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
-    <disk type='block' device='cdrom'>
-      <driver name='qemu' type='raw'/>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none' error_policy='enospace'/>
       <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdb' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+    </disk>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none' error_policy='report' rerror_policy='ignore'/>
+      <source dev='/dev/HostVG/QEMUGuest3'/>
       <target dev='hdc' bus='ide'/>
-      <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
     <controller type='usb' index='0'>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index bbb995656e..c0b228515c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -356,9 +356,7 @@ mymain(void)
     DO_TEST("disk-virtio-drive-queues", QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES);
     DO_TEST("disk-drive-boot-disk", NONE);
     DO_TEST("disk-drive-boot-cdrom", NONE);
-    DO_TEST("disk-drive-error-policy-stop", NONE);
-    DO_TEST("disk-drive-error-policy-enospace", NONE);
-    DO_TEST("disk-drive-error-policy-wreport-rignore", NONE);
+    DO_TEST("disk-drive-error-policy", NONE);
     DO_TEST("disk-drive-fmt-qcow", NONE);
     DO_TEST("disk-drive-copy-on-read", NONE);
     DO_TEST("disk-drive-cache-v2-wt", NONE);
-- 
2.16.2




More information about the libvir-list mailing list