mirror of
https://github.com/schoebel/mars
synced 2025-03-11 07:47:41 +00:00
marsadm: new primitives {count-,}configured-peers
This commit is contained in:
parent
767c698ead
commit
416a9f6e0c
@ -1069,6 +1069,17 @@ sub get_any_peers {
|
||||
}
|
||||
}
|
||||
|
||||
sub _get_configured_peer_paths {
|
||||
my $ips_glob = "$mars/ips/ip-*";
|
||||
return lamport_glob($ips_glob);
|
||||
}
|
||||
|
||||
sub _count_configured_peer_paths {
|
||||
my $ips_glob = "$mars/ips/ip-*";
|
||||
my @list = lamport_glob($ips_glob);
|
||||
return scalar(@list);
|
||||
}
|
||||
|
||||
sub key_intersect {
|
||||
my ($hash1, $hash2) = @_;
|
||||
my %h1 = %$hash1;
|
||||
@ -7881,6 +7892,19 @@ sub eval_fn {
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
if (/^(count[-_]?)?configured[-_]?peers$/) {
|
||||
my $do_count = $1;
|
||||
if ($do_count) {
|
||||
return _count_configured_peer_paths();
|
||||
}
|
||||
my $list = "";
|
||||
foreach my $peer_path (_get_configured_peer_paths()) {
|
||||
my $peer = $peer_path;
|
||||
$peer =~ s:^.*/ip-::;
|
||||
$list .= "$peer\n";
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
# low-level symlink access
|
||||
if (/^readlink$/) {
|
||||
my $path = parse_macro($arg1, $env);
|
||||
@ -9296,6 +9320,10 @@ my %trivial_globs =
|
||||
=> "",
|
||||
"count-{cluster,resource,guest}-peers"
|
||||
=> "",
|
||||
"configured-peers"
|
||||
=> "",
|
||||
"count-configured-peers"
|
||||
=> "",
|
||||
"{disk,resource,device}-size"
|
||||
=> "",
|
||||
"resource-possible-size"
|
||||
|
Loading…
Reference in New Issue
Block a user