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

[libvirt] [PATCH] Add error message when the invalid XML file is defined.



Hi,

When cpuset that is the attribute of vcpu tag of the XML file is the invalid
string, "virsh define" succeeds.
(Ex. <vcpu cpuset='aaa'>4</vcpu>
     <vcpu cpuset=' '>4</vcpu>
     <vcpu cpuset=',,,'>4</vcpu> )
The patch changes policy that the definition is failed and shows error message.

Thanks,
Signed-off-by: Hiroyuki Kaguchi <fj7025cf aa jp fujitsu com>

Index: src/xm_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xm_internal.c,v
retrieving revision 1.79
diff -u -p -r1.79 xm_internal.c
--- src/xm_internal.c	29 May 2008 19:20:23 -0000	1.79
+++ src/xm_internal.c	30 May 2008 05:27:35 -0000
@@ -2004,20 +2004,15 @@ virConfPtr xenXMParseXMLToConfig(virConn
         char *ranges;

         ranges = virConvertCpuSet(conn, cpus, 0);
-        if (ranges != NULL) {
-            VIR_FREE(cpus);
-            if (xenXMConfigSetString(conf, "cpus", ranges) < 0) {
-                VIR_FREE(ranges);
-                goto error;
-            }
+        VIR_FREE(cpus);
+        if (ranges == NULL) {
+            goto error;
+        }
+        if (xenXMConfigSetString(conf, "cpus", ranges) < 0) {
             VIR_FREE(ranges);
-        } else {
-            if (xenXMConfigSetString(conf, "cpus", cpus) < 0) {
-                VIR_FREE(cpus);
-                goto error;
-            }
-            VIR_FREE(cpus);
+            goto error;
         }
+        VIR_FREE(ranges);
     }

     obj = xmlXPathEval(BAD_CAST "string(/domain/os/type)", ctxt);


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