Since version 2.12, QEMU reports additional information in case of a
guest panic. Let's set the state information when handling the guest
panic event and make it available for later.
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi(a)linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk(a)linux.ibm.com>
---
src/qemu/qemu_driver.c | 11 +++++++++--
src/qemu/qemu_monitor.c | 31 +++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.h | 1 +
3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 871f2dde..495c38db 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4255,6 +4255,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectEventPtr event = NULL;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ char *state_info = NULL;
bool removeInactive = false;
unsigned long flags = VIR_DUMP_MEMORY_ONLY;
@@ -4268,10 +4269,15 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
goto endjob;
}
- if (info)
+ if (info) {
qemuProcessGuestPanicEventInfo(driver, vm, info);
+ state_info = qemuMonitorGuestPanicEventInfoFormatMsgCompact(info);
+ }
- virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICKED);
+ virDomainObjSetStateFull(vm,
+ VIR_DOMAIN_CRASHED,
+ VIR_DOMAIN_CRASHED_PANICKED,
+ state_info);
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_CRASHED,
@@ -4329,6 +4335,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
qemuDomainRemoveInactiveJob(driver, vm);
cleanup:
+ VIR_FREE(state_info);
virObjectUnref(cfg);
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index bc116e4e..1ca54283 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4240,6 +4240,37 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon)
}
+char *
+qemuMonitorGuestPanicEventInfoFormatMsgCompact(qemuMonitorEventPanicInfoPtr info)
+{
+ char *ret = NULL;
+
+ switch (info->type) {
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV:
+ ignore_value(virAsprintf(&ret,
+ "arg1='0x%llx', arg2='0x%llx',
"
+ "arg3='0x%llx', arg4='0x%llx',
arg5='0x%llx'",
+ info->data.hyperv.arg1, info->data.hyperv.arg2,
+ info->data.hyperv.arg3, info->data.hyperv.arg4,
+ info->data.hyperv.arg5));
+ break;
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390:
+ ignore_value(virAsprintf(&ret, "%s core='%d'
psw-mask='0x%016llx' "
+ "psw-addr='0x%016llx'",
+ info->data.s390.reason,
+ info->data.s390.core,
+ info->data.s390.psw_mask,
+ info->data.s390.psw_addr));
+ break;
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE:
+ case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
+ break;
+ }
+
+ return ret;
+}
+
+
char *
qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info)
{
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index e8ed2d04..e6fb39c5 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -109,6 +109,7 @@ struct _qemuMonitorEventPanicInfo {
} data;
};
+char *qemuMonitorGuestPanicEventInfoFormatMsgCompact(qemuMonitorEventPanicInfoPtr info);
char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info);
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info);
--
2.17.0