The logic setting a device default should be in the post parse function of individual driver code. Signed-off-by: Rafael Fonseca <r4f4rfs@xxxxxxxxx> --- src/conf/domain_conf.c | 2 -- src/vbox/vbox_common.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 53fd13e80f..665bb10b27 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15716,8 +15716,6 @@ virDomainVideoDefaultType(const virDomainDef *def) { switch ((virDomainVirtType)def->virtType) { case VIR_DOMAIN_VIRT_VBOX: - return VIR_DOMAIN_VIDEO_TYPE_VBOX; - case VIR_DOMAIN_VIRT_TEST: case VIR_DOMAIN_VIRT_VMWARE: case VIR_DOMAIN_VIRT_VZ: diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 618663952a..e98ae04ec0 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -62,9 +62,25 @@ static virMutex vbox_driver_lock = VIR_MUTEX_INITIALIZER; static vboxDriverPtr vbox_driver; static vboxDriverPtr vboxDriverObjNew(void); +static int +vboxDomainDevicesDefPostParse(virDomainDeviceDefPtr dev G_GNUC_UNUSED, + const virDomainDef *def G_GNUC_UNUSED, + unsigned int parseFlags 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_VBOX; + } + + return 0; +} + static virDomainDefParserConfig vboxDomainDefParserConfig = { .macPrefix = { 0x08, 0x00, 0x27 }, .features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH, + .devicesPostParseCallback = vboxDomainDevicesDefPostParse, }; static virCapsPtr -- 2.25.1