Skip to content

Commit 11b8e6e

Browse files
authored
fix(storage::hitachi::eseries::local): change --baie-id option to --instance-id (#6116)
Refs: CTOR-767
1 parent 8c912cd commit 11b8e6e

12 files changed

Lines changed: 65 additions & 62 deletions

File tree

src/storage/hitachi/eseries/local/custom/cli.pm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ sub new {
3434

3535
if (!defined($options{noptions})) {
3636
$options{options}->add_options(arguments => {
37-
'baie-id:s' => { name => 'baie_id', default => '' },
37+
'instance-id:s' => { name => 'instance_id', default => '' },
3838
'timeout:s' => { name => 'timeout', default => 45 },
3939
'command-path:s' => { name => 'command_path', default => '' },
4040
'sudo' => { name => 'sudo' }
@@ -58,25 +58,25 @@ sub set_defaults {}
5858
sub check_options {
5959
my ($self, %options) = @_;
6060

61-
$self->{output}->option_exit(short_msg => "Please set a valid --baie-id option.")
62-
unless $self->{option_results}->{baie_id} =~ /^\d+$/;
61+
$self->{output}->option_exit(short_msg => "Please set a valid --instance-id option.")
62+
unless $self->{option_results}->{instance_id} =~ /^\d+$/;
6363

6464
$self->{$_} = $self->{option_results}->{$_}
65-
foreach qw/baie_id timeout/;
65+
foreach qw/instance_id timeout/;
6666

6767
return 0;
6868
}
6969

70-
sub get_baie_id {
70+
sub get_instance_id {
7171
my ($self, %options) = @_;
72-
return $self->{baie_id};
72+
return $self->{instance_id};
7373
}
7474

7575
sub execute_command {
7676
my ($self, %options) = @_;
7777

7878
my $command_path = $self->{option_results}->{command_path} ne '' ? $self->{option_results}->{command_path}
79-
: $options{command_path};
79+
: $options{command_path};
8080

8181
check_security_command(
8282
output => $self->{output},
@@ -117,7 +117,7 @@ Hitachi E-Series local client custom connector.
117117
118118
=over 8
119119
120-
=item B<--baie-id>
120+
=item B<--instance-id>
121121
122122
Storage array ID (4 digits, required).
123123

src/storage/hitachi/eseries/local/mode/efficiency.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ sub manage_selection {
7070

7171
my ($stdout) = $options{custom}->execute_command(
7272
command => 'raidcom',
73-
command_options => 'get system -key efficiency -I' . $options{custom}->get_baie_id(),
73+
command_options => 'get system -key efficiency -I' . $options{custom}->get_instance_id(),
7474
);
7575

7676
# https://docs.hitachivantara.com/r/en-us/command-control-interface/01-87-03/mk-90rd7009/configuration-setting-commands/raidcom-get-system
@@ -109,7 +109,7 @@ __END__
109109
110110
Check Hitachi E-Series storage efficiency ratios.
111111
112-
Command used: C<raidcom get system -key efficiency -I<baie-id>>
112+
Command used: C<raidcom get system -key efficiency -I<instance-id>>
113113
114114
=over 8
115115

src/storage/hitachi/eseries/local/mode/pairstatus.pm

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ sub new {
7373
bless $self, $class;
7474

7575
$options{options}->add_options(arguments => {
76-
'remote-baie-id:s@' => { name => 'remote_baie_id' },
76+
'remote-instance-id:s@' => { name => 'remote_instance_id' },
7777
'ldev-id:s@' => { name => 'ldev_id' },
7878
'group-id:s' => { name => 'group_id', default => '' },
7979
});
@@ -85,25 +85,25 @@ sub check_options {
8585
my ($self, %options) = @_;
8686
$self->SUPER::check_options(%options);
8787

88-
my $baie_id = $self->{option_results}->{baie_id};
89-
# If remote_baie_id starts with + or - then it is added to baie_id to determine the effective array ID to use
88+
my $instance_id = $self->{option_results}->{instance_id};
89+
# If remote_instance_id starts with + or - then it is added to instance_id to determine the effective array ID to use
9090
# otherwise it is used as is
9191

92-
if (ref $self->{option_results}->{remote_baie_id} eq 'ARRAY') {
93-
foreach my $c_id (reverse @{$self->{option_results}->{remote_baie_id}}) {
92+
if (ref $self->{option_results}->{remote_instance_id} eq 'ARRAY') {
93+
foreach my $c_id (reverse @{$self->{option_results}->{remote_instance_id}}) {
9494
next if $c_id eq '';
9595
if ($c_id =~ /^[\+-]\d+$/) {
96-
$baie_id += $c_id;
96+
$instance_id += $c_id;
9797
} elsif ($c_id =~ /^\d+$/) {
98-
$baie_id = $c_id;
98+
$instance_id = $c_id;
9999
} else {
100-
$self->{output}->option_exit(short_msg => "Please set a valid --remote-baie-id option.");
100+
$self->{output}->option_exit(short_msg => "Please set a valid --remote-instance-id option.");
101101
}
102102
last
103103
}
104104
}
105105

106-
$self->{remote_baie_id} = $baie_id;
106+
$self->{remote_instance_id} = $instance_id;
107107

108108
$self->{ldev_ids} = flatten_arrays($self->{option_results}->{ldev_id});
109109

@@ -117,12 +117,12 @@ sub manage_selection {
117117
my ($self, %options) = @_;
118118

119119
# https://docs.hitachivantara.com/r/en-us/command-control-interface/01-87-03/mk-90rd7009/data-and-system-management-commands/pairdisplay
120-
# pairdisplay -ITC<baie-id+1000> -g <group> -CLI -fxce
120+
# pairdisplay -ITC<instance-id+1000> -g <group> -CLI -fxce
121121

122122
$self->{pairs} = {};
123123
my ($stdout) = $options{custom}->execute_command(
124124
command => 'pairdisplay',
125-
command_options => '-ITC' . $self->{remote_baie_id} . ' -g ' . $self->{group_id} . ' -CLI -fxce'
125+
command_options => '-ITC' . $self->{remote_instance_id} . ' -g ' . $self->{group_id} . ' -CLI -fxce'
126126
);
127127

128128
foreach my $line (split /\n/, $stdout) {
@@ -173,13 +173,13 @@ __END__
173173
174174
Check Hitachi E-Series TrueCopy/Universal Replicator pair status.
175175
176-
Command used: C<pairdisplay -ITC<baie-id+1000> -g <group> -CLI -fxce>
176+
Command used: C<pairdisplay -ITC<instance-id+1000> -g <group> -CLI -fxce>
177177
178178
=over 8
179179
180-
=item B<--remote-baie-id>
180+
=item B<--remote-instance-id>
181181
182-
Remote array ID. If starts with + or -, it is added to the local array ID, otherwise used as is (e.g. C<--remote-baie-id='100'> or C<--remote-baie-id='+1000'>).
182+
Remote array ID. If starts with + or -, it is added to the local array ID, otherwise used as is (e.g. C<--remote-instance-id='100'> or C<--remote-instance-id='+1000'>).
183183
184184
=item B<--group-id>
185185

src/storage/hitachi/eseries/local/mode/pathstatus.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ sub manage_selection {
7171
my ($self, %options) = @_;
7272

7373
# https://docs.hitachivantara.com/r/en-us/command-control-interface/01-87-03/mk-90rd7009/configuration-setting-commands/raidcom-get-path
74-
# raidcom get path -I$<baie_id>
74+
# raidcom get path -I$<instance_id>
7575

7676
my ($stdout) = $options{custom}->execute_command(
7777
command => 'raidcom',
78-
command_options => 'get path -I' . $options{custom}->get_baie_id()
78+
command_options => 'get path -I' . $options{custom}->get_instance_id()
7979
);
8080

8181
# Columns: PHG Group STS CM IF MP Port WWN PR LUN PHS Serial# ...
@@ -84,7 +84,7 @@ sub manage_selection {
8484
next if $line =~ /^PHG/ || $line =~ /^\s*$/;
8585

8686
my @fields = split /\s+/, $line;
87-
next unless @fields > 10;
87+
next unless @fields > 10;
8888
my ($port, $lun, $phs) = ($fields[6], $fields[9], $fields[10]);
8989

9090
next unless defined($port) && defined($lun) && defined($phs);
@@ -111,7 +111,7 @@ __END__
111111
112112
Check Hitachi E-Series path status.
113113
114-
Command used: C<raidcom get path -I<baie-id>>
114+
Command used: C<raidcom get path -I<instance-id>>
115115
116116
=over 8
117117

src/storage/hitachi/eseries/local/mode/pool.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ sub set_counters {
7272
$self->{maps_counters}->{pools} = [
7373
{ label => 'status', type => COUNTER_KIND_TEXT, critical_default => '%{status} ne "POLN"', set => {
7474
key_values => [ { name => 'status' }, { name => 'display' } ],
75-
output_template => 'Status: %s',
75+
output_template => 'Status: %s',
7676
closure_custom_threshold_check => \&catalog_status_threshold_ng
7777
}
7878
},
@@ -120,7 +120,7 @@ sub manage_selection {
120120
# https://docs.hitachivantara.com/r/en-us/command-control-interface/01-87-03/mk-90rd7009/configuration-setting-commands/raidcom-get-pool
121121
my ($stdout) = $options{custom}->execute_command(
122122
command => 'raidcom',
123-
command_options => 'get pool -I' . $options{custom}->get_baie_id()
123+
command_options => 'get pool -I' . $options{custom}->get_instance_id()
124124
);
125125

126126
# Columns: PID POLS U(%) SSCNT Av(MB) Tp(MB) Seq# Num LDEV# H TH ...
@@ -130,7 +130,7 @@ sub manage_selection {
130130
next if $line =~ /^\s*$/;
131131

132132
my @fields = split /\s+/, $line;
133-
next unless @fields > 5;
133+
next unless @fields > 5;
134134

135135
my ($pid, $pols, $usage_prct, $capa_available_mb, $capacity_mb) =
136136
($fields[0], $fields[1], $fields[2], $fields[4], $fields[5]);
@@ -165,7 +165,7 @@ __END__
165165
166166
Check Hitachi E-Series pool status and capacity.
167167
168-
Command used: C<raidcom get pool -I<baie-id>>
168+
Command used: C<raidcom get pool -I<instance-id>>
169169
170170
=over 8
171171

src/storage/hitachi/eseries/local/mode/quorum.pm

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ use centreon::plugins::misc qw/is_excluded is_empty/;
3030

3131
sub prefix_quorum_output {
3232
my ($self, %options) = @_;
33+
34+
return "Quorum '" . $options{instance_value}->{display} . "' serial: ". $options{instance_value}->{qrp_serial}.", ldev: ". $options{instance_value}->{ldev} . ", "
35+
if $self->{output}->is_verbose();
3336
return "Quorum '" . $options{instance_value}->{display} . "' ";
3437
}
3538

@@ -44,7 +47,7 @@ sub set_counters {
4447
$self->{maps_counters}->{quorums} = [
4548
{ label => 'status', type => COUNTER_KIND_TEXT, critical_default => '%{status} ne "NORMAL"', set => {
4649
key_values => [ { name => 'status' }, { name => 'display' } ],
47-
output_template => 'Status: %s',
50+
output_template => 'Status: %s',
4851
closure_custom_threshold_check => \&catalog_status_threshold_ng
4952
}
5053
}
@@ -68,7 +71,7 @@ sub check_options {
6871
$self->SUPER::check_options(%options);
6972

7073
$self->{output}->option_exit(short_msg => "Quorum ID is invalid.")
71-
if $self->{option_results}->{quorum_id} ne '' && $self->{option_results}->{quorum_id} !~ /^\d+$/;
74+
if $self->{option_results}->{quorum_id} ne '' && $self->{option_results}->{quorum_id} !~ /^\d+$/;
7275

7376
$self->{quorum_id} = $self->{option_results}->{quorum_id};
7477
}
@@ -86,17 +89,17 @@ sub manage_selection {
8689
while (1) {
8790
my ($stdout, $exit_code) = $options{custom}->execute_command(
8891
command => 'raidcom',
89-
command_options => 'get quorum -quorum_id ' . $qid . ' -I' . $options{custom}->get_baie_id(),
92+
command_options => 'get quorum -quorum_id ' . $qid . ' -I' . $options{custom}->get_instance_id(),
9093
no_quit => 1
9194
);
9295
last if is_empty($stdout) || $stdout =~ /^\s+$/ || $exit_code != 0;
9396

9497
# Convert "key: value" formatted output into a hash
9598
my %q;
9699
while ($stdout =~ /^([^\s]+)\s*:\s*(.+)$/mg) {
97-
my $value = $2;
98-
my $key = $1 =~ s/\W//gr;
99-
$q{$key} = $value;
100+
my $value = $2;
101+
my $key = $1 =~ s/\W//gr;
102+
$q{$key} = $value;
100103
}
101104
next unless defined $q{STS};
102105

@@ -109,8 +112,8 @@ sub manage_selection {
109112
ldev => $q{LDEV} // '-'
110113
};
111114

112-
last if $self->{quorum_id} ne '';
113-
$qid++
115+
last if $self->{quorum_id} ne '';
116+
$qid++
114117
}
115118

116119
$self->{output}->option_exit(short_msg => "No quorum found.")
@@ -125,7 +128,7 @@ __END__
125128
126129
Check Hitachi E-Series quorum status.
127130
128-
Command used: C<raidcom get quorum -quorum_id <id> -I<baie-id>>
131+
Command used: C<raidcom get quorum -quorum_id <id> -I<instance-id>>
129132
130133
=over 8
131134

tests/storage/hitachi/eseries/local/bin/raidcom

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ subcmd="$1 $2"
66

77
case "$subcmd" in
88
"get system")
9-
# raidcom get system -key efficiency -I<baie_id>
9+
# raidcom get system -key efficiency -I<instance_id>
1010
cat<<EOF
1111
Serial# TOTAL_EFF_R TLS_R PLS_R PLS_CMP_R PLS_DDP_R PLS_RECLAIM_R FMD_SAVING_R FMD_CMP_R FMD_RECLAIM_R SNAPSHOT_EFF_R PROVISIONING_EFF CALCULATION_START CALCULATION_END
1212
123456 2.50 1.20 1.30 0.50 0.70 0.10 1.50 0.80 0.70 1.10 1.20 2024-01-01 2024-01-02
1313
EOF
1414
;;
1515

1616
"get path")
17-
# raidcom get path -I<baie_id> (use -I9999 to trigger BLK path)
18-
baie_id=""
17+
# raidcom get path -I<instance_id> (use -I9999 to trigger BLK path)
18+
instance_id=""
1919
for arg in "$@"; do
20-
case "$arg" in -I*) baie_id="${arg#-I}";; esac
20+
case "$arg" in -I*) instance_id="${arg#-I}";; esac
2121
done
2222
echo "PHG Group STS CM IF MP Port WWN PR LUN PHS Serial# Product_ID LB PM DM QD TO PBW"
2323
echo "0 0 E 0 - 0 CL1-A 50014380186af83c 0 0 NML 123456 VSP 0 M N 8 N 4096"
2424
echo "0 0 E 0 - 0 CL1-A 50014380186af83c 0 1 NML 123456 VSP 0 M N 8 N 4096"
25-
if [ "$baie_id" = "9999" ]; then
25+
if [ "$instance_id" = "9999" ]; then
2626
echo "0 0 E 0 - 0 CL2-A 50014380186af83d 0 0 BLK 123456 VSP 0 M N 8 N 4096"
2727
else
2828
echo "0 0 E 0 - 0 CL2-A 50014380186af83d 0 0 NML 123456 VSP 0 M N 8 N 4096"
@@ -31,14 +31,14 @@ EOF
3131
;;
3232

3333
"get pool")
34-
# raidcom get pool -I<baie_id>
34+
# raidcom get pool -I<instance_id>
3535
echo "PID POLS U(%) SSCNT Av(MB) Tp(MB) Seq# Num LDEV# H TH Expansion_attribute PoolName"
3636
echo "000 POLN 50 0 204800 409600 123456 1 0x0001 - 80 - TestPool0"
3737
echo "001 POLF 98 0 8192 409600 123456 1 0x0011 - 80 - TestPool1"
3838
;;
3939

4040
"get quorum")
41-
# raidcom get quorum -quorum_id <id> -I<baie_id>
41+
# raidcom get quorum -quorum_id <id> -I<instance_id>
4242
qid=""
4343
shift 2
4444
while [ $# -gt 0 ]; do

tests/storage/hitachi/eseries/local/efficiency.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Test Timeout 120s
99

1010

1111
*** Variables ***
12-
${CMD} ${CENTREON_PLUGINS} --plugin=storage::hitachi::eseries::local::plugin --baie-id=0123 --command-path=${CURDIR}${/}bin
12+
${CMD} ${CENTREON_PLUGINS} --plugin=storage::hitachi::eseries::local::plugin --instance-id=0123 --command-path=${CURDIR}${/}bin
1313

1414

1515
*** Test Cases ***

tests/storage/hitachi/eseries/local/pair-status.robot

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ pair-status ${tc}
1616
[Tags] storage hitachi eseries local pair
1717
${command} Catenate
1818
... ${CMD}
19-
... --baie-id=0123
19+
... --instance-id=0123
2020
... --mode=pair-status
2121
... ${extra_options}
2222

23-
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
23+
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
2424

25-
Examples: tc extra_options expected_result --
26-
... 1 ${EMPTY} UNKNOWN: Please set --group-id option.
27-
... 2 --group-id=GRP1 CRITICAL: Pair 'GRP1 - GRP1-PAIR02' Status (L/R): COPY/COPY (sync: 50%/50%)
28-
... 3 --group-id=GRP2 OK: Pair 'GRP2 - GRP2-PAIR01' Status (L/R): PAIR/PAIR (sync: 100%/100%)
29-
... 4 --group-id=GRP1 --ldev-id=GRP1-PAIR01 OK: Pair 'GRP1 - GRP1-PAIR01' Status (L/R): PAIR/PAIR (sync: 100%/100%)
30-
... 5 --group-id=GRP1 --ldev-id=NONE UNKNOWN: No pair found.
31-
... 6 --mode=pair-status --group-id=GRPERR CRITICAL: Pair 'GRPERR - GRPERR-PAIR01' Status (L/R): PSUE/PSUE (sync: 0%/0%)
32-
... 7 --group-id=GRP2 --remote-baie-id=+10 OK: Pair 'GRP2 - GRP2-PAIR01' Status (L/R): PAIR/PAIR (sync: 100%/100%)
25+
Examples: tc extra_options expected_result --
26+
... 1 ${EMPTY} UNKNOWN: Please set --group-id option.
27+
... 2 --group-id=GRP1 CRITICAL: Pair 'GRP1 - GRP1-PAIR02' Status (L/R): COPY/COPY (sync: 50%/50%)
28+
... 3 --group-id=GRP2 OK: Pair 'GRP2 - GRP2-PAIR01' Status (L/R): PAIR/PAIR (sync: 100%/100%)
29+
... 4 --group-id=GRP1 --ldev-id=GRP1-PAIR01 OK: Pair 'GRP1 - GRP1-PAIR01' Status (L/R): PAIR/PAIR (sync: 100%/100%)
30+
... 5 --group-id=GRP1 --ldev-id=NONE UNKNOWN: No pair found.
31+
... 6 --mode=pair-status --group-id=GRPERR CRITICAL: Pair 'GRPERR - GRPERR-PAIR01' Status (L/R): PSUE/PSUE (sync: 0%/0%)
32+
... 7 --group-id=GRP2 --remote-instance-id=+10 OK: Pair 'GRP2 - GRP2-PAIR01' Status (L/R): PAIR/PAIR (sync: 100%/100%)

tests/storage/hitachi/eseries/local/path-status.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ path-status ${tc}
1717
[Tags] storage hitachi eseries local path
1818
${command} Catenate
1919
... ${CMD}
20-
... --baie-id=0123
20+
... --instance-id=0123
2121
... --mode=path-status
2222
... ${extra_options}
2323

0 commit comments

Comments
 (0)