From: "Denis V. Lunev" <den@openvz.org>
Cc: Juan Quintela <quintela@redhat.com>,
qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Amit Shah <amit.shah@redhat.com>,
"Denis V. Lunev" <den@openvz.org>
Subject: [Qemu-devel] [PATCH 3/8] qmp: create qmp_delvm command
Date: Thu, 14 Jan 2016 14:28:56 +0300 [thread overview]
Message-ID: <1452770941-21582-4-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1452770941-21582-1-git-send-email-den@openvz.org>
The patch also moves hmp_delvm implementation into hmp.c. This function
is just a simple wrapper now and does not have knowledge about
migration internals.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Juan Quintela <quintela@redhat.com>
CC: Amit Shah <amit.shah@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Eric Blake <eblake@redhat.com>
---
hmp.c | 11 +++++++++++
migration/savevm.c | 16 +++++++---------
qapi-schema.json | 13 +++++++++++++
qmp-commands.hx | 23 +++++++++++++++++++++++
4 files changed, 54 insertions(+), 9 deletions(-)
diff --git a/hmp.c b/hmp.c
index 8d6eda6..f65bbe7 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2411,3 +2411,14 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
error_report_err(local_err);
}
}
+
+void hmp_delvm(Monitor *mon, const QDict *qdict)
+{
+ Error *local_err = NULL;
+
+ qmp_delvm(qdict_get_str(qdict, "name"), &local_err);
+
+ if (local_err != NULL) {
+ error_report_err(local_err);
+ }
+}
diff --git a/migration/savevm.c b/migration/savevm.c
index 0dbb15f..1262b57 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2092,17 +2092,15 @@ int load_vmstate(const char *name)
return 0;
}
-void hmp_delvm(Monitor *mon, const QDict *qdict)
+void qmp_delvm(const char *name, Error **errp)
{
BlockDriverState *bs;
- Error *err;
- const char *name = qdict_get_str(qdict, "name");
-
- if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
- monitor_printf(mon,
- "Error while deleting snapshot on device '%s': %s\n",
- bdrv_get_device_name(bs), error_get_pretty(err));
- error_free(err);
+ Error *local_err = NULL;
+
+ if (bdrv_all_delete_snapshot(name, &bs, &local_err) < 0) {
+ error_setg(errp, "Error while deleting snapshot on device '%s': %s",
+ bdrv_get_device_name(bs), error_get_pretty(local_err));
+ error_free(local_err);
}
}
diff --git a/qapi-schema.json b/qapi-schema.json
index 09d1a1a..94a2764 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4067,3 +4067,16 @@
# Since 2.6
##
{ 'command': 'savevm', 'data': {'name': 'str'} }
+
+##
+# @delvm
+#
+# Delete a VM snapshot
+#
+# @name: identifier of a snapshot to be deleted
+#
+# Returns: Nothing on success
+#
+# Since 2.6
+##
+{ 'command': 'delvm', 'data': {'name': 'str'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b7851e1..5e6f573 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -4820,3 +4820,26 @@ EQMP
.args_type = "name:s",
.mhandler.cmd_new = qmp_marshal_savevm,
},
+
+SQMP
+delvm
+-----
+
+Delete a VM snapshot
+
+Arguments:
+
+- "name": snapshot name
+
+Example:
+
+-> { "execute": "delvm", "arguments": { "name": "snapshot1" } }
+<- { "return": {} }
+
+EQMP
+
+ {
+ .name = "delvm",
+ .args_type = "name:s",
+ .mhandler.cmd_new = qmp_marshal_delvm,
+ },
--
2.5.0
next prev parent reply other threads:[~2016-01-14 11:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 11:28 [Qemu-devel] [PATCH v5 0/8] QMP wrappers for VM snapshot operations Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 1/8] migration: split hmp_savevm to migrate_savevm and hmp_savevm wrapper Denis V. Lunev
2016-01-18 15:47 ` Markus Armbruster
2016-01-18 16:00 ` Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 2/8] qmp: create qmp_savevm command Denis V. Lunev
2016-01-18 15:58 ` Markus Armbruster
2016-01-18 16:10 ` Denis V. Lunev
2016-01-19 18:11 ` Markus Armbruster
2016-01-22 8:01 ` Denis V. Lunev
2016-01-22 15:31 ` Markus Armbruster
2016-01-22 16:20 ` Denis V. Lunev
2016-01-26 12:56 ` Peter Krempa
2016-01-26 12:39 ` Peter Krempa
2016-01-14 11:28 ` Denis V. Lunev [this message]
2016-01-14 11:28 ` [Qemu-devel] [PATCH 4/8] migration: improve error reporting for load_vmstate Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 5/8] qmp: create QMP implementation of loadvm command Denis V. Lunev
2016-01-14 11:28 ` [Qemu-devel] [PATCH 6/8] migration, block: better select BDS for VM state loading Denis V. Lunev
2016-05-07 10:45 ` Denis V. Lunev
2016-01-14 11:29 ` [Qemu-devel] [PATCH 7/8] migration, qmp: add optional argument to specify BDS to save VM state to Denis V. Lunev
2016-01-14 11:29 ` [Qemu-devel] [PATCH 8/8] block: allow to skip block driver in selection of one for VM state saving Denis V. Lunev
2016-01-18 9:19 ` [Qemu-devel] [PATCH v6 " Denis V. Lunev
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=1452770941-21582-4-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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).