[pve-devel] [PATCH container 2/2] start: rebalance and find a set of cores to start with
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Nov 17 11:27:03 CET 2016
Otherwise we run with all cores until pvestatd's rebalancing
takes effect, and the container could race to prevent this
from working.
---
src/PVE/LXC.pm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 598dff5..6421e2a 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -437,15 +437,27 @@ sub update_lxc_config {
$raw .= "lxc.network.mtu = $d->{mtu}\n" if defined($d->{mtu});
}
+ my $had_cpuset = 0;
if (my $lxcconf = $conf->{lxc}) {
foreach my $entry (@$lxcconf) {
my ($k, $v) = @$entry;
$netcount++ if $k eq 'lxc.network.type';
+ $had_cpuset = 1 if $k eq 'lxc.cgroup.cpuset.cpus';
$raw .= "$k = $v\n";
}
}
$raw .= "lxc.network.type = empty\n" if !$netcount;
+
+ my $cores = $conf->{cores};
+ if (!$had_cpuset && $cores) {
+ my $cpuset = eval { rebalance_lxc_containers($cores) };
+ if ($@) {
+ warn $@;
+ } else {
+ $raw .= "lxc.cgroup.cpuset.cpus = ".$cpuset->short_string()."\n";
+ }
+ }
File::Path::mkpath("$dir/rootfs");
--
2.1.4
More information about the pve-devel
mailing list