mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-08 01:17:37 +03:00
cgroup: get_pressure_stat: handle v1 controller gracefully
and return the default zeroed $res in case we cannot get any path Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
eadfaabdae
commit
b82ddf5d99
@ -382,17 +382,18 @@ sub get_pressure_stat {
|
||||
},
|
||||
};
|
||||
|
||||
my ($path, $ver) = $self->get_path(undef, 1);
|
||||
my ($path, $version) = $self->get_path(undef, 1);
|
||||
if (!defined($path)) {
|
||||
# container or VM most likely isn't running
|
||||
return undef;
|
||||
} elsif ($ver == 2) {
|
||||
return $res; # container or VM most likely isn't running, retrun zero stats
|
||||
} elsif ($version == 1) {
|
||||
return undef; # v1 controller does not provides pressure stat
|
||||
} elsif ($version == 2) {
|
||||
for my $type (qw(cpu memory io)) {
|
||||
my $stats = PVE::ProcFSTools::parse_pressure("$path/$type.pressure");
|
||||
$res->{$type} = $stats if $stats;
|
||||
}
|
||||
} else {
|
||||
die "bad cgroup version: $ver\n";
|
||||
die "bad cgroup version: $version\n";
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
Loading…
Reference in New Issue
Block a user