Commit 5152f728 authored by Dietmar Maurer's avatar Dietmar Maurer

display vswap for openvz containers

parent 51688b17
...@@ -129,6 +129,9 @@ sub vmstatus { ...@@ -129,6 +129,9 @@ sub vmstatus {
$d->{mem} = 0; $d->{mem} = 0;
$d->{maxmem} = int((($conf->{physpages}->{lim} + $conf->{swappages}->{lim})* 4096)); $d->{maxmem} = int((($conf->{physpages}->{lim} + $conf->{swappages}->{lim})* 4096));
$d->{swap} = 0;
$d->{maxswap} = int((($conf->{swappages}->{lim})* 4096));
$d->{nproc} = 0; $d->{nproc} = 0;
$d->{failcnt} = 0; $d->{failcnt} = 0;
...@@ -176,6 +179,7 @@ sub vmstatus { ...@@ -176,6 +179,7 @@ sub vmstatus {
$d->{mem} += int($held * 4096); $d->{mem} += int($held * 4096);
} elsif ($name eq 'swappages') { } elsif ($name eq 'swappages') {
$d->{mem} += int($held * 4096); $d->{mem} += int($held * 4096);
$d->{swap} += int($held * 4096);
} elsif ($name eq 'numproc') { } elsif ($name eq 'numproc') {
$d->{nproc} = $held; $d->{nproc} = $held;
} }
......
...@@ -32,26 +32,50 @@ Ext.define('PVE.openvz.StatusView', { ...@@ -32,26 +32,50 @@ Ext.define('PVE.openvz.StatusView', {
var render_mem = function(value, metaData, record, rowIndex, colIndex, store) { var render_mem = function(value, metaData, record, rowIndex, colIndex, store) {
var maxmem = me.getObjectValue('maxmem', 0); var maxmem = me.getObjectValue('maxmem', 0);
var per = (value / maxmem)*100; var maxswap = me.getObjectValue('maxswap', 0);
var text = "<div>Total: " + PVE.Utils.format_size(maxmem) + "</div>" + var swap = me.getObjectValue('swap', 0);
var max = maxmem - maxswap;
var used = value-swap;
var per = (used / max)*100;
var text = "<div>Total: " + PVE.Utils.format_size(max) + "</div>" +
"<div>Used: " + PVE.Utils.format_size(used) + "</div>";
return text;
};
var render_swap = function(value, metaData, record, rowIndex, colIndex, store) {
var maxswap = me.getObjectValue('maxswap', 0);
var per = (value / maxswap)*100;
var text = "<div>Total: " + PVE.Utils.format_size(maxswap) + "</div>" +
"<div>Used: " + PVE.Utils.format_size(value) + "</div>"; "<div>Used: " + PVE.Utils.format_size(value) + "</div>";
return text; return text;
}; };
var render_status = function(value, metaData, record, rowIndex, colIndex, store) {
var failcnt = me.getObjectValue('failcnt', 0);
if (failcnt > 0) {
return value + " (failure count " + failcnt + ")";
}
return value;
}
var rows = { var rows = {
name: { header: 'Name', defaultValue: 'no name specified' }, name: { header: 'Name', defaultValue: 'no name specified' },
status: { header: 'Status', defaultValue: 'unknown' }, status: { header: 'Status', defaultValue: 'unknown', renderer: render_status },
failcnt: { visible: false },
cpu: { header: 'CPU usage', required: true, renderer: render_cpu }, cpu: { header: 'CPU usage', required: true, renderer: render_cpu },
cpus: { visible: false }, cpus: { visible: false },
mem: { header: 'Memory usage', required: true, renderer: render_mem }, mem: { header: 'Memory usage', required: true, renderer: render_mem },
maxmem: { visible: false }, maxmem: { visible: false },
swap: { header: 'VSwap usage', required: true, renderer: render_swap },
maxswap: { visible: false },
uptime: { header: 'Uptime', required: true, renderer: PVE.Utils.render_uptime } uptime: { header: 'Uptime', required: true, renderer: PVE.Utils.render_uptime }
}; };
Ext.applyIf(me, { Ext.applyIf(me, {
url: "/api2/json/nodes/" + nodename + "/openvz/" + vmid + "/status/current", url: "/api2/json/nodes/" + nodename + "/openvz/" + vmid + "/status/current",
cwidth1: 150, cwidth1: 150,
height: 145, height: 179,
interval: 1000, interval: 1000,
rows: rows rows: rows
}); });
......
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