[libvirt] [PATCH] conf: fix cannot get mutli value settings when parse controllers XML

Luyao Huang lhuang at redhat.com
Wed Jan 7 09:36:39 UTC 2015


We will free the old parameter value settings in next loop when we
get scsi controller's driver specific options.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 src/conf/domain_conf.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b9858cd..f7b4a7c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6870,11 +6870,21 @@ virDomainControllerDefParseXML(xmlNodePtr node,
 
     cur = node->children;
     while (cur != NULL) {
+        char *queues2 = NULL;
+        char *cmd_per_lun2 = NULL;
+        char *max_sectors2 = NULL;
+
         if (cur->type == XML_ELEMENT_NODE) {
             if (xmlStrEqual(cur->name, BAD_CAST "driver")) {
-                queues = virXMLPropString(cur, "queues");
-                cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
-                max_sectors = virXMLPropString(cur, "max_sectors");
+                queues2 = virXMLPropString(cur, "queues");
+                if (queues2)
+                    queues = queues2;
+                cmd_per_lun2 = virXMLPropString(cur, "cmd_per_lun");
+                if (cmd_per_lun2)
+                    cmd_per_lun = cmd_per_lun2;
+                max_sectors2 = virXMLPropString(cur, "max_sectors");
+                if (max_sectors2)
+                    max_sectors = max_sectors2;
             }
         }
         cur = cur->next;
-- 
1.8.3.1




More information about the libvir-list mailing list