From patchwork Mon Dec 19 22:46:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ben@skyportsystems.com X-Patchwork-Id: 9480835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24954607D3 for ; Mon, 19 Dec 2016 22:47:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15F9C27FAD for ; Mon, 19 Dec 2016 22:47:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AAF8284EC; Mon, 19 Dec 2016 22:47:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A1C85284E8 for ; Mon, 19 Dec 2016 22:47:20 +0000 (UTC) Received: from localhost ([::1]:48112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJ6iF-0004pX-QK for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Dec 2016 17:47:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJ6hg-0004o0-0q for qemu-devel@nongnu.org; Mon, 19 Dec 2016 17:46:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJ6he-0008Cf-SU for qemu-devel@nongnu.org; Mon, 19 Dec 2016 17:46:44 -0500 Received: from mail-it0-x231.google.com ([2607:f8b0:4001:c0b::231]:36967) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cJ6he-0008CZ-Nh for qemu-devel@nongnu.org; Mon, 19 Dec 2016 17:46:42 -0500 Received: by mail-it0-x231.google.com with SMTP id y23so96660880itc.0 for ; Mon, 19 Dec 2016 14:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=yHcKjUCA0jPmkmXAOp5+ADyka0vVCPhs6EfEQTr+vXg=; b=zeDzSDqQc6oMPNtEVqRPY/2oD5dPzh+pNtfalfuwJTDAnmhB27jqyYKPRL7+yo6pJ8 r2c/+zWqwCdAfD2ovmxo7ZiTrX8UkJCTmOg80wQIKqaKC2Yo2aurltEetG/hsIM2esZ+ nURDF0zwsBzxYjw7+jSexpCRnm3iiv8+1LjUU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=yHcKjUCA0jPmkmXAOp5+ADyka0vVCPhs6EfEQTr+vXg=; b=SRPbAXPD2J10IRffoTCI1urtWL336bp34GCCUHJcJ8soLzk1ehnH4uNyFJryAa7o+7 MS7tr5d2qWwnyDWYzPpySZzTV8hIGBGQ8irQjzo+q7nP4lMWsFmt9rL9UbBjhV04p4PZ pZLcQY/TZKWtAcT2RS9tErCesuHYHCAemE4OG/8LtPSztLie4MtQT0WonWY8PP/8zIvk sCfH2+EbjkTQjfIZLLPLd9JP3QU26kA2LckxtLSLniHxHRgRTVRq8KhIvWM3TjRg/BLr STvOexJleJDHR3iSQmZ7G2pUth0VN394/s1O5AMjv0h2sngNuBe5kjH2ZL7tKdpSy77h uieA== X-Gm-Message-State: AIkVDXLtUMRBZ9nBLWDCudOIZ1fZ1Gu1QD5keRqwlQchGTE6k98hJUdpnI0Qtm1QtKiXQg8z X-Received: by 10.36.46.132 with SMTP id i126mr4500727ita.44.1482187602034; Mon, 19 Dec 2016 14:46:42 -0800 (PST) Received: from Arrow.corp.skyportsystems.com (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id p20sm7773759itc.8.2016.12.19.14.46.41 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 19 Dec 2016 14:46:41 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Mon, 19 Dec 2016 14:46:34 -0800 Message-Id: X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::231 Subject: [Qemu-devel] [PATCH 5/5] qmp/hmp: add set-vm-generation-id commands X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Ben Warren Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Mammedov Add set-vm-generation-id command to set Virtual Machine Generation ID counter. QMP command example: { "execute": "set-vm-generation-id", "arguments": { "changed": true, "guid": "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87" } } HMP command example: set-vm-generation-id changed=true guid=324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87 Signed-off-by: Ben Warren Cc: Igor Mammedov Cc: Eric Blake --- hmp-commands.hx | 13 +++++++++++++ hmp.c | 13 +++++++++++++ hmp.h | 1 + qapi-schema.json | 12 ++++++++++++ stubs/vmgenid.c | 6 ++++++ 5 files changed, 45 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 8819281..495fc95 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1775,5 +1775,18 @@ ETEXI }, STEXI +@item set-vm-generation-id @var{changed} @var{uuid} +Set Virtual Machine Generation ID counter to @var{guid} +ETEXI + + { + .name = "set-vm-generation-id", + .args_type = "changed:b,guid:s", + .params = "changed guid", + .help = "Set Virtual Machine Generation ID counter", + .cmd = hmp_set_vm_generation_id, + }, + +STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index 9ec27ae..d73af31 100644 --- a/hmp.c +++ b/hmp.c @@ -2579,3 +2579,16 @@ void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) } qapi_free_GuidInfo(info); } + +void hmp_set_vm_generation_id(Monitor *mon, const QDict *qdict) +{ + Error *errp = NULL; + const char *guid = qdict_get_str(qdict, "guid"); + bool changed = qdict_get_bool(qdict, "changed"); + + qmp_set_vm_generation_id(changed, guid, &errp); + if (errp) { + hmp_handle_error(mon, &errp); + return; + } +} diff --git a/hmp.h b/hmp.h index 799fd37..e0ac1e8 100644 --- a/hmp.h +++ b/hmp.h @@ -138,5 +138,6 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict); void hmp_info_dump(Monitor *mon, const QDict *qdict); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); +void hmp_set_vm_generation_id(Monitor *mon, const QDict *qdict); #endif diff --git a/qapi-schema.json b/qapi-schema.json index 2348391..72f3515 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4796,3 +4796,15 @@ # Since 2.9 ## { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } + +## +# @set-vm-generation-id +# +# Set Virtual Machine Generation ID +# +# @changed: Is the Virtual Machine Generation ID a new value? +# @guid: new GUID to set as Virtual Machine Generation ID +# +# Since 2.9 +## +{ 'command': 'set-vm-generation-id', 'data': { 'changed': 'bool', 'guid': 'str' } } diff --git a/stubs/vmgenid.c b/stubs/vmgenid.c index 8c448ac..588aeb4 100644 --- a/stubs/vmgenid.c +++ b/stubs/vmgenid.c @@ -6,3 +6,9 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp) error_setg(errp, "this command is not currently supported"); return NULL; } + +void qmp_set_vm_generation_id(bool changed, const char *guid, Error **errp) +{ + error_setg(errp, "this command is not currently supported"); + return; +}