]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBuildObjectCommandlineFromJSON: Remove checks for 'type' and 'alias'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 24 Sep 2021 16:43:35 +0000 (18:43 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Oct 2021 08:26:00 +0000 (10:26 +0200)
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>
src/qemu/qemu_command.c

index 7fe2cb73bfa98d40b6123f97037619a302d5ae96..91ec991517abf6d273f41a9fdce5d141a4cf87e7 100644 (file)
@@ -161,20 +161,12 @@ qemuBuildObjectCommandlineFromJSON(virCommand *cmd,
                                    virQEMUCaps *qemuCaps)
 {
     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 (!(arg = virJSONValueToString(props, false)))
             return -1;
     } else {
+        const char *type = virJSONValueObjectGetString(props, "qom-type");
         g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
         virBufferAsprintf(&buf, "%s,", type);