vzlist -j: fix showing disk usage for stopped CTs
Incidentally found this discrepancy between vzlist and vzlist -j:
# vzlist 1016 -o diskspace,diskspace.s,diskspace.h,diskinodes,diskinodes.s,diskinodes.h
DSPACE DSPACE.S DSPACE.H DINODES DINODES.S DINODES.H
445080 2268740 2268740 25976 144288 144288
# vzlist 1016 -j -o diskspace,diskinodes
[
{
"diskspace": {
"usage": 0,
"softlimit": 2268740,
"hardlimit": 2268740
},
"diskinodes": {
"usage": 0,
"softlimit": 144288,
"hardlimit": 144288
}
}
]
Basically, usage was not shown in json format, but was shown in default
format, because the container was not running.
A bit of history:
Quite some long time ago we only showed usage for a running container.
Later I found we can show usage for mounted CT as well, and implemented
that in commit de32e5472. Then commit 7ab85d9 added support for ploop-based
CTs (and in that case info is also available even for stopped/unmounted CTs).
Then I was porting the JSON patch (commit fc6386d) I screwed it up
(yes, it's my bug, not Roman's). Then this was fixed in commit 63ab6e7,
but only for non-json case.
So this is an addition to the commit 63ab6e7, for json case.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed