From 39164c136cbab57385e15297423fe85ef386c76f Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 16 Feb 2017 15:15:37 -0800 Subject: qmp/hmp: add query-vm-generation-id and 'info vm-generation-id' commands 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/vmgenid.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'hw/acpi/vmgenid.c') diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index c8465df790..744f2847da 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -240,3 +240,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; +} -- cgit v1.2.3