Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/domain_conf.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b794200e47..4cfdfb230e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4900,6 +4900,23 @@ virDomainDiskDefPostParse(virDomainDiskDefPtr disk,
}
+static int
+virDomainVideoDefPostParse(virDomainVideoDefPtr video,
+ const virDomainDef *def)
+{
+ /* Fill out (V)RAM if the driver-specific callback did not do so */
+ if (video->ram == 0 && video->type == VIR_DOMAIN_VIDEO_TYPE_QXL)
+ video->ram = virDomainVideoDefaultRAM(def, video->type);
+ if (video->vram == 0)
+ video->vram = virDomainVideoDefaultRAM(def, video->type);
+
+ video->ram = VIR_ROUND_UP_POWER_OF_TWO(video->ram);
+ video->vram = VIR_ROUND_UP_POWER_OF_TWO(video->vram);
+
+ return 0;
+}
+
+
static int
virDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
{
@@ -4930,17 +4947,8 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_DISK)
return virDomainDiskDefPostParse(dev->data.disk, def, xmlopt);
- if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
- virDomainVideoDefPtr video = dev->data.video;
- /* Fill out (V)RAM if the driver-specific callback did not do so */
- if (video->ram == 0 && video->type == VIR_DOMAIN_VIDEO_TYPE_QXL)
- video->ram = virDomainVideoDefaultRAM(def, video->type);
- if (video->vram == 0)
- video->vram = virDomainVideoDefaultRAM(def, video->type);
-
- video->ram = VIR_ROUND_UP_POWER_OF_TWO(video->ram);
- video->vram = VIR_ROUND_UP_POWER_OF_TWO(video->vram);
- }
+ if (dev->type == VIR_DOMAIN_DEVICE_VIDEO)
+ return virDomainVideoDefPostParse(dev->data.video, def);
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
virDomainHostdevDefPostParse(dev->data.hostdev, def, xmlopt) < 0)
--
2.20.1