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

[Libvir] [PATCH] virsh vcpupin guards CPU not existing.



Hi

When CPU not existing is set to virsh vcpupin, CPU affinity is set to all CPU.

--------------------------------------------------------------------------------
# virsh vcpuinfo 0
VCPU:           0
CPU:            0
State:          blocked
CPU time:       428.8s
CPU Affinity:   y-

# virsh vcpupin 0 0 100
libvir: Xen error : failed Xen syscall  ioctl  -1208339792

# virsh vcpuinfo 0
VCPU:           0
CPU:            0
State:          blocked
CPU time:       429.6s
CPU Affinity:   yy
--------------------------------------------------------------------------------

This patch returns an error, when CPU not existing is set to virsh vcpupin.

--------------------------------------------------------------------------------
# virsh vcpupin 0 0 100
error: Physical CPU 100 doesn't exist.
--------------------------------------------------------------------------------


Signed-off-by: Masayuki Sunou <fj1826dm aa jp fujitsu com>

Thanks,
Masayuki Sunou.


--------------------------------------------------------------------------------
Index: src/virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.67
diff -u -p -r1.67 virsh.c
--- src/virsh.c	20 Mar 2007 15:31:46 -0000	1.67
+++ src/virsh.c	22 Mar 2007 06:05:14 -0000
@@ -1358,6 +1358,11 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm
 
         if (cpu < VIR_NODEINFO_MAXCPUS(nodeinfo)) {
             VIR_USE_CPU(cpumap, cpu);
+        } else {
+            vshError(ctl, FALSE, _("Physical CPU %d doesn't exist."), cpu);
+            free(cpumap);
+            virDomainFree(dom);
+            return FALSE;
         }
         cpulist = index(cpulist, ',');
         if (cpulist)
--------------------------------------------------------------------------------


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