Message ID | 20171127130518.26703-3-rkagan@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
It looks like you dropped Marc-André and my Reviewed-by lines. Please put them back. > On Nov 27, 2017, at 5:05 AM, Roman Kagan <rkagan@virtuozzo.com> wrote: > > 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 >
On Mon, Nov 27, 2017 at 2:05 PM, Roman Kagan <rkagan@virtuozzo.com> wrote: > 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> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.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 > >
On Mon, Nov 27, 2017 at 08:38:41AM -0800, Ben Warren wrote:
> It looks like you dropped Marc-André and my Reviewed-by lines. Please put them back.
Oops. I thought that the amount of changes in the first patch was too
big to keep the R-b; however, the second patch was basically the same so
I should have put the R-b and save you extra work re-reviewing it.
Sorry about that; hope the maintainer who will pick the patches will
take care of R-b (unless I get more feedback that will make me respin the
set).
Roman.
On Tue, Nov 28, 2017 at 11:02:13AM +0300, Roman Kagan wrote: > On Mon, Nov 27, 2017 at 08:38:41AM -0800, Ben Warren wrote: > > It looks like you dropped Marc-André and my Reviewed-by lines. Please put them back. > > Oops. I thought that the amount of changes in the first patch was too > big to keep the R-b; however, the second patch was basically the same so > I should have put the R-b and save you extra work re-reviewing it. > Sorry about that; hope the maintainer who will pick the patches will > take care of R-b (unless I get more feedback that will make me respin the > set). > > Roman. Nope, I don't have the time to mangle patches manually, but people can ack series, or you can reply to patch youself with some else's ack.
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 = {
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(-)