From c286f2abe01a62668166e98ae7c263fbbbb0def8 Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Tue, 24 Mar 2020 17:14:33 +0100 Subject: [PATCH] vmx: vmware: move video default logic to driver The logic setting a device default should be in the post parse function of individual driver code. Signed-off-by: Rafael Fonseca Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 2 -- src/vmware/vmware_driver.c | 4 ++++ src/vmx/vmx.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e6a3500b7a..53bc791e10 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15728,8 +15728,6 @@ virDomainVideoDefaultType(const virDomainDef *def) return VIR_DOMAIN_VIDEO_TYPE_VBOX; case VIR_DOMAIN_VIRT_VMWARE: - return VIR_DOMAIN_VIDEO_TYPE_VMVGA; - case VIR_DOMAIN_VIRT_VZ: case VIR_DOMAIN_VIRT_PARALLELS: case VIR_DOMAIN_VIRT_XEN: diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 32c81b13a0..d5dd6e4f5e 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -137,6 +137,10 @@ vmwareDomainDeviceDefPostParse(virDomainDeviceDefPtr dev G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED, void *parseOpaque G_GNUC_UNUSED) { + if (dev->type == VIR_DOMAIN_DEVICE_VIDEO && + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) + dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VMVGA; + return 0; } diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 6c6ef7acf3..b1fd1181eb 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -548,6 +548,10 @@ virVMXDomainDevicesDefPostParse(virDomainDeviceDefPtr dev G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED, void *parseOpaque G_GNUC_UNUSED) { + if (dev->type == VIR_DOMAIN_DEVICE_VIDEO && + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) + dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VMVGA; + return 0; }