From: Hogan Wang via <qemu-devel@nongnu.org>
To: <kwolf@redhat.com>, <berrange@redhat.com>, <armbru@redhat.com>,
<marcandre.lureau@redhat.com>, <qemu-devel@nongnu.org>
Cc: <wangxinxin.wang@huawei.com>, <hogan.wang@huawei.com>
Subject: [PATCH v5 2/3] job: introduce dump guest memory job
Date: Tue, 2 Aug 2022 10:53:04 +0800 [thread overview]
Message-ID: <20220802025305.3452-2-hogan.wang@huawei.com> (raw)
In-Reply-To: <20220802025305.3452-1-hogan.wang@huawei.com>
There's no way to cancel the current executing dump process, lead to the
virtual machine manager daemon((e.g. libvirtd) cannot restore the dump
job after daemon restart.
Introduce dump guest memory job type, and add an optional 'job-id'
argument for dump-guest-memory QMP to make use of jobs framework.
Signed-off-by: Hogan Wang <hogan.wang@huawei.com>
---
dump/dump-hmp-cmds.c | 7 ++++---
dump/dump.c | 1 +
qapi/dump.json | 11 +++++++++--
qapi/job.json | 5 ++++-
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c
index e5053b04cd..a77f31fd15 100644
--- a/dump/dump-hmp-cmds.c
+++ b/dump/dump-hmp-cmds.c
@@ -21,6 +21,7 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
bool lzo = qdict_get_try_bool(qdict, "lzo", false);
bool snappy = qdict_get_try_bool(qdict, "snappy", false);
const char *file = qdict_get_str(qdict, "filename");
+ const char *job_id = qdict_get_str(qdict, "job-id");
bool has_begin = qdict_haskey(qdict, "begin");
bool has_length = qdict_haskey(qdict, "length");
bool has_detach = qdict_haskey(qdict, "detach");
@@ -63,9 +64,9 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
}
prot = g_strconcat("file:", file, NULL);
-
- qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
- has_length, length, true, dump_format, &err);
+ qmp_dump_guest_memory(paging, prot, !!job_id, job_id, true,
+ detach, has_begin, begin, has_length,
+ length, true, dump_format, &err);
hmp_handle_error(mon, err);
g_free(prot);
}
diff --git a/dump/dump.c b/dump/dump.c
index a57c580b12..cec9be30b4 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -1895,6 +1895,7 @@ DumpQueryResult *qmp_query_dump(Error **errp)
}
void qmp_dump_guest_memory(bool paging, const char *file,
+ bool has_job_id, const char *job_id,
bool has_detach, bool detach,
bool has_begin, int64_t begin, bool has_length,
int64_t length, bool has_format,
diff --git a/qapi/dump.json b/qapi/dump.json
index 90859c5483..ca3bd720c6 100644
--- a/qapi/dump.json
+++ b/qapi/dump.json
@@ -59,9 +59,15 @@
# 2. fd: the protocol starts with "fd:", and the following string
# is the fd's name.
#
+# @job-id: identifier for the newly-created memory dump job. If you want to
+# compatible with legacy dumping process, @job-id should omitted.
+# If @job-id specified, gain the ability to monitor and control dump
+# task with query-job, job-cancel, etc.(Since 7.2).
+#
# @detach: if true, QMP will return immediately rather than
# waiting for the dump to finish. The user can track progress
-# using "query-dump". (since 2.6).
+# using "query-dump". (since 2.6). If @job-id specified, @detach
+# argument value will be ignored (Since 7.2).
#
# @begin: if specified, the starting physical address.
#
@@ -88,7 +94,8 @@
#
##
{ 'command': 'dump-guest-memory',
- 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
+ 'data': { 'paging': 'bool', 'protocol': 'str',
+ '*job-id': 'str', '*detach': 'bool',
'*begin': 'int', '*length': 'int',
'*format': 'DumpGuestMemoryFormat'} }
diff --git a/qapi/job.json b/qapi/job.json
index d5f84e9615..e14d2290a5 100644
--- a/qapi/job.json
+++ b/qapi/job.json
@@ -28,11 +28,14 @@
#
# @snapshot-delete: snapshot delete job type, see "snapshot-delete" (since 6.0)
#
+# @dump-guest-memory: dump guest memory job type, see "dump-guest-memory" (since 7.2)
+#
# Since: 1.7
##
{ 'enum': 'JobType',
'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend',
- 'snapshot-load', 'snapshot-save', 'snapshot-delete'] }
+ 'snapshot-load', 'snapshot-save', 'snapshot-delete',
+ 'dump-guest-memory'] }
##
# @JobStatus:
--
2.33.0
next prev parent reply other threads:[~2022-08-02 2:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 2:53 [PATCH v5 1/3] dump: support cancel dump process Hogan Wang via
2022-08-02 2:53 ` Hogan Wang via [this message]
2022-08-02 7:12 ` [PATCH v5 2/3] job: introduce dump guest memory job Markus Armbruster
2022-08-02 2:53 ` [PATCH v5 3/3] dump: use jobs framework for dump guest memory Hogan Wang via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220802025305.3452-2-hogan.wang@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=hogan.wang@huawei.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=wangxinxin.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).