render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 6e2efb5b67a6d1a65c4e4facb7013f5e24622591 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <6e2efb5b67a6d1a65c4e4facb7013f5e24622591@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Wed, 19 Feb 2020 15:10:25 +0100
a41c76
Subject: [PATCH] tests: qemu: Add test data for the new <slice> element
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 293e7750c9c26ac19ed4fafa9c9f1fe3e90d5078)
a41c76
a41c76
 Changes:
a41c76
  tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
a41c76
  tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
a41c76
a41c76
 Due to missing backport of changes related to CPU detection there is
a41c76
 difference in the XML files in unrelated parts.
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Message-Id: <21b28fdf8e4fc8aaf9a68b8c32be5d5a1fdedacc.1582120424.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 .../disk-slices.x86_64-latest.args            | 52 ++++++++++++++++++
a41c76
 tests/qemuxml2argvdata/disk-slices.xml        | 45 ++++++++++++++++
a41c76
 tests/qemuxml2argvtest.c                      |  2 +
a41c76
 .../disk-slices.x86_64-latest.xml             | 53 +++++++++++++++++++
a41c76
 tests/qemuxml2xmltest.c                       |  2 +
a41c76
 5 files changed, 154 insertions(+)
a41c76
 create mode 100644 tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
a41c76
 create mode 100644 tests/qemuxml2argvdata/disk-slices.xml
a41c76
 create mode 100644 tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
a41c76
a41c76
diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
a41c76
new file mode 100644
a41c76
index 0000000000..661b3f7ea1
a41c76
--- /dev/null
a41c76
+++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
a41c76
@@ -0,0 +1,52 @@
a41c76
+LC_ALL=C \
a41c76
+PATH=/bin \
a41c76
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
a41c76
+USER=test \
a41c76
+LOGNAME=test \
a41c76
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
a41c76
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
a41c76
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
a41c76
+QEMU_AUDIO_DRV=none \
a41c76
+/usr/bin/qemu-system-i386 \
a41c76
+-name guest=QEMUGuest1,debug-threads=on \
a41c76
+-S \
a41c76
+-object secret,id=masterKey0,format=raw,\
a41c76
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
a41c76
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
a41c76
+-m 214 \
a41c76
+-overcommit mem-lock=off \
a41c76
+-smp 1,sockets=1,cores=1,threads=1 \
a41c76
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
a41c76
+-display none \
a41c76
+-no-user-config \
a41c76
+-nodefaults \
a41c76
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
a41c76
+-mon chardev=charmonitor,id=monitor,mode=control \
a41c76
+-rtc base=utc \
a41c76
+-no-shutdown \
a41c76
+-no-acpi \
a41c76
+-boot strict=on \
a41c76
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
a41c76
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img",\
a41c76
+"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
a41c76
+-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw",\
a41c76
+"offset":1234,"size":321,"file":"libvirt-3-storage"}' \
a41c76
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=libvirt-3-format,\
a41c76
+id=virtio-disk0,bootindex=1 \
a41c76
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img",\
a41c76
+"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
a41c76
+-blockdev '{"driver":"raw","node-name":"libvirt-2-slice-sto","offset":9876,\
a41c76
+"size":123456789,"file":"libvirt-2-storage","auto-read-only":true,\
a41c76
+"discard":"unmap"}' \
a41c76
+-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2",\
a41c76
+"file":"libvirt-2-slice-sto","backing":null}' \
a41c76
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/overlay.qcow2",\
a41c76
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
a41c76
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2",\
a41c76
+"file":"libvirt-1-storage","backing":"libvirt-2-format"}' \
a41c76
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-1-format,\
a41c76
+id=virtio-disk1 \
a41c76
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \
a41c76
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
a41c76
+resourcecontrol=deny \
a41c76
+-msg timestamp=on
a41c76
diff --git a/tests/qemuxml2argvdata/disk-slices.xml b/tests/qemuxml2argvdata/disk-slices.xml
a41c76
new file mode 100644
a41c76
index 0000000000..cff7cc7ee4
a41c76
--- /dev/null
a41c76
+++ b/tests/qemuxml2argvdata/disk-slices.xml
a41c76
@@ -0,0 +1,45 @@
a41c76
+<domain type='qemu'>
a41c76
+  <name>QEMUGuest1</name>
a41c76
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
a41c76
+  <memory unit='KiB'>219136</memory>
a41c76
+  <currentMemory unit='KiB'>219136</currentMemory>
a41c76
+  <vcpu placement='static'>1</vcpu>
a41c76
+  <os>
a41c76
+    <type arch='i686' machine='pc'>hvm</type>
a41c76
+    <boot dev='hd'/>
a41c76
+  </os>
a41c76
+  <clock offset='utc'/>
a41c76
+  <on_poweroff>destroy</on_poweroff>
a41c76
+  <on_reboot>restart</on_reboot>
a41c76
+  <on_crash>destroy</on_crash>
a41c76
+  <devices>
a41c76
+    <emulator>/usr/bin/qemu-system-i386</emulator>
a41c76
+    <disk type='file' device='disk'>
a41c76
+      <driver name='qemu' type='raw'/>
a41c76
+      <source file='/var/lib/libvirt/images/raw.img'>
a41c76
+        <slices>
a41c76
+          <slice type='storage' offset='1234' size='321'/>
a41c76
+        </slices>
a41c76
+      </source>
a41c76
+      <backingStore/>
a41c76
+      <target dev='vda' bus='virtio'/>
a41c76
+    </disk>
a41c76
+    <disk type='file' device='disk'>
a41c76
+      <driver name='qemu' type='qcow2'/>
a41c76
+      <source file='/var/lib/libvirt/images/overlay.qcow2'/>
a41c76
+      <backingStore type='file'>
a41c76
+        <format type='qcow2'/>
a41c76
+        <source file='/var/lib/libvirt/images/raw.img'>
a41c76
+          <slices>
a41c76
+            <slice type='storage' offset='9876' size='123456789'/>
a41c76
+          </slices>
a41c76
+        </source>
a41c76
+        <backingStore/>
a41c76
+      </backingStore>
a41c76
+      <target dev='vdb' bus='virtio'/>
a41c76
+    </disk>
a41c76
+    <controller type='usb'/>
a41c76
+    <controller type='pci' model='pci-root'/>
a41c76
+    <memballoon model='virtio'/>
a41c76
+  </devices>
a41c76
+</domain>
a41c76
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
a41c76
index 508dfee3fb..8215935bab 100644
a41c76
--- a/tests/qemuxml2argvtest.c
a41c76
+++ b/tests/qemuxml2argvtest.c
a41c76
@@ -1162,6 +1162,8 @@ mymain(void)
a41c76
     DO_TEST_CAPS_VER("disk-backing-chains-noindex", "2.12.0");
a41c76
     DO_TEST_CAPS_LATEST("disk-backing-chains-noindex");
a41c76
 
a41c76
+    DO_TEST_CAPS_LATEST("disk-slices");
a41c76
+
a41c76
     DO_TEST("graphics-egl-headless",
a41c76
             QEMU_CAPS_EGL_HEADLESS,
a41c76
             QEMU_CAPS_DEVICE_CIRRUS_VGA);
a41c76
diff --git a/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
a41c76
new file mode 100644
a41c76
index 0000000000..8a56936910
a41c76
--- /dev/null
a41c76
+++ b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
a41c76
@@ -0,0 +1,53 @@
a41c76
+<domain type='qemu'>
a41c76
+  <name>QEMUGuest1</name>
a41c76
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
a41c76
+  <memory unit='KiB'>219136</memory>
a41c76
+  <currentMemory unit='KiB'>219136</currentMemory>
a41c76
+  <vcpu placement='static'>1</vcpu>
a41c76
+  <os>
a41c76
+    <type arch='i686' machine='pc'>hvm</type>
a41c76
+    <boot dev='hd'/>
a41c76
+  </os>
a41c76
+  <clock offset='utc'/>
a41c76
+  <on_poweroff>destroy</on_poweroff>
a41c76
+  <on_reboot>restart</on_reboot>
a41c76
+  <on_crash>destroy</on_crash>
a41c76
+  <devices>
a41c76
+    <emulator>/usr/bin/qemu-system-i386</emulator>
a41c76
+    <disk type='file' device='disk'>
a41c76
+      <driver name='qemu' type='raw'/>
a41c76
+      <source file='/var/lib/libvirt/images/raw.img'>
a41c76
+        <slices>
a41c76
+          <slice type='storage' offset='1234' size='321'/>
a41c76
+        </slices>
a41c76
+      </source>
a41c76
+      <backingStore/>
a41c76
+      <target dev='vda' bus='virtio'/>
a41c76
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
a41c76
+    </disk>
a41c76
+    <disk type='file' device='disk'>
a41c76
+      <driver name='qemu' type='qcow2'/>
a41c76
+      <source file='/var/lib/libvirt/images/overlay.qcow2'/>
a41c76
+      <backingStore type='file'>
a41c76
+        <format type='qcow2'/>
a41c76
+        <source file='/var/lib/libvirt/images/raw.img'>
a41c76
+          <slices>
a41c76
+            <slice type='storage' offset='9876' size='123456789'/>
a41c76
+          </slices>
a41c76
+        </source>
a41c76
+        <backingStore/>
a41c76
+      </backingStore>
a41c76
+      <target dev='vdb' bus='virtio'/>
a41c76
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
a41c76
+    </disk>
a41c76
+    <controller type='usb' index='0' model='piix3-uhci'>
a41c76
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
a41c76
+    </controller>
a41c76
+    <controller type='pci' index='0' model='pci-root'/>
a41c76
+    <input type='mouse' bus='ps2'/>
a41c76
+    <input type='keyboard' bus='ps2'/>
a41c76
+    <memballoon model='virtio'>
a41c76
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
a41c76
+    </memballoon>
a41c76
+  </devices>
a41c76
+</domain>
a41c76
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
a41c76
index 6a8ae9f7eb..a3c7f8fd47 100644
a41c76
--- a/tests/qemuxml2xmltest.c
a41c76
+++ b/tests/qemuxml2xmltest.c
a41c76
@@ -527,6 +527,8 @@ mymain(void)
a41c76
     DO_TEST("pci-rom-disabled-invalid", NONE);
a41c76
     DO_TEST("pci-serial-dev-chardev", NONE);
a41c76
 
a41c76
+    DO_TEST_CAPS_LATEST("disk-slices");
a41c76
+
a41c76
     DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS);
a41c76
     DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS);
a41c76
     DO_TEST("luks-disks", NONE);
a41c76
-- 
a41c76
2.25.0
a41c76