From patchwork Thu Jan 14 11:28:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 567329 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B10C814029E for ; Thu, 14 Jan 2016 22:32:53 +1100 (AEDT) Received: from localhost ([::1]:41499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJg95-0003Tp-OT for incoming@patchwork.ozlabs.org; Thu, 14 Jan 2016 06:32:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJg5d-0005Gn-G6 for qemu-devel@nongnu.org; Thu, 14 Jan 2016 06:29:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJg5Y-0007L2-GB for qemu-devel@nongnu.org; Thu, 14 Jan 2016 06:29:17 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:27250 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJg5Y-0007Kc-4U for qemu-devel@nongnu.org; Thu, 14 Jan 2016 06:29:12 -0500 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u0D67TFi010283; Wed, 13 Jan 2016 09:07:34 +0300 (MSK) From: "Denis V. Lunev" To: Date: Thu, 14 Jan 2016 14:28:55 +0300 Message-Id: <1452770941-21582-3-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452770941-21582-1-git-send-email-den@openvz.org> References: <1452770941-21582-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: Juan Quintela , qemu-devel@nongnu.org, Markus Armbruster , Amit Shah , "Denis V. Lunev" Subject: [Qemu-devel] [PATCH 2/8] qmp: create qmp_savevm command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 'name' attribute is made mandatory in distinction with HMP command. The patch also moves hmp_savevm 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 CC: Juan Quintela CC: Amit Shah CC: Markus Armbruster CC: Eric Blake --- hmp.c | 3 +-- include/migration/migration.h | 2 -- migration/savevm.c | 2 +- qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 25 +++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/hmp.c b/hmp.c index e7bab75..8d6eda6 100644 --- a/hmp.c +++ b/hmp.c @@ -33,7 +33,6 @@ #include "ui/console.h" #include "block/qapi.h" #include "qemu-io.h" -#include "migration/migration.h" #ifdef CONFIG_SPICE #include @@ -2406,7 +2405,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) name = name_buf; } - migrate_savevm(name, &local_err); + qmp_savevm(name, &local_err); if (local_err != NULL) { error_report_err(local_err); diff --git a/include/migration/migration.h b/include/migration/migration.h index 73c8bb1..58c04a9 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -277,8 +277,6 @@ int migrate_compress_threads(void); int migrate_decompress_threads(void); bool migrate_use_events(void); -void migrate_savevm(const char *name, Error **errp); - /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_message(MigrationIncomingState *mis, enum mig_rp_message_type message_type, diff --git a/migration/savevm.c b/migration/savevm.c index 308302a..0dbb15f 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1905,7 +1905,7 @@ int qemu_loadvm_state(QEMUFile *f) return ret; } -void migrate_savevm(const char *name, Error **errp) +void qmp_savevm(const char *name, Error **errp) { BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1; diff --git a/qapi-schema.json b/qapi-schema.json index 2e31733..09d1a1a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4054,3 +4054,16 @@ ## { 'enum': 'ReplayMode', 'data': [ 'none', 'record', 'play' ] } + +## +# @savevm +# +# Save a VM snapshot. Old snapshot with the same name will be deleted if exists. +# +# @name: identifier of a snapshot to be created +# +# Returns: Nothing on success +# +# Since 2.6 +## +{ 'command': 'savevm', 'data': {'name': 'str'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index db072a6..b7851e1 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -4795,3 +4795,28 @@ Example: {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3840, "pop-vlan": 1, "id": 251658240} ]} + +EQMP + +SQMP +savevm +------ + +Save a VM snapshot. Old snapshot with the same name will be deleted if exists. + +Arguments: + +- "name": snapshot name + +Example: + +-> { "execute": "savevm", "arguments": { "name": "snapshot1" } } +<- { "return": {} } + +EQMP + + { + .name = "savevm", + .args_type = "name:s", + .mhandler.cmd_new = qmp_marshal_savevm, + },