mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-08 06:38:39 +00:00
statd: rebalance_lxc_containers: code bload reduction
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
911a8e4f48
commit
b707257a16
@ -284,8 +284,7 @@ sub rebalance_lxc_containers {
|
|||||||
my ($vmid, $cpuset, $newset) = @_;
|
my ($vmid, $cpuset, $newset) = @_;
|
||||||
|
|
||||||
if (!$rebalance_error_count->{$vmid}) {
|
if (!$rebalance_error_count->{$vmid}) {
|
||||||
syslog('info', "modified cpu set for lxc/$vmid: " .
|
syslog('info', "modified cpu set for lxc/$vmid: " . $newset->short_string());
|
||||||
$newset->short_string());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
@ -321,21 +320,16 @@ sub rebalance_lxc_containers {
|
|||||||
|
|
||||||
foreach my $vmid (sort keys %$ctlist) {
|
foreach my $vmid (sort keys %$ctlist) {
|
||||||
my $cgpath = "$cpuset_base/lxc/$vmid";
|
my $cgpath = "$cpuset_base/lxc/$vmid";
|
||||||
|
|
||||||
if (-d "$cgpath/ns") {
|
if (-d "$cgpath/ns") {
|
||||||
$ctinfo->{$vmid} = $cgpath;
|
$ctinfo->{$vmid} = $cgpath;
|
||||||
} else {
|
} else {
|
||||||
# old style container
|
next; # old style container
|
||||||
next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($conf, $cpuset);
|
my ($conf, $cpuset) = eval {(
|
||||||
eval {
|
PVE::LXC::Config->load_config($vmid),
|
||||||
|
PVE::CpuSet->new_from_path($cgpath),
|
||||||
$conf = PVE::LXC::Config->load_config($vmid);
|
)};
|
||||||
|
|
||||||
$cpuset = PVE::CpuSet->new_from_path($cgpath);
|
|
||||||
};
|
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
warn $err;
|
warn $err;
|
||||||
next;
|
next;
|
||||||
@ -349,8 +343,7 @@ sub rebalance_lxc_containers {
|
|||||||
my $cores = $conf->{cores} || $cpucount;
|
my $cores = $conf->{cores} || $cpucount;
|
||||||
$cores = $cpucount if $cores > $cpucount;
|
$cores = $cpucount if $cores > $cpucount;
|
||||||
|
|
||||||
# see if the number of cores was hot-reduced or
|
# see if the number of cores was hot-reduced or hasn't been enacted at all yet
|
||||||
# hasn't been enacted at all yet
|
|
||||||
my $newset = PVE::CpuSet->new();
|
my $newset = PVE::CpuSet->new();
|
||||||
if ($cores < scalar(@cpuset_members)) {
|
if ($cores < scalar(@cpuset_members)) {
|
||||||
for (my $i = 0; $i < $cores; $i++) {
|
for (my $i = 0; $i < $cores; $i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user