mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuBuildObjectCommandlineFromJSON: Remove checks for 'type' and 'alias'
We validate the generated props against the QMP schema which makes sure that the objects are generated properly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
cacfd540f0
commit
c6a9285925
@ -161,20 +161,12 @@ qemuBuildObjectCommandlineFromJSON(virCommand *cmd,
|
|||||||
virQEMUCaps *qemuCaps)
|
virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
g_autofree char *arg = NULL;
|
g_autofree char *arg = NULL;
|
||||||
const char *type = virJSONValueObjectGetString(props, "qom-type");
|
|
||||||
const char *alias = virJSONValueObjectGetString(props, "id");
|
|
||||||
|
|
||||||
if (!type || !alias) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("missing 'type'(%s) or 'alias'(%s) field of QOM 'object'"),
|
|
||||||
NULLSTR(type), NULLSTR(alias));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_JSON)) {
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_JSON)) {
|
||||||
if (!(arg = virJSONValueToString(props, false)))
|
if (!(arg = virJSONValueToString(props, false)))
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
const char *type = virJSONValueObjectGetString(props, "qom-type");
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virBufferAsprintf(&buf, "%s,", type);
|
virBufferAsprintf(&buf, "%s,", type);
|
||||||
|
Loading…
Reference in New Issue
Block a user