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

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

 



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@xxxxxxxxxxxxxxxxx>

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);

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]