mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-26 02:41:30 +00:00
rebalance_lxc_containers: use cores instead of cpulimit
This commit is contained in:
parent
780fbb4b2a
commit
09fee7559b
@ -261,9 +261,9 @@ sub rebalance_lxc_containers {
|
|||||||
$cpu_ctcount[$cpu]++ if $cpu <= @cpu_ctcount;
|
$cpu_ctcount[$cpu]++ if $cpu <= @cpu_ctcount;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
my $cpulimit = $conf->{cpulimit} // $cpucount;
|
my $cores = $conf->{cores};
|
||||||
$cpulimit = $cpucount if $cpulimit > $cpucount;
|
$cores = $cpucount if !$cores || $cores > $cpucount;
|
||||||
push @balanced_cts, [$vmid, $cpulimit, $cpuset];
|
push @balanced_cts, [$vmid, $cores, $cpuset];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ sub rebalance_lxc_containers {
|
|||||||
my $new_order = {};
|
my $new_order = {};
|
||||||
|
|
||||||
foreach my $bct (sort { &$ctid_sorter($a->[0], $b->[0]) } @balanced_cts) {
|
foreach my $bct (sort { &$ctid_sorter($a->[0], $b->[0]) } @balanced_cts) {
|
||||||
my ($vmid, $cpulimit, $cpuset) = @$bct;
|
my ($vmid, $cores, $cpuset) = @$bct;
|
||||||
|
|
||||||
if (my $order = $persistent_container_order->{$vmid}) {
|
if (my $order = $persistent_container_order->{$vmid}) {
|
||||||
$new_order->{$vmid} = $order; # copy old value
|
$new_order->{$vmid} = $order; # copy old value
|
||||||
@ -301,7 +301,7 @@ sub rebalance_lxc_containers {
|
|||||||
|
|
||||||
my $newset = PVE::CpuSet->new();
|
my $newset = PVE::CpuSet->new();
|
||||||
|
|
||||||
for (my $i = 0; $i < $cpulimit && $i < @cpus_by_count; ++$i) {
|
for (my $i = 0; $i < $cores && $i < @cpus_by_count; ++$i) {
|
||||||
my $cpu = $cpus_by_count[$i];
|
my $cpu = $cpus_by_count[$i];
|
||||||
$newset->insert($cpu);
|
$newset->insert($cpu);
|
||||||
$cpu_ctcount[$cpu]++;
|
$cpu_ctcount[$cpu]++;
|
||||||
|
Loading…
Reference in New Issue
Block a user