@@ -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
@@ -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;
+ }
+}
@@ -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
@@ -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;
@@ -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' } }
@@ -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": {}}
@@ -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;
+}
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(+)