[libvirt] [PATCH] conf: Ignore panic device on pSeries.

Andrea Bolognani abologna at redhat.com
Thu May 7 16:40:52 UTC 2015


The guest firmware already provides the same functionality, so we can
just safely drop the <panic/> element from the domain definition.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1182388
---
 src/conf/domain_conf.c                             | 17 +++++++-----
 .../qemuxml2argv-pseries-panic.args                |  7 +++++
 .../qemuxml2argv-pseries-panic.xml                 | 30 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 ++
 .../qemuxml2xmlout-pseries-panic.xml               | 29 +++++++++++++++++++++
 tests/qemuxml2xmltest.c                            |  1 +
 6 files changed, 80 insertions(+), 6 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic.xml

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4cd36a1..a7d4efa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15478,13 +15478,18 @@ virDomainDefParseXML(xmlDocPtr xml,
         goto error;
     }
     if (n > 0) {
-        virDomainPanicDefPtr panic =
-            virDomainPanicDefParseXML(nodes[0]);
-        if (!panic)
-            goto error;
+        /* Ignore the panic device on pSeries, as the guest
+         * firmware already provides the same functionality */
+        if (!(ARCH_IS_PPC64(def->os.arch) &&
+              STRPREFIX(def->os.machine, "pseries"))) {
+            virDomainPanicDefPtr panic =
+                virDomainPanicDefParseXML(nodes[0]);
+            if (!panic)
+                goto error;
 
-        def->panic = panic;
-        VIR_FREE(nodes);
+            def->panic = panic;
+            VIR_FREE(nodes);
+        }
     }
 
     /* analysis of the shmem devices */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.args
new file mode 100644
index 0000000..30e4b43
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic \
+-nodefconfig -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
+-chardev pty,id=charserial0 \
+-device spapr-vty,chardev=charserial0,reg=0x30000000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.xml
new file mode 100644
index 0000000..9312975
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <currentMemory unit='KiB'>524288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>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-ppc64</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+      <address type='spapr-vio'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+      <address type='spapr-vio'/>
+    </console>
+    <memballoon model='none'/>
+    <panic/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 97c7fba..5719d70 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1360,6 +1360,8 @@ mymain(void)
             QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
     DO_TEST("pseries-cpu-le",  QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+    DO_TEST("pseries-panic",
+            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
     DO_TEST("disk-ide-drive-split",
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_IDE_CD);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic.xml
new file mode 100644
index 0000000..8980847
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>524288</memory>
+  <currentMemory unit='KiB'>524288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>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-ppc64</emulator>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <serial type='pty'>
+      <target port='0'/>
+      <address type='spapr-vio'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+      <address type='spapr-vio'/>
+    </console>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b611afd..5db6341 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -534,6 +534,7 @@ mymain(void)
     DO_TEST("virtio-rng-egd");
 
     DO_TEST("pseries-nvram");
+    DO_TEST_DIFFERENT("pseries-panic");
 
     /* These tests generate different XML */
     DO_TEST_DIFFERENT("balloon-device-auto");
-- 
2.1.0




More information about the libvir-list mailing list