render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From 5c0f40a4097529450113fcf61cd53a66fcb2cd27 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <5c0f40a4097529450113fcf61cd53a66fcb2cd27@dist-git>
7a3408
From: Peter Krempa <pkrempa@redhat.com>
7a3408
Date: Tue, 22 Sep 2015 16:59:48 +0200
7a3408
Subject: [PATCH] test: Add test to validate that memory sizes don't get
7a3408
 updated on migration
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1252685
7a3408
7a3408
(cherry picked from commit 3b2db51430f647def979960f273637083a2f0c91)
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 .../qemuxml2argv-migrate-numa-unaligned.args       | 13 +++++++++
7a3408
 .../qemuxml2argv-migrate-numa-unaligned.xml        | 33 ++++++++++++++++++++++
7a3408
 tests/qemuxml2argvtest.c                           | 13 +++++++--
7a3408
 3 files changed, 56 insertions(+), 3 deletions(-)
7a3408
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.args
7a3408
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.xml
7a3408
7a3408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.args b/tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.args
7a3408
new file mode 100644
7a3408
index 0000000..4659a65
7a3408
--- /dev/null
7a3408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.args
7a3408
@@ -0,0 +1,13 @@
7a3408
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
7a3408
+/usr/bin/kvm -S -M pc -m 14338 -smp 32 \
7a3408
+-object memory-backend-ram,id=ram-node0,size=20482048,host-nodes=3,\
7a3408
+policy=preferred \
7a3408
+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
7a3408
+-object memory-backend-ram,id=ram-node1,size=675907584,host-nodes=0-7,\
7a3408
+policy=bind \
7a3408
+-numa node,nodeid=1,cpus=1-27,cpus=29,memdev=ram-node1 \
7a3408
+-object memory-backend-ram,id=ram-node2,size=24578457600,host-nodes=1-2,\
7a3408
+host-nodes=5,host-nodes=7,policy=bind \
7a3408
+-numa node,nodeid=2,cpus=28,cpus=30-31,memdev=ram-node2 \
7a3408
+-nographic -monitor unix:/tmp/test-monitor,server,nowait \
7a3408
+-no-acpi -boot c -usb -net none -serial none -parallel none -incoming stdio
7a3408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.xml b/tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.xml
7a3408
new file mode 100644
7a3408
index 0000000..4fbb210
7a3408
--- /dev/null
7a3408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-migrate-numa-unaligned.xml
7a3408
@@ -0,0 +1,33 @@
7a3408
+<domain type='qemu'>
7a3408
+  <name>QEMUGuest</name>
7a3408
+  <uuid>9f4b6512-e73a-4a25-93e8-5307802821ce</uuid>
7a3408
+  <memory unit='KiB'>14682468</memory>
7a3408
+  <currentMemory unit='KiB'>14682468</currentMemory>
7a3408
+  <vcpu placement='static'>32</vcpu>
7a3408
+  <numatune>
7a3408
+    <memnode cellid='0' mode='preferred' nodeset='3'/>
7a3408
+    <memory mode='strict' nodeset='0-7'/>
7a3408
+    <memnode cellid='2' mode='strict' nodeset='1-2,5-7,^6'/>
7a3408
+  </numatune>
7a3408
+  <os>
7a3408
+    <type arch='x86_64' machine='pc'>hvm</type>
7a3408
+    <boot dev='hd'/>
7a3408
+  </os>
7a3408
+  <cpu>
7a3408
+    <numa>
7a3408
+      <cell id='0' cpus='0' memory='20002' unit='KiB'/>
7a3408
+      <cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/>
7a3408
+      <cell id='2' cpus='28,30-31' memory='24002400' unit='KiB'/>
7a3408
+    </numa>
7a3408
+  </cpu>
7a3408
+  <clock offset='utc'/>
7a3408
+  <on_poweroff>destroy</on_poweroff>
7a3408
+  <on_reboot>restart</on_reboot>
7a3408
+  <on_crash>destroy</on_crash>
7a3408
+  <devices>
7a3408
+    <emulator>/usr/bin/kvm</emulator>
7a3408
+    <controller type='usb' index='0'/>
7a3408
+    <controller type='pci' index='0' model='pci-root'/>
7a3408
+    <memballoon model='virtio'/>
7a3408
+  </devices>
7a3408
+</domain>
7a3408
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
7a3408
index 0dd1b9a..43a0fee 100644
7a3408
--- a/tests/qemuxml2argvtest.c
7a3408
+++ b/tests/qemuxml2argvtest.c
7a3408
@@ -553,16 +553,19 @@ mymain(void)
7a3408
                  FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_ERROR,           \
7a3408
                  __VA_ARGS__)
7a3408
 
7a3408
+# define DO_TEST_LINUX(name, ...)                                       \
7a3408
+    DO_TEST_LINUX_FULL(name, NULL, -1, 0, __VA_ARGS__)
7a3408
+
7a3408
 # ifdef __linux__
7a3408
     /* This is a macro that invokes test only on Linux. It's
7a3408
      * meant to be called in those cases where qemuxml2argvmock
7a3408
      * cooperation is expected (e.g. we need a fixed time,
7a3408
      * predictable NUMA topology and so on). On non-Linux
7a3408
      * platforms the macro just consume its argument. */
7a3408
-#  define DO_TEST_LINUX(name, ...)                                      \
7a3408
-    DO_TEST_FULL(name, NULL, -1, 0, __VA_ARGS__)
7a3408
+#  define DO_TEST_LINUX_FULL(name, ...)                                 \
7a3408
+    DO_TEST_FULL(name, __VA_ARGS__)
7a3408
 # else  /* __linux__ */
7a3408
-#  define DO_TEST_LINUX(name, ...)                                      \
7a3408
+#  define DO_TEST_LINUX_FULL(name, ...)                                 \
7a3408
     do {                                                                \
7a3408
         const char *tmp ATTRIBUTE_UNUSED = name;                        \
7a3408
     } while (0)
7a3408
@@ -1265,6 +1268,10 @@ mymain(void)
7a3408
     DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0,
7a3408
             QEMU_CAPS_MIGRATE_QEMU_TCP);
7a3408
 
7a3408
+    DO_TEST_LINUX_FULL("migrate-numa-unaligned", "stdio", 7, 0,
7a3408
+                       QEMU_CAPS_MIGRATE_KVM_STDIO, QEMU_CAPS_NUMA,
7a3408
+                       QEMU_CAPS_OBJECT_MEMORY_RAM);
7a3408
+
7a3408
     DO_TEST("qemu-ns", NONE);
7a3408
 
7a3408
     DO_TEST("smp", QEMU_CAPS_SMP_TOPOLOGY);
7a3408
-- 
7a3408
2.5.3
7a3408