diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 53bc791e1082388be8477abceecfc59a39187941..53fd13e80ff9db233f7de46fd5e2d631bc5b7448 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15715,18 +15715,10 @@ int virDomainVideoDefaultType(const virDomainDef *def) { switch ((virDomainVirtType)def->virtType) { - case VIR_DOMAIN_VIRT_TEST: - if (def->os.type == VIR_DOMAIN_OSTYPE_XEN || - def->os.type == VIR_DOMAIN_OSTYPE_LINUX) - return VIR_DOMAIN_VIDEO_TYPE_XEN; - else if (ARCH_IS_PPC64(def->os.arch)) - return VIR_DOMAIN_VIDEO_TYPE_VGA; - else - return VIR_DOMAIN_VIDEO_TYPE_CIRRUS; - 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: case VIR_DOMAIN_VIRT_PARALLELS: diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 73fe1ad6ce1ae852d80834049ad01d995012036d..7759847c2d1a00266df63b024afb2faf98f8ddb8 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -407,6 +407,28 @@ testDomainObjPrivateAlloc(void *opaque) } +static int +testDomainDevicesDefPostParse(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) { + if (def->os.type == VIR_DOMAIN_OSTYPE_XEN || + def->os.type == VIR_DOMAIN_OSTYPE_LINUX) + dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_XEN; + else if (ARCH_IS_PPC64(def->os.arch)) + dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VGA; + else + dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_CIRRUS; + } + + return 0; +} + + static void testDomainObjPrivateFree(void *data) { @@ -431,6 +453,7 @@ testDriverNew(void) VIR_DOMAIN_DEF_FEATURE_USER_ALIAS | VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT | VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING, + .devicesPostParseCallback = testDomainDevicesDefPostParse, .defArch = VIR_ARCH_I686, }; virDomainXMLPrivateDataCallbacks privatecb = {