The logic setting a device default should be in the post parse function
of individual driver code.
Signed-off-by: Rafael Fonseca <r4f4rfs(a)gmail.com>
---
src/conf/domain_conf.c | 4 ----
src/openvz/openvz_conf.c | 8 ++++++++
src/vz/vz_driver.c | 8 ++++++++
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 04636e8694..e6a3500b7a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15732,10 +15732,6 @@ virDomainVideoDefaultType(const virDomainDef *def)
case VIR_DOMAIN_VIRT_VZ:
case VIR_DOMAIN_VIRT_PARALLELS:
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
- return VIR_DOMAIN_VIDEO_TYPE_VGA;
- else
- return VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
case VIR_DOMAIN_VIRT_XEN:
case VIR_DOMAIN_VIRT_BHYVE:
case VIR_DOMAIN_VIRT_QEMU:
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 1d60afae93..78547b8b28 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -1117,6 +1117,14 @@ openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
return -1;
}
+ if (dev->type == VIR_DOMAIN_DEVICE_VIDEO &&
+ dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
+ if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
+ dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VGA;
+ else
+ dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
+ }
+
return 0;
}
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 6605247dd9..d882b91def 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -281,6 +281,14 @@ vzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
def->os.type == VIR_DOMAIN_OSTYPE_HVM)
dev->data.net->model = VIR_DOMAIN_NET_MODEL_E1000;
+ if (dev->type == VIR_DOMAIN_DEVICE_VIDEO &&
+ dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
+ if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
+ dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VGA;
+ else
+ dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
+ }
+
return 0;
}
--
2.25.1