[libvirt] [PATCH 1/2 v3] Fix virDomainChrDefParseTargetXML() to parse the target port if available

Michal Novotny minovotn at redhat.com
Fri Feb 18 14:11:58 UTC 2011


Hi,
this is the patch to fix the virDomainChrDefParseTargetXML() functionality
to parse the target port from XML if available. This is necessary for
multiple serial port support which is the second part of this patch.

Michal

Signed-off-by: Michal Novotny <minovotn at redhat.com>
---
 src/conf/domain_conf.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e7c3409..16a75f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2973,7 +2973,8 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
     default:
         portStr = virXMLPropString(cur, "port");
         if (portStr == NULL) {
-            /* Not required. It will be assigned automatically later */
+            /* Set to negative value to indicate we should set it later */
+            def->target.port = -1;
             break;
         }
 
@@ -2983,6 +2984,7 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
                                  portStr);
             goto error;
         }
+        def->target.port = port;
         break;
     }
 
@@ -5566,7 +5568,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         if (!chr)
             goto error;
 
-        chr->target.port = i;
+        if (chr->target.port < 0)
+            chr->target.port = i;
         def->serials[def->nserials++] = chr;
     }
     VIR_FREE(nodes);
-- 
1.7.3.2




More information about the libvir-list mailing list