[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/25] vmgenid: use UUID property type
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 03/25] vmgenid: use UUID property type |
Date: |
Thu, 21 Dec 2017 16:28:08 +0200 |
From: Roman Kagan <address@hidden>
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 <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Ben Warren <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
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 105044f..ba6f47b 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 = {
--
MST
- [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 01/25] smbios: support setting OEM strings table, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 02/25] qdev-properties: add UUID property type, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 03/25] vmgenid: use UUID property type,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 04/25] tests: add test to check VirtQueue object, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 05/25] pci: Rename root bus initialization functions for clarity, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 06/25] pci: Move bridge data structures from pci_bus.h to pci_bridge.h, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 07/25] pci: Add pci_dev_bus_num() helper, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 10/25] virtio_error: don't invoke status callbacks, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 09/25] pci: Eliminate pci_find_primary_bus(), Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 11/25] tests/pxe-test: Remove unnecessary special case test functions, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 14/25] tests/pxe-test: Add some extra tests, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 08/25] pci: Eliminate redundant PCIDevice::bus pointer, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 12/25] tests/pxe-test: Use table of testcases rather than open-coding, Michael S. Tsirkin, 2017/12/21