render / rpms / libvirt

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