Commit 9db22c33 authored by Dietmar Maurer's avatar Dietmar Maurer

fix bug 22: correctly display openvz swap usage

parent 322ce4c4
......@@ -114,7 +114,8 @@ sub get_rootdir {
sub read_user_beancounters {
my $ubc = {};
if (my $fh = IO::File->new ("/proc/user_beancounters", "r")) {
if (my $fh = IO::File->new ("/proc/bc/resources", "r")) {
my $vmid;
while (defined (my $line = <$fh>)) {
if ($line =~ m|\s*((\d+):\s*)?([a-z]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$|) {
......@@ -240,15 +241,17 @@ sub vmstatus {
}
}
my $maxpages = ($res_unlimited / 4096);
my $ubchash = read_user_beancounters();
foreach my $vmid (keys %$ubchash) {
my $d = $list->{$vmid};
my $ubc = $ubchash->{$vmid};
if ($d && defined($d->{status}) && $ubc) {
$d->{failcnt} = $ubc->{failcntsum};
$d->{mem} = int($ubc->{privvmpages}->{held} * 4096);
my $phy = int($ubc->{physpages}->{held} * 4096);
$d->{swap} = $phy > $d->{maxmem} ? $phy - $d->{maxmem} : 0;
$d->{mem} = $ubc->{physpages}->{held} * 4096;
if ($ubc->{swappages}->{held} < $maxpages) {
$d->{swap} = $ubc->{swappages}->{held} * 4096
}
$d->{nproc} = $ubc->{numproc}->{held};
}
}
......
pve-manager (2.0-40) unstable; urgency=low
* fix bug 22: correctly display openvz swap usage
-- Proxmox Support Team <support@proxmox.com> Wed, 14 Mar 2012 16:00:32 +0100
pve-manager (2.0-39) unstable; urgency=low
* add Spanish translation
......
......@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
PACKAGE=pve-manager
PACKAGERELEASE=39
PACKAGERELEASE=40
BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment