qom: Check for wellformed id in user_creatable_add_type()
commit0bd5a2eb7927189c40ca5394079b1c0e88cea7cb
authorKevin Wolf <kwolf@redhat.com>
Tue, 2 Mar 2021 17:16:23 +0000 (2 18:16 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 6 Mar 2021 10:41:54 +0000 (6 11:41 +0100)
treeb01912b68d966eb06cbe3ac6489563f430141012
parenta9b1315f86d9323587b340bd3bf83b9d66a55563
qom: Check for wellformed id in user_creatable_add_type()

Most code paths for creating a user creatable object go through
QemuOpts, which ensures that the provided 'id' option is actually a
valid identifier.

However, there are some code paths that don't go through QemuOpts:
qemu-storage-daemon --object (since commit 8db1efd3) and QMP object-add
(since it was first introduced in commit cff8b2c6). We need to have the
same validity check for those, too.

This adds the check and makes it print the same error message as
QemuOpts on failure.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210302171623.49709-1-kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qom/object_interfaces.c