[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Regression in allocating ports for serial/parallel devs

Hi Michal,

The following commit introduced a regression:


Now, defining a guest with XML like

<serial type='pty'/>
<serial type='null'/>
<serial type='stdio'/>

Will allocate <target port='0'/> to all 3. The reason is that
target.port is never set to -1 unless the user specified some <target>
XML. A simple fix is:

--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3265,6 +3265,8 @@ virDomainChrDefParseXML(virCapsPtr caps,
         return NULL;

+    def->target.port = -1;
     type = virXMLPropString(node, "type");
     if (type == NULL) {
         def->source.type = VIR_DOMAIN_CHR_TYPE_PTY;

But that doesn't solve the problem for users who are building ChrDef's
by hand, like when converting between formats as xen and vmware drivers
do. I didn't look at those users so they may be safe, but the interface
should be improved. Maybe add a ChrDefNew function that sets the -1 default.

Additionally we should add a qemuxml2xml test for this to prevent
against future regressions.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]