mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-11 14:11:31 +00:00
qemuMonitorJSONHandleIOError: Do not munge 'reason' field of IO error event
Leave the interpretation of the event to 'qemuProcessHandleIOError()' which will create it's own variant of the messages for the user-facing libvirt events. qemuMonitorJSONHandleIOError() will pass through the raw data it got from qemu. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
590a5765c1
commit
f8f8d5a253
@ -1130,12 +1130,13 @@ qemuMonitorEmitIOError(qemuMonitor *mon,
|
|||||||
const char *device,
|
const char *device,
|
||||||
const char *nodename,
|
const char *nodename,
|
||||||
int action,
|
int action,
|
||||||
|
bool nospace,
|
||||||
const char *reason)
|
const char *reason)
|
||||||
{
|
{
|
||||||
VIR_DEBUG("mon=%p", mon);
|
VIR_DEBUG("mon=%p", mon);
|
||||||
|
|
||||||
QEMU_MONITOR_CALLBACK(mon, domainIOError, mon->vm,
|
QEMU_MONITOR_CALLBACK(mon, domainIOError, mon->vm,
|
||||||
device, nodename, action, reason);
|
device, nodename, action, nospace, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,6 +209,7 @@ typedef void (*qemuMonitorDomainIOErrorCallback)(qemuMonitor *mon,
|
|||||||
const char *device,
|
const char *device,
|
||||||
const char *nodename,
|
const char *nodename,
|
||||||
int action,
|
int action,
|
||||||
|
bool nospace,
|
||||||
const char *reason);
|
const char *reason);
|
||||||
typedef void (*qemuMonitorDomainGraphicsCallback)(qemuMonitor *mon,
|
typedef void (*qemuMonitorDomainGraphicsCallback)(qemuMonitor *mon,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
@ -453,6 +454,7 @@ void qemuMonitorEmitIOError(qemuMonitor *mon,
|
|||||||
const char *device,
|
const char *device,
|
||||||
const char *nodename,
|
const char *nodename,
|
||||||
int action,
|
int action,
|
||||||
|
bool nospace,
|
||||||
const char *reason);
|
const char *reason);
|
||||||
void qemuMonitorEmitGraphics(qemuMonitor *mon,
|
void qemuMonitorEmitGraphics(qemuMonitor *mon,
|
||||||
int phase,
|
int phase,
|
||||||
|
@ -695,8 +695,8 @@ qemuMonitorJSONHandleIOError(qemuMonitor *mon, virJSONValue *data)
|
|||||||
const char *device;
|
const char *device;
|
||||||
const char *nodename;
|
const char *nodename;
|
||||||
const char *action;
|
const char *action;
|
||||||
const char *reason = "";
|
const char *reason;
|
||||||
bool nospc = false;
|
bool nospace = false;
|
||||||
int actionID;
|
int actionID;
|
||||||
|
|
||||||
/* Throughout here we try our best to carry on upon errors,
|
/* Throughout here we try our best to carry on upon errors,
|
||||||
@ -719,16 +719,16 @@ qemuMonitorJSONHandleIOError(qemuMonitor *mon, virJSONValue *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nodename = virJSONValueObjectGetString(data, "node-name");
|
nodename = virJSONValueObjectGetString(data, "node-name");
|
||||||
|
reason = virJSONValueObjectGetString(data, "reason");
|
||||||
if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) == 0 && nospc)
|
/* 'nospace' flag is relevant only when true */
|
||||||
reason = "enospc";
|
ignore_value(virJSONValueObjectGetBoolean(data, "nospace", &nospace));
|
||||||
|
|
||||||
if ((actionID = qemuMonitorIOErrorActionTypeFromString(action)) < 0) {
|
if ((actionID = qemuMonitorIOErrorActionTypeFromString(action)) < 0) {
|
||||||
VIR_WARN("unknown disk io error action '%s'", action);
|
VIR_WARN("unknown disk io error action '%s'", action);
|
||||||
actionID = VIR_DOMAIN_EVENT_IO_ERROR_NONE;
|
actionID = VIR_DOMAIN_EVENT_IO_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuMonitorEmitIOError(mon, device, nodename, actionID, reason);
|
qemuMonitorEmitIOError(mon, device, nodename, actionID, nospace, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -827,7 +827,8 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
const char *device,
|
const char *device,
|
||||||
const char *nodename,
|
const char *nodename,
|
||||||
int action,
|
int action,
|
||||||
const char *reason)
|
bool nospace,
|
||||||
|
const char *reason G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv;
|
qemuDomainObjPrivate *priv;
|
||||||
virObjectEvent *ioErrorEvent = NULL;
|
virObjectEvent *ioErrorEvent = NULL;
|
||||||
@ -835,6 +836,7 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
virObjectEvent *lifecycleEvent = NULL;
|
virObjectEvent *lifecycleEvent = NULL;
|
||||||
const char *eventPath = "";
|
const char *eventPath = "";
|
||||||
const char *eventAlias = "";
|
const char *eventAlias = "";
|
||||||
|
const char *eventReason = "";
|
||||||
virDomainDiskDef *disk;
|
virDomainDiskDef *disk;
|
||||||
|
|
||||||
virObjectLock(vm);
|
virObjectLock(vm);
|
||||||
@ -852,8 +854,11 @@ qemuProcessHandleIOError(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
eventAlias = disk->info.alias;
|
eventAlias = disk->info.alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nospace)
|
||||||
|
eventReason = "enospc";
|
||||||
|
|
||||||
ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, eventPath, eventAlias, action);
|
ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, eventPath, eventAlias, action);
|
||||||
ioErrorEvent2 = virDomainEventIOErrorReasonNewFromObj(vm, eventPath, eventAlias, action, reason);
|
ioErrorEvent2 = virDomainEventIOErrorReasonNewFromObj(vm, eventPath, eventAlias, action, eventReason);
|
||||||
|
|
||||||
if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
|
if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
|
||||||
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
|
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user