]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBuildHostdevMediatedDevProps: Format 'ramfb' only when enabled
authorPeter Krempa <pkrempa@redhat.com>
Thu, 18 Nov 2021 08:23:09 +0000 (09:23 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 19 Nov 2021 11:40:41 +0000 (12:40 +0100)
Before commit 73c352ab8c97d3 which converted the hostdev commandline
formatter to JSON the 'ramfb' property was formatted only if it was
enabled.

The main reason for that is that enabling 'ramfb' switches the device
model to 'vfio-pci-nohotplug' which actually has the property, while
'vfio-pci' (used when 'ramfb' is disabled or absent) doesn't have it.

Restore the logic to format 'ramfb' only when it's enabled and add a
comment that it's deliberate.

Fixes: 73c352ab8c97d3
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024435
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index 623e3a20a9ce7bf3cf1d769849f524c1378d90f2..3108bdd5813a8bafced33084a32e839480aed0a3 100644 (file)
@@ -5331,6 +5331,8 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def,
     g_autoptr(virJSONValue) props = NULL;
     virDomainHostdevSubsysMediatedDev *mdevsrc = &dev->source.subsys.u.mdev;
     g_autofree char *mdevPath = NULL;
+    /* 'ramfb' property must be omitted unless it's to be enabled */
+    bool ramfb = mdevsrc->ramfb == VIR_TRISTATE_SWITCH_ON;
 
     mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr);
 
@@ -5339,7 +5341,7 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def,
                               "s:id", dev->info->alias,
                               "s:sysfsdev", mdevPath,
                               "S:display", qemuOnOffAuto(mdevsrc->display),
-                              "T:ramfb", mdevsrc->ramfb,
+                              "B:ramfb", ramfb,
                               "p:bootindex", dev->info->bootIndex,
                               NULL) < 0)
         return NULL;