The event is fired when the domain memory only dump completes.
Wire up the code to extract and send along the status.
Signed-off-by: John Ferlan <jferlan@redhat.com>
---
src/qemu/qemu_monitor.c | 18 ++++++++++++++++++
src/qemu/qemu_monitor.h | 19 +++++++++++++++++++
src/qemu/qemu_monitor_json.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fc146bdbf..031cd0a68 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -210,6 +210,10 @@ VIR_ENUM_IMPL(qemuMonitorBlockIOStatus,
QEMU_MONITOR_BLOCK_IO_STATUS_LAST,
"ok", "failed", "nospace")
+VIR_ENUM_IMPL(qemuMonitorDumpStatus,
+ QEMU_MONITOR_DUMP_STATUS_LAST,
+ "none", "active", "completed", "failed")
+
char *
qemuMonitorEscapeArg(const char *in)
{
@@ -1667,6 +1671,20 @@ qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
int
+qemuMonitorEmitDumpCompleted(qemuMonitorPtr mon,
+ qemuMonitorDumpStatus status)
+{
+ int ret = -1;
+
+ VIR_DEBUG("mon=%p", mon);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainDumpCompleted, mon->vm, status);
+
+ return ret;
+}
+
+
+int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
QEMU_CHECK_MONITOR(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 67b785e60..f2ac71071 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -246,6 +246,21 @@ typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon,
unsigned long long excess,
void *opaque);
+typedef enum {
+ QEMU_MONITOR_DUMP_STATUS_NONE,
+ QEMU_MONITOR_DUMP_STATUS_ACTIVE,
+ QEMU_MONITOR_DUMP_STATUS_COMPLETED,
+ QEMU_MONITOR_DUMP_STATUS_FAILED,
+
+ QEMU_MONITOR_DUMP_STATUS_LAST,
+} qemuMonitorDumpStatus;
+
+VIR_ENUM_DECL(qemuMonitorDumpStatus)
+
+typedef int (*qemuMonitorDomainDumpCompletedCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ qemuMonitorDumpStatus status,
+ void *opaque);
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
@@ -279,6 +294,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainMigrationPassCallback domainMigrationPass;
qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
+ qemuMonitorDomainDumpCompletedCallback domainDumpCompleted;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -408,6 +424,9 @@ int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
unsigned long long threshold,
unsigned long long excess);
+int qemuMonitorEmitDumpCompleted(qemuMonitorPtr mon,
+ qemuMonitorDumpStatus status);
+
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5ddd85575..169c01205 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -90,6 +90,7 @@ static void qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon, virJSONValu
static void qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr data);
+static void qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon, virJSONValuePtr data);
typedef struct {
const char *type;
@@ -106,6 +107,7 @@ static qemuEventHandler eventHandlers[] = {
{ "BLOCK_WRITE_THRESHOLD", qemuMonitorJSONHandleBlockThreshold, },
{ "DEVICE_DELETED", qemuMonitorJSONHandleDeviceDeleted, },
{ "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, },
+ { "DUMP_COMPLETED", qemuMonitorJSONHandleDumpCompleted, },
{ "GUEST_PANICKED", qemuMonitorJSONHandleGuestPanic, },
{ "MIGRATION", qemuMonitorJSONHandleMigrationStatus, },
{ "MIGRATION_PASS", qemuMonitorJSONHandleMigrationPass, },
@@ -1143,6 +1145,35 @@ qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr data)
}
+static void
+qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon,
+ virJSONValuePtr data)
+{
+ const char *statusstr;
+ qemuMonitorDumpStatus status;
+ virJSONValuePtr result;
+
+ if (!(result = virJSONValueObjectGetObject(data, "result"))) {
+ VIR_WARN("missing result in dump completed event");
+ return;
+ }
+
+ if (!(statusstr = virJSONValueObjectGetString(result, "status"))) {
+ VIR_WARN("missing status string in dump completed event");
+ return;
+ }
+
+ status = qemuMonitorDumpStatusTypeFromString(statusstr);
+ if (status < 0) {
+ VIR_WARN("invalid status string '%s' in dump completed event",
+ statusstr);
+ return;
+ }
+
+ qemuMonitorEmitDumpCompleted(mon, status);
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
--
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Jan 19, 2018 at 14:53:08 -0500, John Ferlan wrote: > The event is fired when the domain memory only dump completes. > > Wire up the code to extract and send along the status. > > Signed-off-by: John Ferlan <jferlan@redhat.com> > --- > src/qemu/qemu_monitor.c | 18 ++++++++++++++++++ > src/qemu/qemu_monitor.h | 19 +++++++++++++++++++ > src/qemu/qemu_monitor_json.c | 31 +++++++++++++++++++++++++++++++ > 3 files changed, 68 insertions(+) ... > +static void > +qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon, > + virJSONValuePtr data) > +{ > + const char *statusstr; > + qemuMonitorDumpStatus status; > + virJSONValuePtr result; > + > + if (!(result = virJSONValueObjectGetObject(data, "result"))) { > + VIR_WARN("missing result in dump completed event"); > + return; > + } > + > + if (!(statusstr = virJSONValueObjectGetString(result, "status"))) { > + VIR_WARN("missing status string in dump completed event"); > + return; > + } > + > + status = qemuMonitorDumpStatusTypeFromString(statusstr); > + if (status < 0) { > + VIR_WARN("invalid status string '%s' in dump completed event", > + statusstr); > + return; > + } > + > + qemuMonitorEmitDumpCompleted(mon, status); According to qapi-schema the DUMP_COMPLETED event may contain an error string. Don't we want to consume it here too? Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On 01/25/2018 11:59 AM, Jiri Denemark wrote: > On Fri, Jan 19, 2018 at 14:53:08 -0500, John Ferlan wrote: >> The event is fired when the domain memory only dump completes. >> >> Wire up the code to extract and send along the status. >> >> Signed-off-by: John Ferlan <jferlan@redhat.com> >> --- >> src/qemu/qemu_monitor.c | 18 ++++++++++++++++++ >> src/qemu/qemu_monitor.h | 19 +++++++++++++++++++ >> src/qemu/qemu_monitor_json.c | 31 +++++++++++++++++++++++++++++++ >> 3 files changed, 68 insertions(+) > ... >> +static void >> +qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon, >> + virJSONValuePtr data) >> +{ >> + const char *statusstr; >> + qemuMonitorDumpStatus status; >> + virJSONValuePtr result; >> + >> + if (!(result = virJSONValueObjectGetObject(data, "result"))) { >> + VIR_WARN("missing result in dump completed event"); >> + return; >> + } >> + >> + if (!(statusstr = virJSONValueObjectGetString(result, "status"))) { >> + VIR_WARN("missing status string in dump completed event"); >> + return; >> + } >> + >> + status = qemuMonitorDumpStatusTypeFromString(statusstr); >> + if (status < 0) { >> + VIR_WARN("invalid status string '%s' in dump completed event", >> + statusstr); >> + return; >> + } >> + >> + qemuMonitorEmitDumpCompleted(mon, status); > > According to qapi-schema the DUMP_COMPLETED event may contain an error > string. Don't we want to consume it here too? > > Jirka > We could I suppose, passing it back through like EmitBlockJob and BlockJobCallback. Once I page all this code back into short term memory (Nov. seems so long ago), I'll work through the other comments as well and post a new version. I'm trying to think about the common stats parser right now and how to handle errors as the dump completed event code would use VIR_WARN when failing to parse the result, but the query code would use virReportError Tks - John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Jan 26, 2018 at 08:43:38 -0500, John Ferlan wrote: > > > On 01/25/2018 11:59 AM, Jiri Denemark wrote: > > On Fri, Jan 19, 2018 at 14:53:08 -0500, John Ferlan wrote: > >> The event is fired when the domain memory only dump completes. > >> > >> Wire up the code to extract and send along the status. > >> > >> Signed-off-by: John Ferlan <jferlan@redhat.com> > >> --- > >> src/qemu/qemu_monitor.c | 18 ++++++++++++++++++ > >> src/qemu/qemu_monitor.h | 19 +++++++++++++++++++ > >> src/qemu/qemu_monitor_json.c | 31 +++++++++++++++++++++++++++++++ > >> 3 files changed, 68 insertions(+) ... > > According to qapi-schema the DUMP_COMPLETED event may contain an error > > string. Don't we want to consume it here too? > > We could I suppose, passing it back through like EmitBlockJob and > BlockJobCallback. I believe you wanted to say s/BlockJob/Dump/... > Once I page all this code back into short term memory (Nov. seems so > long ago), I'll work through the other comments as well and post a > new version. Yeah, sorry about the delayed review. More priority stuff (such as holiday and Spectre) appeared. > I'm trying to think about the common stats parser right now and how to > handle errors as the dump completed event code would use VIR_WARN when > failing to parse the result, but the query code would use virReportError I think you can just use virReportError and discard the error in the dump completed event code. Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.