mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-06-07 13:33:02 +00:00
rebalance_lxc_containers: avoid repeated warnings if rebalance fails
Only warn once.
This commit is contained in:
parent
0b959507c1
commit
b3f1adb200
@ -222,6 +222,8 @@ sub remove_stale_lxc_consoles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $rebalance_error_count = {};
|
||||||
|
|
||||||
sub rebalance_lxc_containers {
|
sub rebalance_lxc_containers {
|
||||||
|
|
||||||
return if !-d '/sys/fs/cgroup/cpuset/lxc'; # nothing to do...
|
return if !-d '/sys/fs/cgroup/cpuset/lxc'; # nothing to do...
|
||||||
@ -237,8 +239,11 @@ sub rebalance_lxc_containers {
|
|||||||
my $modify_cpuset = sub {
|
my $modify_cpuset = sub {
|
||||||
my ($vmid, $cpuset, $newset) = @_;
|
my ($vmid, $cpuset, $newset) = @_;
|
||||||
|
|
||||||
|
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 {
|
||||||
# allow all, so that we can set new cpuset in /ns
|
# allow all, so that we can set new cpuset in /ns
|
||||||
$all_cpus->write_to_cgroup("lxc/$vmid");
|
$all_cpus->write_to_cgroup("lxc/$vmid");
|
||||||
@ -246,15 +251,18 @@ sub rebalance_lxc_containers {
|
|||||||
$newset->write_to_cgroup("lxc/$vmid/ns");
|
$newset->write_to_cgroup("lxc/$vmid/ns");
|
||||||
};
|
};
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
warn $err;
|
warn $err if !$rebalance_error_count->{$vmid}++;
|
||||||
# restore original
|
# restore original
|
||||||
$cpuset->write_to_cgroup("lxc/$vmid");
|
$cpuset->write_to_cgroup("lxc/$vmid");
|
||||||
} else {
|
} else {
|
||||||
# also apply to container root cgroup
|
# also apply to container root cgroup
|
||||||
$newset->write_to_cgroup("lxc/$vmid");
|
$newset->write_to_cgroup("lxc/$vmid");
|
||||||
|
$rebalance_error_count->{$vmid} = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
warn $@ if $@;
|
if (my $err = $@) {
|
||||||
|
warn $err if !$rebalance_error_count->{$vmid}++;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
my $ctlist = PVE::LXC::config_list();
|
my $ctlist = PVE::LXC::config_list();
|
||||||
|
Loading…
Reference in New Issue
Block a user