This patch will add -device pvpanic to qemu command line if user enables
pvpanic in domain xml and the qemu version supports pvpanic.
Signed-off-by: Hu Tao <hutao(a)cn.fujitsu.com>
---
src/qemu/qemu_capabilities.c | 3 +++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 10 ++++++++++
3 files changed, 15 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 548b988..ae2c192 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -243,6 +243,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"virtio-mmio",
"ich9-intel-hda",
"kvm-pit-lost-tick-policy",
+
+ "pvpanic", /* 160 */
);
struct _virQEMUCaps {
@@ -1394,6 +1396,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "usb-storage", QEMU_CAPS_DEVICE_USB_STORAGE },
{ "virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO },
{ "ich9-intel-hda", QEMU_CAPS_DEVICE_ICH9_INTEL_HDA },
+ { "pvpanic", QEMU_CAPS_DEVICE_PVPANIC },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 02d47c6..0abe0b9 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -199,6 +199,8 @@ enum virQEMUCapsFlags {
QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 158, /* -device ich9-intel-hda */
QEMU_CAPS_KVM_PIT_TICK_POLICY = 159, /* kvm-pit.lost_tick_policy */
+ QEMU_CAPS_DEVICE_PVPANIC = 160, /* -device pvpanic */
+
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 763417f..6310bb2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9588,6 +9588,16 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
}
+ if (def->pvpanic &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PVPANIC)) {
+ if (def->pvpanic->ioport > 0) {
+ virCommandAddArg(cmd, "-device");
+ virCommandAddArgFormat(cmd, "pvpanic,ioport=%d",
+ def->pvpanic->ioport);
+ } else
+ virCommandAddArgList(cmd, "-device", "pvpanic", NULL);
+ }
+
if (mlock) {
unsigned long long memKB;
--
1.7.11.7