From: Roman Kagan <rkagan@virtuozzo.com>
To: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Ben Warren <ben@skyportsystems.com>
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Denis V. Lunev" <den@openvz.org>,
minyard@acm.org, "Daniel P. Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PATCH v2 2/2] vmgenid: use UUID property type
Date: Mon, 27 Nov 2017 16:05:18 +0300 [thread overview]
Message-ID: <20171127130518.26703-3-rkagan@virtuozzo.com> (raw)
In-Reply-To: <20171127130518.26703-1-rkagan@virtuozzo.com>
Switch vmgenid device to use the UUID property type introduced in the
previous patch for its 'guid' property.
One semantic change it introduces is that post-realize modification of
'guid' via HMP or QMP will now be rejected with an error; however,
according to docs/specs/vmgenid.txt this is actually desirable.
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
---
v1 -> v2:
- use the corresponding define for "guid" field name
hw/acpi/vmgenid.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c
index 105044f666..ba6f47b67b 100644
--- a/hw/acpi/vmgenid.c
+++ b/hw/acpi/vmgenid.c
@@ -162,21 +162,6 @@ static void vmgenid_update_guest(VmGenIdState *vms)
}
}
-static void vmgenid_set_guid(Object *obj, const char *value, Error **errp)
-{
- VmGenIdState *vms = VMGENID(obj);
-
- if (!strcmp(value, "auto")) {
- qemu_uuid_generate(&vms->guid);
- } else if (qemu_uuid_parse(value, &vms->guid) < 0) {
- error_setg(errp, "'%s. %s': Failed to parse GUID string: %s",
- object_get_typename(OBJECT(vms)), VMGENID_GUID, value);
- return;
- }
-
- vmgenid_update_guest(vms);
-}
-
/* After restoring an image, we need to update the guest memory and notify
* it of a potential change to VM Generation ID
*/
@@ -224,23 +209,24 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
}
qemu_register_reset(vmgenid_handle_reset, vms);
+
+ vmgenid_update_guest(vms);
}
+static Property vmgenid_device_properties[] = {
+ DEFINE_PROP_UUID(VMGENID_GUID, VmGenIdState, guid),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void vmgenid_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_vmgenid;
dc->realize = vmgenid_realize;
+ dc->props = vmgenid_device_properties;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
-
- object_class_property_add_str(klass, VMGENID_GUID, NULL,
- vmgenid_set_guid, NULL);
- object_class_property_set_description(klass, VMGENID_GUID,
- "Set Global Unique Identifier "
- "(big-endian) or auto for random value",
- NULL);
}
static const TypeInfo vmgenid_device_info = {
--
2.14.3
next prev parent reply other threads:[~2017-11-27 13:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 13:05 [Qemu-devel] [PATCH v2 0/2] add UUID property type Roman Kagan
2017-11-27 13:05 ` [Qemu-devel] [PATCH v2 1/2] qdev-properties: " Roman Kagan
2017-11-27 16:53 ` Marc-André Lureau
2017-11-27 13:05 ` Roman Kagan [this message]
2017-11-27 16:38 ` [Qemu-devel] [PATCH v2 2/2] vmgenid: use " Ben Warren
2017-11-28 8:02 ` Roman Kagan
2017-11-28 14:46 ` Michael S. Tsirkin
2017-11-27 16:52 ` Marc-André Lureau
2017-12-20 13:51 ` [Qemu-devel] [PATCH v2 0/2] add " Roman Kagan
2017-12-20 14:13 ` Michael S. Tsirkin
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=20171127130518.26703-3-rkagan@virtuozzo.com \
--to=rkagan@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=ben@skyportsystems.com \
--cc=berrange@redhat.com \
--cc=den@openvz.org \
--cc=imammedo@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=minyard@acm.org \
--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).