[libvirt] PATCH: allow to set nvcpus = 0

OpenVZ uses all CPUs available in system - by default (number of CPUs did not set) - number of CPUs = 0 Currenty, libvirt don't allow to set nvcpus = 0. Attached patch removes limitation in libvirt set nvcpu = 0, but add it to each driver which allow to set number of virtual CPU. For OpenVZ set default number of CPUs = 0.

On Mon, Nov 17, 2008 at 06:44:07PM +0300, Evgeniy Sokolov wrote:
OpenVZ uses all CPUs available in system - by default (number of CPUs did not set) - number of CPUs = 0
Currenty, libvirt don't allow to set nvcpus = 0
Attached patch removes limitation in libvirt set nvcpu = 0, but add it to each driver which allow to set number of virtual CPU. For OpenVZ set default number of CPUs = 0.
This is the wrong way to handle this. If OpenVZ allows the container to use all the host CPUs, then the vCPUs number should reflect the number of pCPUs, not 0. So when loading the openvz config, if there is no CPUS= setting in the config file, the driver should fill in the number of host pCPUs. Likewise, when setting the openvz config, if the vCPUs in the XML is >= pCPUs, then it should just leave out the CPUS= setting, so OpenVZ uses all CPUs. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Nov 17, 2008 at 06:44:07PM +0300, Evgeniy Sokolov wrote:
OpenVZ uses all CPUs available in system - by default (number of CPUs did not set) - number of CPUs = 0
Currenty, libvirt don't allow to set nvcpus = 0
Attached patch removes limitation in libvirt set nvcpu = 0, but add it to each driver which allow to set number of virtual CPU. For OpenVZ set default number of CPUs = 0.
This is the wrong way to handle this. If OpenVZ allows the container to use all the host CPUs, then the vCPUs number should reflect the number of pCPUs, not 0. So when loading the openvz config, if there is no CPUS= setting in the config file, the driver should fill in the number of host pCPUs. Likewise, when setting the openvz config, if the vCPUs in the XML is >= pCPUs, then it should just leave out the CPUS= setting, so OpenVZ uses all CPUs.
It is not like in OpenVZ, but good way. Attached patch implement it.

On Wed, Nov 19, 2008 at 07:59:27PM +0300, Evgeniy Sokolov wrote:
On Mon, Nov 17, 2008 at 06:44:07PM +0300, Evgeniy Sokolov wrote:
OpenVZ uses all CPUs available in system - by default (number of CPUs did not set) - number of CPUs = 0
Currenty, libvirt don't allow to set nvcpus = 0
Attached patch removes limitation in libvirt set nvcpu = 0, but add it to each driver which allow to set number of virtual CPU. For OpenVZ set default number of CPUs = 0.
This is the wrong way to handle this. If OpenVZ allows the container to use all the host CPUs, then the vCPUs number should reflect the number of pCPUs, not 0. So when loading the openvz config, if there is no CPUS= setting in the config file, the driver should fill in the number of host pCPUs. Likewise, when setting the openvz config, if the vCPUs in the XML is >= pCPUs, then it should just leave out the CPUS= setting, so OpenVZ uses all CPUs.
It is not like in OpenVZ, but good way. Attached patch implement it.
ACK, this patch looks good to me - I'll commit it shortly. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Evgeniy Sokolov