vbox: 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 <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Rafael Fonseca 2020-03-24 17:14:35 +01:00 committed by Michal Privoznik
parent 38c2b707c1
commit 0b9d2287ed
2 changed files with 16 additions and 2 deletions

View File

@ -15716,8 +15716,6 @@ virDomainVideoDefaultType(const virDomainDef *def)
{ {
switch ((virDomainVirtType)def->virtType) { switch ((virDomainVirtType)def->virtType) {
case VIR_DOMAIN_VIRT_VBOX: case VIR_DOMAIN_VIRT_VBOX:
return VIR_DOMAIN_VIDEO_TYPE_VBOX;
case VIR_DOMAIN_VIRT_TEST: case VIR_DOMAIN_VIRT_TEST:
case VIR_DOMAIN_VIRT_VMWARE: case VIR_DOMAIN_VIRT_VMWARE:
case VIR_DOMAIN_VIRT_VZ: case VIR_DOMAIN_VIRT_VZ:

View File

@ -62,9 +62,25 @@ static virMutex vbox_driver_lock = VIR_MUTEX_INITIALIZER;
static vboxDriverPtr vbox_driver; static vboxDriverPtr vbox_driver;
static vboxDriverPtr vboxDriverObjNew(void); 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 = { static virDomainDefParserConfig vboxDomainDefParserConfig = {
.macPrefix = { 0x08, 0x00, 0x27 }, .macPrefix = { 0x08, 0x00, 0x27 },
.features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH, .features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH,
.devicesPostParseCallback = vboxDomainDevicesDefPostParse,
}; };
static virCapsPtr static virCapsPtr