marsadm: report disk/device sizes

This commit is contained in:
Thomas Schoebel-Theuer 2015-03-17 10:03:02 +01:00
parent 1f2680dd62
commit c88965e24a
2 changed files with 57 additions and 0 deletions

View File

@ -8596,6 +8596,47 @@ reference "sub:Emergency-Mode"
).
\end_layout
\begin_layout Labeling
\labelwidthstring 00.00.0000
\family typewriter
disk-size
\family default
Show the size of the underlying local disk in bytes.
\end_layout
\begin_layout Labeling
\labelwidthstring 00.00.0000
\family typewriter
resource-size
\family default
Show the logical size of the resource in bytes.
When this value is lower than
\family typewriter
disk-size
\family default
, you are wasting space.
\end_layout
\begin_layout Labeling
\labelwidthstring 00.00.0000
\family typewriter
device-size
\family default
At a primary node, this may differ from
\family typewriter
resource-size
\family default
only for a very short time during the
\family typewriter
resize
\family default
operation.
At secondaries, there will be no difference.
\end_layout
\begin_layout Standard
\noindent
The following macros are only meaningful for secondary nodes.

View File

@ -3113,6 +3113,20 @@ sub eval_fn {
}
return $sum;
}
if (/^(disk|resource|device)[-_]?size$/) {
my $what = $1;
my $path = "$mars/resource-" . $$env{"res"};
if ($what eq "device" && eval_fn($env, "present-device", "")) {
return _get_mars_size($$env{"cmd"}, $$env{"res"});
} elsif ($what eq "disk"){
my $peer = parse_macro($arg1, $env);
$peer = $$env{"host"} unless $peer;
$path .= "/actsize-$peer";
} else {
$path .= "/size";
}
return get_link($path, 1);
}
# time handling and pausing
if (/^time$/) {
return mars_time();
@ -3884,6 +3898,8 @@ my %trivial_globs =
=> "",
# intended for scripting
"{disk,resource,device}-size"
=> "",
"deletable-size"
=> "",
"occupied-size"