From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, mst@redhat.com, ghammer@redhat.com,
lersek@redhat.com, lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH v19 6/9] qmp/hmp: add set-vm-generation-id commands
Date: Thu, 28 Jan 2016 11:54:28 +0100 [thread overview]
Message-ID: <1453978470-222624-7-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1453978470-222624-1-git-send-email-imammedo@redhat.com>
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 324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v18:
- use new GuidInfo type introduced in previous patch and fix
argument to lowercase and corresponding example.
Eric Blake <eblake@redhat.com>
- s/if (errp != NULL)/if (errp)/
Eric Blake <eblake@redhat.com>
---
hmp-commands.hx | 13 +++++++++++++
hmp.c | 12 ++++++++++++
hmp.h | 1 +
hw/misc/vmgenid.c | 11 +++++++++++
qapi-schema.json | 11 +++++++++++
qmp-commands.hx | 22 ++++++++++++++++++++++
stubs/vmgenid.c | 6 ++++++
7 files changed, 76 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index bb52e4d..d310707 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1756,5 +1756,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",
+ .mhandler.cmd = hmp_set_vm_generation_id,
+ },
+
+STEXI
@end table
ETEXI
diff --git a/hmp.c b/hmp.c
index aeb753d..c1f3a7a 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2384,3 +2384,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 21c5132..cbf2045 100644
--- a/hmp.h
+++ b/hmp.h
@@ -132,5 +132,6 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict);
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_vm_generation_id(Monitor *mon, const QDict *qdict);
+void hmp_set_vm_generation_id(Monitor *mon, const QDict *qdict);
#endif
diff --git a/hw/misc/vmgenid.c b/hw/misc/vmgenid.c
index 24c0a4e..4fa52bc 100644
--- a/hw/misc/vmgenid.c
+++ b/hw/misc/vmgenid.c
@@ -58,6 +58,17 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp)
return info;
}
+void qmp_set_vm_generation_id(const char *guid, Error **errp)
+{
+ Object *obj = find_vmgneid_dev(errp);
+
+ if (!obj) {
+ return;
+ }
+
+ object_property_set_str(obj, guid, VMGENID_GUID, errp);
+}
+
static void vmgenid_update_guest(VmGenIdState *s)
{
Object *acpi_obj;
diff --git a/qapi-schema.json b/qapi-schema.json
index 3f99549..770d451 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4103,3 +4103,14 @@
# Since 2.6
##
{ '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.6
+##
+{ 'command': 'set-vm-generation-id', 'data': { 'guid': 'str' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 38e4e16..84738c7 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -4814,3 +4814,25 @@ Example:
-> { "execute": "query-vm-generation-id" }
<- {"return": {"guid": "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87"}}
+
+EQMP
+
+ {
+ .name = "set-vm-generation-id",
+ .args_type = "guid:s",
+ .mhandler.cmd_new = qmp_marshal_set_vm_generation_id,
+ },
+
+SQMP
+Set Virtual Machine Generation ID counter
+-----
+
+Arguments:
+
+- "guid": counter ID in GUID string representation (json-string)"
+
+Example:
+
+-> { "execute": "set-vm-generation-id" ,
+ "arguments": { "guid": "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87" } }
+<- {"return": {}}
diff --git a/stubs/vmgenid.c b/stubs/vmgenid.c
index 1ff8cd2..6af0b73 100644
--- a/stubs/vmgenid.c
+++ b/stubs/vmgenid.c
@@ -5,3 +5,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;
+}
--
1.8.3.1
next prev parent reply other threads:[~2016-01-28 10:54 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 10:54 [Qemu-devel] [PATCH v19 0/9] Virtual Machine Generation ID Igor Mammedov
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 1/9] acpi: extend ACPI interface to provide access to ACPI registers and SCI irq Igor Mammedov
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 2/9] docs: vm generation id device's description Igor Mammedov
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 3/9] pc: add a Virtual Machine Generation ID device Igor Mammedov
2016-01-28 11:13 ` Michael S. Tsirkin
2016-01-28 12:03 ` Igor Mammedov
2016-01-28 12:59 ` Michael S. Tsirkin
2016-01-29 11:13 ` Igor Mammedov
2016-01-31 16:22 ` Michael S. Tsirkin
2016-02-02 9:59 ` Igor Mammedov
2016-02-02 11:16 ` Michael S. Tsirkin
2016-02-09 10:46 ` Igor Mammedov
2016-02-09 12:17 ` Michael S. Tsirkin
2016-02-11 15:16 ` Igor Mammedov
2016-02-11 16:30 ` Michael S. Tsirkin
2016-02-11 17:34 ` Marcel Apfelbaum
2016-02-12 6:15 ` Michael S. Tsirkin
2016-02-15 10:30 ` Igor Mammedov
2016-02-15 11:26 ` Michael S. Tsirkin
2016-02-15 13:56 ` Igor Mammedov
2016-02-16 10:05 ` Marcel Apfelbaum
2016-02-16 12:17 ` Igor Mammedov
2016-02-16 12:36 ` Marcel Apfelbaum
2016-02-16 13:51 ` Igor Mammedov
2016-02-16 14:53 ` Michael S. Tsirkin
2016-02-16 15:10 ` Michael S. Tsirkin
2016-02-10 8:51 ` Michael S. Tsirkin
2016-02-10 9:28 ` Michael S. Tsirkin
2016-02-10 10:00 ` Laszlo Ersek
2016-01-28 13:48 ` Laszlo Ersek
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 4/9] tests: add a unit test for the vmgenid device Igor Mammedov
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 5/9] qmp/hmp: add query-vm-generation-id and 'info vm-generation-id' commands Igor Mammedov
2016-02-09 17:31 ` Eric Blake
2016-01-28 10:54 ` Igor Mammedov [this message]
2016-02-09 17:33 ` [Qemu-devel] [PATCH v19 6/9] qmp/hmp: add set-vm-generation-id commands Eric Blake
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 8/9] pc: put PIIX3 in slot 1 explicitly and cleanup functions assignment Igor Mammedov
2016-01-28 10:54 ` [Qemu-devel] [PATCH v19 9/9] pc/q53: by default put vmgenid device as an function of ISA bridge Igor Mammedov
2016-01-28 10:58 ` [Qemu-devel] [PATCH v19 7/9] machine: add properties to compat_props incrementaly Igor Mammedov
2016-01-28 14:02 ` Eduardo Habkost
2016-01-28 17:00 ` Igor Mammedov
2016-02-03 17:55 ` [Qemu-devel] qdev & hw/core owner? (was Re: [PATCH v19 7/9] machine: add properties to compat_props incrementaly) Eduardo Habkost
2016-02-03 18:46 ` Laszlo Ersek
2016-02-03 19:06 ` Michael S. Tsirkin
2016-02-04 11:31 ` Paolo Bonzini
2016-02-04 11:41 ` Andreas Färber
2016-02-04 11:55 ` Paolo Bonzini
2016-02-04 12:06 ` Michael S. Tsirkin
2016-02-05 7:49 ` Markus Armbruster
2016-02-05 7:51 ` Marcel Apfelbaum
2016-02-11 19:41 ` Eduardo Habkost
2016-02-12 9:17 ` Marcel Apfelbaum
2016-02-12 11:22 ` Andreas Färber
2016-02-12 18:17 ` Eduardo Habkost
2016-02-12 22:30 ` Paolo Bonzini
2016-02-12 18:09 ` Eduardo Habkost
2016-02-05 7:52 ` Markus Armbruster
2016-02-04 12:03 ` Michael S. Tsirkin
2016-02-04 12:12 ` Marcel Apfelbaum
2016-01-29 12:51 ` [Qemu-devel] [PATCH v19 7/9] machine: add properties to compat_props incrementaly Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453978470-222624-7-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=ghammer@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).