On Fri, May 30, 2008 at 06:06:38PM +0900, Hiroyuki Kaguchi wrote:
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(a)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);
It took me a while to understand what this patch did, but yes I agree
this is a bug. I'll commit this fix shortly.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top