提交 2af04bde 编写于 作者: P Peter Krempa

qemu: Log additional data from hyperv crash notifier

The hyperv panic notifier reports additional data in form of 5 registers
that are reported in the crash event from qemu. Log them into the VM log
file and report them as a warning so that admins can see the cause of
crash of their windows VMs.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1426176
上级 d7580dd6
...@@ -3971,10 +3971,28 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver, ...@@ -3971,10 +3971,28 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
return ret; return ret;
} }
static void
qemuProcessGuestPanicEventInfo(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuMonitorEventPanicInfoPtr info)
{
char *msg = qemuMonitorGuestPanicEventInfoFormatMsg(info);
char *timestamp = virTimeStringNow();
if (msg && timestamp)
qemuDomainLogAppendMessage(driver, vm, "%s: panic %s\n", timestamp, msg);
VIR_FREE(timestamp);
VIR_FREE(msg);
}
static void static void
processGuestPanicEvent(virQEMUDriverPtr driver, processGuestPanicEvent(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
int action) int action,
qemuMonitorEventPanicInfoPtr info)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectEventPtr event = NULL; virObjectEventPtr event = NULL;
...@@ -3990,6 +4008,9 @@ processGuestPanicEvent(virQEMUDriverPtr driver, ...@@ -3990,6 +4008,9 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
goto endjob; goto endjob;
} }
if (info)
qemuProcessGuestPanicEventInfo(driver, vm, info);
virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICKED); virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICKED);
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
...@@ -4567,7 +4588,8 @@ static void qemuProcessEventHandler(void *data, void *opaque) ...@@ -4567,7 +4588,8 @@ static void qemuProcessEventHandler(void *data, void *opaque)
processWatchdogEvent(driver, vm, processEvent->action); processWatchdogEvent(driver, vm, processEvent->action);
break; break;
case QEMU_PROCESS_EVENT_GUESTPANIC: case QEMU_PROCESS_EVENT_GUESTPANIC:
processGuestPanicEvent(driver, vm, processEvent->action); processGuestPanicEvent(driver, vm, processEvent->action,
processEvent->data);
break; break;
case QEMU_PROCESS_EVENT_DEVICE_DELETED: case QEMU_PROCESS_EVENT_DEVICE_DELETED:
processDeviceDeletedEvent(driver, vm, processEvent->data); processDeviceDeletedEvent(driver, vm, processEvent->data);
......
...@@ -4243,6 +4243,30 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon) ...@@ -4243,6 +4243,30 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon)
} }
char *
qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info)
{
char *ret = NULL;
switch (info->type) {
case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV:
ignore_value(virAsprintf(&ret,
"hyper-v: 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_NONE:
case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST:
break;
}
return ret;
}
void void
qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info) qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info)
{ {
......
...@@ -97,6 +97,7 @@ struct _qemuMonitorEventPanicInfo { ...@@ -97,6 +97,7 @@ struct _qemuMonitorEventPanicInfo {
} data; } data;
}; };
char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info);
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info); void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info);
typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon, typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册