Hi,
I found some confusion in display of commad *virsh vcpuinfo domname* .
There is no diffrence between a cpu offline and a cpu online but not be set
for the affinity of vcpu, both are '-'. But users will find the difference of
them
in using them for a same action (such as vcpupin) and be confused.
Example:
[root@yds-pc ~]# echo "0" >/sys/devices/system/cpu/cpu2/online
[root@yds-pc ~]# cat /proc/cpuinfo |grep processor
processor : 0
processor : 1
processor : 3
[root@yds-pc ~]# virsh vcpupin virt-tests-vm1 0 0,3
[root@yds-pc ~]# virsh vcpuinfo virt-tests-vm1
VCPU: 0
CPU: 0
State: running
CPU time: 14.8s
CPU Affinity: y--y
*There is no diff between cpu1 and cpu2 (both '-')*
BUT:
[root@yds-pc ~]# virsh vcpupin virt-tests-vm1 0 1
[root@yds-pc ~]# echo $?
0
[root@yds-pc ~]# virsh vcpupin virt-tests-vm1 0 2
error: Requested operation is not valid: failed to set cpuset.cpus in cgroup for vcpu 0
[root@yds-pc ~]# echo $?
1
So, I think we should show the cpu in different state with different symbol.
In this patchset, I introduce a symbol 'x' (maybe there is a better one :)) to
display
the cpu is offline on host.
Just like:
[root@yds-pc ~]# virsh vcpuinfo virt-tests-vm1
VCPU: 0
CPU: 0
State: running
CPU time: 14.8s
CPU Affinity: y-xy
yangdongsheng (2):
tool/virsh-domain.c: Add a vshNodeGetCPUMap function to get cpumap of
host.
tool/virsh-domain.c: Fix the display of Affinity in function
cmdVcpuinfo.
tools/virsh-domain.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 75 insertions(+), 3 deletions(-)
--
1.7.10.1