From patchwork Sun Feb 5 09:12:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ben@skyportsystems.com X-Patchwork-Id: 9556023 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 080A4602B1 for ; Sun, 5 Feb 2017 09:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECC3726E39 for ; Sun, 5 Feb 2017 09:18:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE8EC26490; Sun, 5 Feb 2017 09:18:55 +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 464A126490 for ; Sun, 5 Feb 2017 09:18:55 +0000 (UTC) Received: from localhost ([::1]:42360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caIyE-00079u-AB for patchwork-qemu-devel@patchwork.kernel.org; Sun, 05 Feb 2017 04:18:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caIsG-0002b4-EH for qemu-devel@nongnu.org; Sun, 05 Feb 2017 04:12:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1caIsF-0001sp-BR for qemu-devel@nongnu.org; Sun, 05 Feb 2017 04:12:44 -0500 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]:36736) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1caIsF-0001sk-5S for qemu-devel@nongnu.org; Sun, 05 Feb 2017 04:12:43 -0500 Received: by mail-pf0-x22c.google.com with SMTP id 189so16301528pfu.3 for ; Sun, 05 Feb 2017 01:12:43 -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=S1KOfFAWgPsLKUyJxXG0gJM8Qtvh8g7j7lyJlMs7QOg=; b=LGhIjbi+gZURLTm6wyCEEAKk5YNCtazRLoGm9usfInFFziPOFy+xmIqnjBsLrf6b/Q 1y2ybGuBd9a3kjx0taeEJkaFd+PbGRn/okeJffItMdTIUh5EXZ1bMij97VHeNAd5eGw2 Y5g01QW9Tz2g12yfKXuLcm1QLr/nub30oHCfA= 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=S1KOfFAWgPsLKUyJxXG0gJM8Qtvh8g7j7lyJlMs7QOg=; b=FfRq/LgHBVuL6tGQYiMck4muzpwMxvNtnw3lZ1+X03QVt2JtObRfcF2A468yMuFAlO x/5KNndi7FycpXoqwVs2zqluLIg6cRnrHv88hSNbnLPof9bRwtlVEn3pzaVTI6LsBnKa 98sF+sv80vXkuLCgrIFoUtZD3jo2lbXY/EODm+EWRzrwosrLqzpDeA+BbLpukAxhaBVp BL5fZOvjvwAY/0W21UXsLv76ebJfAojmiLby/KfA8O9T2X+i7kUXtIW1YpgeoL3c7ssJ yeduB5iLUQmJFxMMYAzDgKOprPFV0e0ddWjiKmOXq+3nmPFOmHZW4n70TrABnvJc4/2/ piNw== X-Gm-Message-State: AIkVDXKXxyPZZmLe9p64riFbq6fiqFTQCxmGgcq3RzhOPWsuuNcv8OaNn81BtlsjzDtmBaCx X-Received: by 10.99.232.5 with SMTP id s5mr6952223pgh.66.1486285962223; Sun, 05 Feb 2017 01:12:42 -0800 (PST) Received: from Arrow.corp.skyportsystems.com (76-236-31-201.lightspeed.sntcca.sbcglobal.net. [76.236.31.201]) by smtp.gmail.com with ESMTPSA id s24sm2347127pgo.25.2017.02.05.01.12.41 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 05 Feb 2017 01:12:41 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Sun, 5 Feb 2017 01:12:02 -0800 Message-Id: <755a17f2d8daf7d2a62b23bb8957c114a93ccf12.1486285434.git.ben@skyportsystems.com> 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:400e:c00::22c Subject: [Qemu-devel] [PATCH v5 07/10] 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: imammedo@redhat.com, lersek@redhat.com, Ben Warren , mst@redhat.com 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": { "guid": "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87" } } HMP command example: set-vm-generation-id guid=324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87 Signed-off-by: Igor Mammedov Reviewed-by: Eric Blake Signed-off-by: Ben Warren --- hmp-commands.hx | 13 +++++++++++++ hmp.c | 12 ++++++++++++ hmp.h | 1 + hw/acpi/vmgenid.c | 12 ++++++++++++ qapi-schema.json | 11 +++++++++++ stubs/vmgenid.c | 6 ++++++ 6 files changed, 55 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 8819281..56744aa 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1775,5 +1775,18 @@ ETEXI }, STEXI +@item set-vm-generation-id @var{uuid} +Set Virtual Machine Generation ID counter to @var{guid} +ETEXI + + { + .name = "set-vm-generation-id", + .args_type = "guid:s", + .params = "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 535613d..39c8965 100644 --- a/hmp.c +++ b/hmp.c @@ -2574,3 +2574,15 @@ 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"); + + qmp_set_vm_generation_id(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/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index e148051..af8b35c 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -224,3 +224,15 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp) info->guid = qemu_uuid_unparse_strdup(&guid); return info; } + +void qmp_set_vm_generation_id(const char *guid, Error **errp) +{ + Object *obj = find_vmgenid_dev(errp); + + if (!obj) { + return; + } + + object_property_set_str(obj, guid, VMGENID_GUID, errp); + return; +} diff --git a/qapi-schema.json b/qapi-schema.json index 384a7f3..ed2657d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -6051,3 +6051,14 @@ # Since 2.9 ## { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } + +## +# @set-vm-generation-id: +# +# Set Virtual Machine Generation ID +# +# @guid: new GUID to set as Virtual Machine Generation ID +# +# Since 2.9 +## +{ 'command': 'set-vm-generation-id', 'data': {'guid': 'str'} } diff --git a/stubs/vmgenid.c b/stubs/vmgenid.c index 8c448ac..d25d41b 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(const char *guid, Error **errp) +{ + error_setg(errp, "this command is not currently supported"); + return; +}