[libvirt] [RFC] Support cpu hotplug in libvirt.

tangchen tangchen at cn.fujitsu.com
Wed Jul 18 01:33:39 UTC 2012


Hi~

It seems that libvirt is not cpu hotplug aware.

Please refer to the following problem.

1. At first, we have 2 cpus.
# cat /cgroup/cpuset/cpuset.cpus 
0-1
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus 
0-1

2. And we have a vm1 with following configuration.
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <hypervisorpin cpuset='1'/>
  </cputune>

3. Offline cpu1.
# echo 0 > /sys/devices/system/cpu/cpu1/online
# cat /sys/devices/system/cpu/cpu1/online 
0

# cat /cgroup/cpuset/cpuset.cpus 
0
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus 
0

4. Online cpu1.
# echo 1 > /sys/devices/system/cpu/cpu1/online
# cat /sys/devices/system/cpu/cpu1/online 
1
# cat /cgroup/cpuset/cpuset.cpus 
0-1
# cat /cgroup/cpuset/libvirt/cpuset.cpus 
0
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus 
0
# cat /cgroup/cpuset/libvirt/lxc/cpuset.cpus 
0

Here,cgroup updated cpuset.cpus,but not for libvirt directory,and also qemu and lxc directory.

vm1 cannot be started again.
# virsh start vm1
error: Failed to start domain vm1
error: Unable to set cpuset.cpus: Permission denied

And libvird gave the following errors.

2012-07-17 07:30:22.478+0000: 3118: error : qemuSetupCgroupVcpuPin:498 : Unable to set cpuset.cpus: Permission denied



I am trying to use netlink socket with NETLINK_KOBJECT_UEVENT protocol to
listen to cpu hotplug events. But I met a little problem here.

virNetlinkEventServiceStart() only create a global variable server, and 
create a NETLINK_ROUTE netlink socket for it. 

So if I want to create another different netlink socket, such as NETLINK_KOBJECT_UEVENT, 
what should I do ?

Shall we make the server global variable a global array ?
(It seems there are a lot of work to do.)

Thanks. :)



-- 
Best Regards,
Tang chen




More information about the libvir-list mailing list