[libvirt] [PATCH v2 0/4] Support for new watchdog model diag288 and action inject-nmi

This patch set provides support for the new watchdog model "diag288" including the new watchdog action "inject-nmi". v2: Added tests for action and model. Boris Fiuczynski (4): Support for a new watchdog action inject-nmi Test for the new watchdog action inject-nmi Support for the new watchdog model diag288 Test for the new watchdog model diag288 docs/formatdomain.html.in | 5 +++++ docs/schemas/domaincommon.rng | 2 ++ include/libvirt/libvirt-domain.h | 1 + src/conf/domain_conf.c | 6 +++-- src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 6 ++--- src/qemu/qemu_monitor_json.c | 2 +- .../qemuxml2argv-watchdog-diag288.args | 8 +++++++ .../qemuxml2argv-watchdog-diag288.xml | 22 ++++++++++++++++++ .../qemuxml2argv-watchdog-injectnmi.args | 5 +++++ .../qemuxml2argv-watchdog-injectnmi.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++++ tools/virsh-domain.c | 3 ++- 13 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.xml -- 2.3.0

This patch provides support for a new watchdog action "inject-nmi" which allows to define an inject of a non-maskable interrupt into a guest. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com> Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com> Reviewed-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 3 +++ docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 1 + src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + src/qemu/qemu_monitor_json.c | 2 +- tools/virsh-domain.c | 3 ++- 7 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 95d8c45..a97e246 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5738,6 +5738,9 @@ qemu-kvm -net nic,model=? /dev/null <li>'none' — do nothing</li> <li>'dump' — automatically dump the guest <span class="since">Since 0.8.7</span></li> + <li>'inject-nmi' — inject a non-maskable interrupt + into the guest + <span class="since">Since 1.3.0</span></li> </ul> <p> Note 1: the 'shutdown' action requires that the guest diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3014365..3040797 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3272,6 +3272,7 @@ <value>pause</value> <value>none</value> <value>dump</value> + <value>inject-nmi</value> </choice> </attribute> </optional> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 7564c20..e8202cf 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2842,6 +2842,7 @@ typedef enum { VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF, /* Guest is forcibly powered off */ VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN, /* Guest is requested to gracefully shutdown */ VIR_DOMAIN_EVENT_WATCHDOG_DEBUG, /* No action, a debug message logged */ + VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI,/* Inject a non-maskable interrupt into guest */ # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_EVENT_WATCHDOG_LAST diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 183e66c..369d155 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -506,7 +506,8 @@ VIR_ENUM_IMPL(virDomainWatchdogAction, VIR_DOMAIN_WATCHDOG_ACTION_LAST, "poweroff", "pause", "dump", - "none") + "none", + "inject-nmi") VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vga", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c96a6e4..8912bbb 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1315,6 +1315,7 @@ typedef enum { VIR_DOMAIN_WATCHDOG_ACTION_PAUSE, VIR_DOMAIN_WATCHDOG_ACTION_DUMP, VIR_DOMAIN_WATCHDOG_ACTION_NONE, + VIR_DOMAIN_WATCHDOG_ACTION_INJECTNMI, VIR_DOMAIN_WATCHDOG_ACTION_LAST } virDomainWatchdogAction; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 71e8f4b..b1ee852 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -555,7 +555,7 @@ static void qemuMonitorJSONHandleRTCChange(qemuMonitorPtr mon, virJSONValuePtr d VIR_ENUM_DECL(qemuMonitorWatchdogAction) VIR_ENUM_IMPL(qemuMonitorWatchdogAction, VIR_DOMAIN_EVENT_WATCHDOG_LAST, - "none", "pause", "reset", "poweroff", "shutdown", "debug"); + "none", "pause", "reset", "poweroff", "shutdown", "debug", "inject-nmi"); static void qemuMonitorJSONHandleWatchdog(qemuMonitorPtr mon, virJSONValuePtr data) { diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index baf4fa3..27d62e9 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11703,7 +11703,8 @@ VIR_ENUM_IMPL(vshDomainEventWatchdog, N_("reset"), N_("poweroff"), N_("shutdown"), - N_("debug")) + N_("debug"), + N_("inject-nmi")) static const char * vshDomainEventWatchdogToString(int action) -- 2.3.0

Adding a test for the new watchdog action "inject-nmi". Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- .../qemuxml2argv-watchdog-injectnmi.args | 5 +++++ .../qemuxml2argv-watchdog-injectnmi.xml | 26 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 32 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.args b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.args new file mode 100644 index 0000000..0f60512 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M \ +pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel \ +none -watchdog ib700 -watchdog-action inject-nmi diff --git a/tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.xml b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.xml new file mode 100644 index 0000000..647c456 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-injectnmi.xml @@ -0,0 +1,26 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>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</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <watchdog model='ib700' action='inject-nmi'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index be82dd2..137b864 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1185,6 +1185,7 @@ mymain(void) DO_TEST("watchdog", NONE); DO_TEST("watchdog-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("watchdog-dump", NONE); + DO_TEST("watchdog-injectnmi", NONE); DO_TEST("balloon-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("balloon-device-auto", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); -- 2.3.0

This patch provides support for the new watchdog model "diag288". Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com> Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com> Reviewed-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com> --- docs/formatdomain.html.in | 2 ++ docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 6 +++--- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a97e246..c432aeb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5717,6 +5717,8 @@ qemu-kvm -net nic,model=? /dev/null <li> 'i6300esb' — the recommended device, emulating a PCI Intel 6300ESB </li> <li> 'ib700' — emulating an ISA iBase IB700 </li> + <li> 'diag288' — emulating an S390 DIAG288 device + <span class="since">Since 1.3.0</span></li> </ul> </dd> <dt><code>action</code></dt> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3040797..1120003 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3261,6 +3261,7 @@ <choice> <value>i6300esb</value> <value>ib700</value> + <value>diag288</value> </choice> </attribute> <optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 369d155..03c3f74 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -498,7 +498,8 @@ VIR_ENUM_IMPL(virDomainSmbiosMode, VIR_DOMAIN_SMBIOS_LAST, VIR_ENUM_IMPL(virDomainWatchdogModel, VIR_DOMAIN_WATCHDOG_MODEL_LAST, "i6300esb", - "ib700") + "ib700", + "diag288") VIR_ENUM_IMPL(virDomainWatchdogAction, VIR_DOMAIN_WATCHDOG_ACTION_LAST, "reset", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8912bbb..aeba5a5 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1304,6 +1304,7 @@ struct _virDomainSoundDef { typedef enum { VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB, VIR_DOMAIN_WATCHDOG_MODEL_IB700, + VIR_DOMAIN_WATCHDOG_MODEL_DIAG288, VIR_DOMAIN_WATCHDOG_MODEL_LAST } virDomainWatchdogModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5444638..99755f1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2308,7 +2308,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, * - VirtIO block * - VirtIO balloon * - Host device passthrough - * - Watchdog (not IB700) + * - Watchdog * - pci serial devices * * Prior to this function being invoked, qemuCollectPCIAddress() will have @@ -2543,9 +2543,9 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, goto error; } - /* A watchdog - skip IB700, it is not a PCI device */ + /* A watchdog - check if it is a PCI device */ if (def->watchdog && - def->watchdog->model != VIR_DOMAIN_WATCHDOG_MODEL_IB700 && + def->watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB && def->watchdog->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { if (virDomainPCIAddressReserveNextSlot(addrs, &def->watchdog->info, flags) < 0) -- 2.3.0

Adding a test for the new watchdog model diag288. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- .../qemuxml2argv-watchdog-diag288.args | 8 ++++++++ .../qemuxml2argv-watchdog-diag288.xml | 22 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.args b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.args new file mode 100644 index 0000000..56d74e5 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.args @@ -0,0 +1,8 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M \ +s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ +socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ +chardev=charmonitor,id=monitor,mode=readline -no-acpi \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-device diag288,id=watchdog0 -watchdog-action inject-nmi diff --git a/tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.xml b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.xml new file mode 100644 index 0000000..2d9f8ac --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-watchdog-diag288.xml @@ -0,0 +1,22 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219100</memory> + <currentMemory>219100</currentMemory> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + <boot order='1'/> + </disk> + <watchdog model='diag288' action='inject-nmi'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 137b864..bb71991 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1186,6 +1186,9 @@ mymain(void) DO_TEST("watchdog-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("watchdog-dump", NONE); DO_TEST("watchdog-injectnmi", NONE); + DO_TEST("watchdog-diag288", + QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390); DO_TEST("balloon-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("balloon-device-auto", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); -- 2.3.0

On Wed, Jun 24, 2015 at 11:28:40AM +0200, Boris Fiuczynski wrote:
This patch set provides support for the new watchdog model "diag288" including the new watchdog action "inject-nmi".
v2: Added tests for action and model.
Boris Fiuczynski (4): Support for a new watchdog action inject-nmi Test for the new watchdog action inject-nmi Support for the new watchdog model diag288 Test for the new watchdog model diag288
ACK series, now pushed. Jan
participants (2)
-
Boris Fiuczynski
-
Ján Tomko