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

display vswap for openvz containers

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