diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index 49fa6ef6c..d9e991016 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -344,6 +344,11 @@
+
+
+
+
+
diff --git a/tests/xmlconfig-xml/boot-many-devices.xml b/tests/xmlconfig-xml/boot-many-devices.xml
index 1db17a57f..0f012120f 100644
--- a/tests/xmlconfig-xml/boot-many-devices.xml
+++ b/tests/xmlconfig-xml/boot-many-devices.xml
@@ -101,6 +101,9 @@
+
+
+
diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
index 2677b0822..98ac0c6af 100644
--- a/tests/xmlconfig.py
+++ b/tests/xmlconfig.py
@@ -30,6 +30,7 @@ from virtinst import VirtualVideoDevice
from virtinst import VirtualController
from virtinst import VirtualWatchdog
from virtinst import VirtualMemballoon
+from virtinst import VirtualPanicDevice
from tests import utils
@@ -875,6 +876,10 @@ class TestXMLConfig(unittest.TestCase):
g.add_device(redir1)
g.add_device(redir2)
+ #Panic Notifier device
+ pdev = VirtualPanicDevice(g.conn)
+ g.add_device(pdev)
+
self._compare(g, "boot-many-devices", False)
def testCpuset(self):
diff --git a/tests/xmlparse-xml/change-panic-device-in.xml b/tests/xmlparse-xml/change-panic-device-in.xml
new file mode 100644
index 000000000..052723a49
--- /dev/null
+++ b/tests/xmlparse-xml/change-panic-device-in.xml
@@ -0,0 +1,62 @@
+
+ Ftest
+ 9d544d2e-e001-a6b2-4aa7-7768796353ea
+ 1048576
+ 1048576
+ 1
+
+ hvm
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ restart
+
+ /usr/local/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/xmlparse-xml/change-panic-device-out.xml b/tests/xmlparse-xml/change-panic-device-out.xml
new file mode 100644
index 000000000..7aa732cbc
--- /dev/null
+++ b/tests/xmlparse-xml/change-panic-device-out.xml
@@ -0,0 +1,62 @@
+
+ Ftest
+ 9d544d2e-e001-a6b2-4aa7-7768796353ea
+ 1048576
+ 1048576
+ 1
+
+ hvm
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ restart
+
+ /usr/local/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index 7cfdbbbf4..4567bb8fa 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -781,6 +781,16 @@ class XMLParseTest(unittest.TestCase):
self._alter_compare(guest.get_xml_config(), outfile)
+ def testPanicDevice(self):
+ guest, outfile = self._get_test_content("change-panic-device")
+
+ dev1 = guest.get_devices("panic")[0]
+
+ check = self._make_checker(dev1)
+ check("type", "isa", "isa")
+ check("iobase", "0x505", "0x506")
+ self._alter_compare(guest.get_xml_config(), outfile)
+
def testAddRemoveDevices(self):
guest, outfile = self._get_test_content("add-devices")
diff --git a/virtinst/__init__.py b/virtinst/__init__.py
index 71651fe62..925af4c26 100644
--- a/virtinst/__init__.py
+++ b/virtinst/__init__.py
@@ -56,6 +56,7 @@ from virtinst.deviceredirdev import VirtualRedirDevice
from virtinst.devicememballoon import VirtualMemballoon
from virtinst.devicetpm import VirtualTPMDevice
from virtinst.devicerng import VirtualRNGDevice
+from virtinst.devicepanic import VirtualPanicDevice
from virtinst.installer import (ContainerInstaller, ImportInstaller,
LiveCDInstaller, PXEInstaller, Installer)
diff --git a/virtinst/device.py b/virtinst/device.py
index 43408d631..4ded87eb8 100644
--- a/virtinst/device.py
+++ b/virtinst/device.py
@@ -104,6 +104,7 @@ class VirtualDevice(XMLBuilder):
VIRTUAL_DEV_MEMBALLOON = "memballoon"
VIRTUAL_DEV_TPM = "tpm"
VIRTUAL_DEV_RNG = "rng"
+ VIRTUAL_DEV_PANIC = "panic"
# Ordering in this list is important: it will be the order the
# Guest class outputs XML. So changing this may upset the test suite
@@ -125,7 +126,8 @@ class VirtualDevice(XMLBuilder):
VIRTUAL_DEV_REDIRDEV,
VIRTUAL_DEV_MEMBALLOON,
VIRTUAL_DEV_TPM,
- VIRTUAL_DEV_RNG]
+ VIRTUAL_DEV_RNG,
+ VIRTUAL_DEV_PANIC]
virtual_device_classes = {}
diff --git a/virtinst/devicepanic.py b/virtinst/devicepanic.py
new file mode 100644
index 000000000..5f7cbd833
--- /dev/null
+++ b/virtinst/devicepanic.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+#
+# Copyright 2013 Fujitsu Limited.
+# Chen Hanxiao
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA.
+
+from virtinst import VirtualDevice
+from virtinst.xmlbuilder import XMLProperty
+
+
+class VirtualPanicDevice(VirtualDevice):
+
+ virtual_device_type = VirtualDevice.VIRTUAL_DEV_PANIC
+ ADDRESS_TYPE_ISA = "isa"
+ TYPES = [ADDRESS_TYPE_ISA]
+ IOBASE_DEFAULT = "0x505"
+
+ @staticmethod
+ def get_pretty_type(panic_type):
+ if panic_type == VirtualPanicDevice.ADDRESS_TYPE_ISA:
+ return _("ISA")
+ return panic_type
+
+
+ type = XMLProperty("./address/@type",
+ default_cb=lambda s: s.ADDRESS_TYPE_ISA)
+ iobase = XMLProperty("./address/@iobase",
+ default_cb=lambda s: s.IOBASE_DEFAULT)
+
+VirtualPanicDevice.register_type()