提交 38c2b707 编写于 作者: R Rafael Fonseca 提交者: Michal Privoznik

test: 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: NRafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 c286f2ab
...@@ -15715,18 +15715,10 @@ int ...@@ -15715,18 +15715,10 @@ int
virDomainVideoDefaultType(const virDomainDef *def) virDomainVideoDefaultType(const virDomainDef *def)
{ {
switch ((virDomainVirtType)def->virtType) { 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: case VIR_DOMAIN_VIRT_VBOX:
return VIR_DOMAIN_VIDEO_TYPE_VBOX; return VIR_DOMAIN_VIDEO_TYPE_VBOX;
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:
case VIR_DOMAIN_VIRT_PARALLELS: case VIR_DOMAIN_VIRT_PARALLELS:
......
...@@ -407,6 +407,28 @@ testDomainObjPrivateAlloc(void *opaque) ...@@ -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 static void
testDomainObjPrivateFree(void *data) testDomainObjPrivateFree(void *data)
{ {
...@@ -431,6 +453,7 @@ testDriverNew(void) ...@@ -431,6 +453,7 @@ testDriverNew(void)
VIR_DOMAIN_DEF_FEATURE_USER_ALIAS | VIR_DOMAIN_DEF_FEATURE_USER_ALIAS |
VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT | VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT |
VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING, VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
.devicesPostParseCallback = testDomainDevicesDefPostParse,
.defArch = VIR_ARCH_I686, .defArch = VIR_ARCH_I686,
}; };
virDomainXMLPrivateDataCallbacks privatecb = { virDomainXMLPrivateDataCallbacks privatecb = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册