[libvirt] [PATCH] manage number of virtual CPUs

OpenVZ containers use all CPUs available in system by default. Limitations may be caused only by Linux kernel limitation. There is way to artificially limit number of CPUs. patch add cpu management functionality to OpenVZ driver.

On Wed, Aug 13, 2008 at 05:04:45PM +0400, Evgeniy Sokolov wrote:
+static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type) { + if (STRCASEEQ(type, "openvz")) + return 4096; //OpenVZ has no limitation
This should be 1024 since that's the max CPUs exposed by the kernel to userspace for sched params.
+ if (virRun(conn, (char **)prog, NULL) < 0) { + openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _("Could not exec %s"), VZCTL); + return -1; + }
There's no need to cast to '(char **)' anymore - virRun has the correct constness defined. With those two things changed this looks fine to commit 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 Wed, Aug 13, 2008 at 05:04:45PM +0400, Evgeniy Sokolov wrote:
+static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type) { + if (STRCASEEQ(type, "openvz")) + return 4096; //OpenVZ has no limitation
This should be 1024 since that's the max CPUs exposed by the kernel to userspace for sched params.
+ if (virRun(conn, (char **)prog, NULL) < 0) { + openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _("Could not exec %s"), VZCTL); + return -1; + }
There's no need to cast to '(char **)' anymore - virRun has the correct constness defined.
With those two things changed this looks fine to commit Thanks for review!
fixed patch is attached.
Regards, Daniel

On Thu, Aug 14, 2008 at 06:31:31PM +0400, Evgeniy Sokolov wrote:
On Wed, Aug 13, 2008 at 05:04:45PM +0400, Evgeniy Sokolov wrote:
+static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type) { + if (STRCASEEQ(type, "openvz")) + return 4096; //OpenVZ has no limitation
This should be 1024 since that's the max CPUs exposed by the kernel to userspace for sched params.
+ if (virRun(conn, (char **)prog, NULL) < 0) { + openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _("Could not exec %s"), VZCTL); + return -1; + }
There's no need to cast to '(char **)' anymore - virRun has the correct constness defined.
With those two things changed this looks fine to commit Thanks for review!
fixed patch is attached.
Okidoc, applied and commited, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Evgeniy Sokolov