From patchwork Thu Feb 16 06:18:15 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: 9576561 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 ADC136049F for ; Thu, 16 Feb 2017 06:29:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9449C28552 for ; Thu, 16 Feb 2017 06:29:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 858552855C; Thu, 16 Feb 2017 06:29:20 +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 A5BEE28552 for ; Thu, 16 Feb 2017 06:29:19 +0000 (UTC) Received: from localhost ([::1]:44845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceFZ7-0002gk-Sd for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Feb 2017 01:29:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceFOo-00013y-8I for qemu-devel@nongnu.org; Thu, 16 Feb 2017 01:18:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceFOn-0000SE-6a for qemu-devel@nongnu.org; Thu, 16 Feb 2017 01:18:38 -0500 Received: from mail-ot0-x235.google.com ([2607:f8b0:4003:c0f::235]:35199) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceFOn-0000Rm-2M for qemu-devel@nongnu.org; Thu, 16 Feb 2017 01:18:37 -0500 Received: by mail-ot0-x235.google.com with SMTP id 45so5258291otd.2 for ; Wed, 15 Feb 2017 22:18:37 -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=otwV5VxrxbaOfzNExIO+DOlNKjpLy9tIbfwy+UslX9o=; b=T5miYH6R9f1dJhVOJaqYCNYItM5L8EhD1XKP9EAufc3SsVZ6DVNaeCf16ILxGzZqIF puMI7Kp3PbafO5h7IJPrKwgHsprGNal78ga7wHhyppqi5f1e62/QI5wuhPCPVY8A7Fjb dyizdEctAFiP71ME+qiPknsMNaHXHCdZIT2zw= 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=otwV5VxrxbaOfzNExIO+DOlNKjpLy9tIbfwy+UslX9o=; b=suSPxGALn6fsyV4LTtzMazNJuyeWkHdtu9hBe9ymO7cWCA1TgbIzNKxIjW1WQtYbG5 q7n55Tw0z8s/zfTcWPjTDdTwjjritBBQfzzRJxmk60YIosj2SQKEpW1ivhiFZedFLalu iRSLux+j8bz322JcNZq+w7CR0fG9KJIUv477AlqXfTtdFdcGRIZDqGmluqMokCydGOAq omGsL2ZTv+5xT73hBW+I9zHvE0wWXQDD7xiG0KZ6IrUC1zsfIBca6apata21gNhhxo/w clvc9swbD2MyvLn+G7lNdthkOS9l/Ln7R3tRimKZT6X8XFw5yqwXxwGSjfM3zNo8pKXM djGw== X-Gm-Message-State: AMke39klT5OEs79Zrd0T2Ts3a+u6mY0ScWn+f/3JefLjH0xbwZ4UKjWXG00/xQAd6/7gu8Xc X-Received: by 10.157.44.150 with SMTP id p22mr307918otb.34.1487225916468; Wed, 15 Feb 2017 22:18:36 -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 c7sm2556036otb.55.2017.02.15.22.18.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 15 Feb 2017 22:18:35 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Wed, 15 Feb 2017 22:18:15 -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: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::235 Subject: [Qemu-devel] [PATCH v7 5/8] qmp/hmp: add query-vm-generation-id and 'info 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 commands to query Virtual Machine Generation ID counter. QMP command example: { "execute": "query-vm-generation-id" } HMP command example: info vm-generation-id Signed-off-by: Igor Mammedov Reviewed-by: Eric Blake Signed-off-by: Ben Warren Reviewed-by: Laszlo Ersek Tested-by: Laszlo Ersek --- hmp-commands-info.hx | 14 ++++++++++++++ hmp.c | 9 +++++++++ hmp.h | 1 + hw/acpi/vmgenid.c | 16 ++++++++++++++++ qapi-schema.json | 20 ++++++++++++++++++++ stubs/Makefile.objs | 1 + stubs/vmgenid.c | 9 +++++++++ 7 files changed, 70 insertions(+) create mode 100644 stubs/vmgenid.c diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index b0f35e6..a53f105 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -802,6 +802,20 @@ Show information about hotpluggable CPUs ETEXI STEXI +@item info vm-generation-id +@findex vm-generation-id +Show Virtual Machine Generation ID +ETEXI + + { + .name = "vm-generation-id", + .args_type = "", + .params = "", + .help = "Show Virtual Machine Generation ID", + .cmd = hmp_info_vm_generation_id, + }, + +STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index 2bc4f06..535613d 100644 --- a/hmp.c +++ b/hmp.c @@ -2565,3 +2565,12 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) qapi_free_HotpluggableCPUList(saved); } + +void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) +{ + GuidInfo *info = qmp_query_vm_generation_id(NULL); + if (info) { + monitor_printf(mon, "%s\n", info->guid); + } + qapi_free_GuidInfo(info); +} diff --git a/hmp.h b/hmp.h index 05daf7c..799fd37 100644 --- a/hmp.h +++ b/hmp.h @@ -137,5 +137,6 @@ void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict); 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); #endif diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index 8fba7e0..9f97b72 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -237,3 +237,19 @@ static void vmgenid_register_types(void) } type_init(vmgenid_register_types) + +GuidInfo *qmp_query_vm_generation_id(Error **errp) +{ + GuidInfo *info; + VmGenIdState *vms; + Object *obj = find_vmgenid_dev(); + + if (!obj) { + return NULL; + } + vms = VMGENID(obj); + + info = g_malloc0(sizeof(*info)); + info->guid = qemu_uuid_unparse_strdup(&vms->guid); + return info; +} diff --git a/qapi-schema.json b/qapi-schema.json index 5edb08d..396e49c 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -6056,3 +6056,23 @@ # ## { 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'] } + +## +# @GuidInfo: +# +# GUID information. +# +# @guid: the globally unique identifier +# +# Since: 2.9 +## +{ 'struct': 'GuidInfo', 'data': {'guid': 'str'} } + +## +# @query-vm-generation-id: +# +# Show Virtual Machine Generation ID +# +# Since 2.9 +## +{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index a187295..0bffca6 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -35,3 +35,4 @@ stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o stub-obj-y += pc_madt_cpu_entry.o +stub-obj-y += vmgenid.o diff --git a/stubs/vmgenid.c b/stubs/vmgenid.c new file mode 100644 index 0000000..c64eb7a --- /dev/null +++ b/stubs/vmgenid.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "qmp-commands.h" +#include "qapi/qmp/qerror.h" + +GuidInfo *qmp_query_vm_generation_id(Error **errp) +{ + error_setg(errp, QERR_UNSUPPORTED); + return NULL; +}