render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
404507
From 0c9561ff6de749954395f562cbb8e3d12954566c Mon Sep 17 00:00:00 2001
404507
Message-Id: <0c9561ff6de749954395f562cbb8e3d12954566c@dist-git>
404507
From: Andrea Bolognani <abologna@redhat.com>
404507
Date: Wed, 29 Nov 2017 16:22:57 +0100
404507
Subject: [PATCH] conf: Run devicePostParse() again for the first serial device
404507
404507
The devicePostParse() callback is invoked for all devices so that
404507
drivers have a chance to set their own specific values; however,
404507
virDomainDefAddImplicitDevices() runs *after* the devicePostParse()
404507
callbacks have been invoked and can add new devices, in which case
404507
the driver wouldn't have a chance to customize them.
404507
404507
Work around the issue by invoking the devicePostParse() callback
404507
after virDomainDefAddImplicitDevices(), only for the first serial
404507
devices, which might have been added by it. The same was already
404507
happening for the first video device for the very same reason.
404507
404507
This will become important later on, when we will change
404507
virDomainDefAddConsoleCompat() not to set a targetType for
404507
automatically added serial devices.
404507
404507
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
404507
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
404507
(cherry picked from commit 2628afc143224d38e6ef8c06a8fbec1d0f69fb86)
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1449265
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1511421
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512929
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512934
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/conf/domain_conf.c | 12 ++++++++++++
404507
 1 file changed, 12 insertions(+)
404507
404507
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
404507
index 4b5e7c214f..41674a85af 100644
404507
--- a/src/conf/domain_conf.c
404507
+++ b/src/conf/domain_conf.c
404507
@@ -4948,6 +4948,18 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
404507
             return -1;
404507
     }
404507
 
404507
+    if (def->nserials != 0) {
404507
+        virDomainDeviceDef device = {
404507
+            .type = VIR_DOMAIN_DEVICE_CHR,
404507
+            .data.chr = def->serials[0],
404507
+        };
404507
+
404507
+        /* serials[0] might have been added in AddImplicitDevices, after we've
404507
+         * done the per-device post-parse */
404507
+        if (virDomainDefPostParseDeviceIterator(def, &device, NULL, data) < 0)
404507
+            return -1;
404507
+    }
404507
+
404507
     /* clean up possibly duplicated metadata entries */
404507
     virXMLNodeSanitizeNamespaces(def->metadata);
404507
 
404507
-- 
404507
2.15.1
404507