NetApp/Aggregate.pm

filter: Statementstmt 40.4% 101 / 250 Branchbran 39.1% 18 / 46 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 32.5% 14 / 43 Podpod 93.1% 27 / 29 totaltotal 41.3% 160 / 387 CC 33 SCAR 31.2
CC
33
Cov
39%
create_volume
132.0
_parse_aggr_status_aggregate
9.0
get_option
6.0
CRAP 22.8
« NetApp/Snapshot.pm ↑ Summary NetApp/Volume.pm »
1  
2 package NetApp::Aggregate;
3  
4 1 our $VERSION = '500.002';
5 1 $VERSION = eval $VERSION; ## no critic: StringyEval
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use English;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Class::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Params::Validate qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Regexp::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use NetApp::Aggregate::Plex;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use NetApp::Aggregate::RAIDGroup;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 {
20  
21 1 my %filer_of :ATTR( get => 'filer' );
22  
23 1 my %name_of :ATTR( get => 'name' );
24 1 my %state_of :ATTR;
25 1 my %status_of :ATTR;
26 1 my %options_of :ATTR;
27 1 my %volumes_of :ATTR;
28  
29 1 my %plex_of :ATTR( get => 'plex' );
30  
31 0 ▶ sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
32  
33 0 my ($self,$ident,$args_ref) = @_;
34  
35 0 my @args = %$args_ref;
36  
37 0 my (%args) = validate( @args, {
38 filer => { isa => 'NetApp::Filer' },
39 name => { type => SCALAR },
40 state => { type => HASHREF },
41 status => { type => HASHREF },
42 options => { type => HASHREF },
43 volumes => { type => HASHREF },
44 plex => { type => HASHREF },
45 });
46  
47 0 $filer_of{$ident} = $args{filer};
48 0 $name_of{$ident} = $args{name};
49 0 $state_of{$ident} = $args{state};
50 0 $status_of{$ident} = $args{status};
51 0 $options_of{$ident} = $args{options};
52 0 $volumes_of{$ident} = $args{volumes};
53  
54 $plex_of{$ident} =
55 0 NetApp::Aggregate::Plex->new( $args{plex} );
56  
57 }
58  
59 0 ▶ sub get_states {
Subroutine get_states: not called CC=1 SCAR=6.9
Pod documented
60 0 return keys %{ $state_of{ident shift} };
61 }
62  
63 0 ▶ sub get_state {
Subroutine get_state: not called CC=1 SCAR=6.9
Pod documented
64
65 0 my $self = shift;
66 0 my $ident = ident $self;
67 0 my $state = shift;
68  
69 0 return $state_of{$ident}->{$state};
70  
71 }
72  
73 0 ▶ sub get_statuses { # Stati? Oh, hell no...
Subroutine get_statuses: not called CC=1 SCAR=6.9
Pod documented
74 0 return keys %{ $status_of{ident shift} };
75 }
76  
77 0 ▶ sub get_status {
Subroutine get_status: not called CC=1 SCAR=6.9
Pod documented
78  
79 0 my $self = shift;
80 0 my $ident = ident $self;
81 0 my $status = shift;
82  
83 0 return $status_of{$ident}->{$status};
84  
85 }
86  
87 0 ▶ sub get_options {
Subroutine get_options: not called CC=1 SCAR=6.9
Pod documented
88 0 return keys %{ $options_of{ident shift} };
89 }
90  
91 0 ▶ sub get_option {
Subroutine get_option: not called CC=2 SCAR=17.9
Pod documented
92  
93 0 my $self = shift;
94 0 my $ident = ident $self;
95 0 my $option = shift;
96  
97 0 ▶ if ( exists $options_of{$ident}->{$option} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options_of{$ident}{$option}) { } 0 0 0
98 0 return $options_of{$ident}->{$option};
99 } else {
100 0 return undef;
101 }
102  
103 }
104  
105 0 ▶ sub set_option {
Subroutine set_option: not called CC=1 SCAR=6.9
Pod undocumented
106  
107 0 my $self = shift;
108 0 my $option = shift;
109 0 my $value = shift;
110  
111 0 my $ident = ident $self;
112  
113 0 my $name = $self->get_name;
114  
115 0 my @command = ( qw(aggr options), $name, $option, $value );
116  
117 0 $self->get_filer->_run_command( command => @command );
118  
119 0 $options_of{$ident}->{$option} = $value;
120  
121 0 return 1;
122  
123 }
124  
125 0 ▶ sub get_volume_names {
Subroutine get_volume_names: not called CC=1 SCAR=6.9
Pod documented
126 0 return keys %{ $volumes_of{ident shift} };
127 }
128  
129 0 ▶ sub get_volumes {
Subroutine get_volumes: not called CC=2 SCAR=17.9
Pod documented
130  
131 0 my $self = shift;
132  
133 0 my @volumes = ();
134  
135 0 foreach my $volume ( $self->get_volume_names ) {
136 0 push @volumes, $self->get_filer->get_volume( $volume );
137 }
138  
139 0 return @volumes;
140  
141 }
142  
143 0 ▶ sub get_volume {
Subroutine get_volume: not called CC=2 SCAR=17.9
Pod documented
144
145 0 my $self = shift;
146 0 my $ident = ident $self;
147  
148 0 my $name = shift;
149  
150 0 ▶ if ( not exists $volumes_of{$ident}->{$name} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $volumes_of{$ident}{$name}) 0 0 0
151 0 croak(
152 "No such volume $name in aggregate ",
153 $self->get_name, "\n",
154 );
155 }
156  
157 0 return $self->get_filer->get_volume( $name );
158  
159 }
160  
161 0 ▶ sub create_volume {
Subroutine create_volume: not called CC=11 SCAR=48.8
Pod documented
162  
163 0 my $self = shift;
164  
165 0 my (%args) = validate( @_, {
166 name => { type => SCALAR },
167 size => { type => SCALAR },
168 space => { type => SCALAR,
169 regexp => qr{^(none|filer|volume)$},
170 optional => 1 },
171 language => { type => SCALAR,
172 optional => 1 },
173 source_filer => { type => SCALAR,
174 depends => [qw( source_volume )],
175 optional => SCALAR },
176 source_folume => { type => SCALAR,
177 depends => [qw( source_filer )],
178 optional => 1 },
179 });
180  
181 0 ▶ if ( ref $args{source_filer} &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args{"source_filer"} and $args{"source_filer"}->isa("NetApp::Filer")) 0 0 0
Condition0%0/3
ref $args{"source_filer"} and $args{"source_filer"}->isa("NetApp::Filer")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $args{"source_filer"} and $args{"source_filer"}->isa("NetApp::Filer")
ref $args{"source_filer"} $args{"source_filer"}->isa("NetApp::Filer")
Truth table0%0/3
A and B
A= ref $args{"source_filer"}B= $args{"source_filer"}->isa("NetApp::Filer")
ABresult
0X0
100
111
182 $args{source_filer}->isa("NetApp::Filer") ) {
183 0 $args{source_filer} = $args{source_filer}->get_hostname;
184 }
185  
186 0 ▶ if ( ref $args{source_volume} &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args{"source_volume"} and $args{"source_volume"}->isa("NetApp::Volume")) 0 0 0
Condition0%0/3
ref $args{"source_volume"} and $args{"source_volume"}->isa("NetApp::Volume")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $args{"source_volume"} and $args{"source_volume"}->isa("NetApp::Volume")
ref $args{"source_volume"} $args{"source_volume"}->isa("NetApp::Volume")
Truth table0%0/3
A and B
A= ref $args{"source_volume"}B= $args{"source_volume"}->isa("NetApp::Volume")
ABresult
0X0
100
111
187 $args{source_volume}->isa("NetApp::Volume") ) {
188 0 $args{source_volume} = $args{source_volume}->get_name;
189 }
190  
191 0 ▶ if ( $args{source_filer} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"source_filer"} and $args{"space"} || $args{"language"}) 0 0 0
Condition0%0/6
$args{"source_filer"} and $args{"space"} || $args{"language"}
!ll&&!rl&&r
000
$args{"space"} or $args{"language"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args{"source_filer"} and $args{"space"} || $args{"language"}
$args{"source_filer"} $args{"space"} $args{"language"}
Truth table0%0/4
A and B or C
A= $args{"source_filer"}B= $args{"space"}C= $args{"language"}
ABCresult
0XX0
1000
11X1
1011
192 ( $args{space} || $args{language} ) ) {
193 0 croak(
194 "Mutually exclusive options: space and/or language may not\n",
195 "be specified when source_filer/source_volume are given.\n",
196 );
197 }
198  
199 0 my @command = ( qw( vol create ), $args{name} );
200  
201 0 ▶ if ( $args{language} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"language"}) 0 0 0
202 0 push @command, '-l', $args{language};
203 }
204  
205 0 ▶ if ( $args{space} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"space"}) 0 0 0
206 0 push @command, '-s', $args{space};
207 }
208  
209 0 push @command, $self->get_name, $args{size};
210  
211 0 ▶ if ( $args{source_filer} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"source_filer"}) 0 0 0
212 push @command, '-S',
213 0 join( ':', $args{source_filer}, $args{source_volume} );
214 }
215  
216 0 $self->get_filer->_run_command( command => \@command );
217  
218 0 return $self->get_filer->get_volume( name => $args{name} );
219  
220 }
221  
222 0 ▶ sub destroy_volume {
Subroutine destroy_volume: not called CC=2 SCAR=17.9
Pod documented
223  
224 0 my $self = shift;
225 0 my $ident = ident $self;
226  
227 0 my (%args) = validate( @_, {
228 name => { type => SCALAR },
229 });
230  
231 0 my $aggrname = $self->get_name;
232  
233 0 ▶ if ( not $volumes_of{$ident}->{$args{name}} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($volumes_of{$ident}{$args{"name"}}) 0 0 0
234 0 croak("No such volume $args{name} in aggregate $aggrname\n");
235 }
236  
237 $self->get_filer->_run_command(
238 0 command => [qw(vol destroy), $args{name}, '-f'],
239 );
240  
241 0 delete $volumes_of{$ident}->{$args{name}};
242  
243 0 return 1;
244
245 }
246  
247 0 ▶ sub get_qtree_names {
Subroutine get_qtree_names: not called CC=1 SCAR=6.9
Pod documented
248 0 my $self = shift;
249 0 return map { $_->get_name } $self->get_qtrees;
250 }
251  
252 0 ▶ sub get_qtree {
Subroutine get_qtree: not called CC=1 SCAR=6.9
Pod documented
253 0 my $self = shift;
254 0 my $name = shift;
255 0 return $self->get_filer->get_qtree( $name );
256 }
257  
258 0 ▶ sub get_qtrees {
Subroutine get_qtrees: not called CC=2 SCAR=17.9
Pod documented
259  
260 0 my $self = shift;
261  
262 0 my @qtrees = ();
263  
264 0 foreach my $volume ( $self->get_volumes ) {
265 0 push @qtrees, $volume->get_qtrees;
266 }
267
268 0 return @qtrees;
269  
270 }
271  
272 0 ▶ sub get_snapshots {
Subroutine get_snapshots: not called CC=1 SCAR=6.9
Pod documented
273 0 return NetApp::Snapshot->_get_snapshots( parent => shift );
274 }
275  
276 0 ▶ sub get_snapshot {
Subroutine get_snapshot: not called CC=1 SCAR=6.9
Pod documented
277 0 my $self = shift;
278 0 my ($name) = validate_pos( @_, { type => SCALAR } );
279 0 return grep { $_->get_name eq $name } $self->get_snapshots;
280 }
281  
282 0 ▶ sub create_snapshot {
Subroutine create_snapshot: not called CC=1 SCAR=6.9
Pod documented
283 0 my $self = shift;
284 0 my ($name) = validate_pos( @_, { type => SCALAR } );
285 0 return NetApp::Snapshot->_create_snapshot(
286 parent => $self,
287 name => $name,
288 );
289 }
290  
291 0 ▶ sub delete_snapshot {
Subroutine delete_snapshot: not called CC=1 SCAR=6.9
Pod documented
292 0 my $self = shift;
293 0 my ($name) = validate_pos( @_, { type => SCALAR } );
294 0 return NetApp::Snapshot->_delete_snapshot(
295 parent => $self,
296 name => $name,
297 );
298 }
299  
300 0 ▶ sub get_snapshot_deltas {
Subroutine get_snapshot_deltas: not called CC=1 SCAR=6.9
Pod documented
301 0 return NetApp::Snapshot->_get_snapshot_deltas( parent => shift );
302 }
303  
304 0 ▶ sub get_snapshot_reserved {
Subroutine get_snapshot_reserved: not called CC=1 SCAR=6.9
Pod documented
305 0 return NetApp::Snapshot->_get_snapshot_reserved( parent => shift );
306 }
307  
308 0 ▶ sub set_snapshot_reserved {
Subroutine set_snapshot_reserved: not called CC=1 SCAR=6.9
Pod documented
309 0 my $self = shift;
310 0 my ($reserved) = validate_pos( @_, { type => SCALAR } );
311 0 return NetApp::Snapshot->_set_snapshot_reserved(
312 parent => $self,
313 reserved => $reserved,
314 );
315 }
316  
317 0 ▶ sub get_snapshot_schedule {
Subroutine get_snapshot_schedule: not called CC=1 SCAR=6.9
Pod documented
318 0 return NetApp::Snapshot->_get_snapshot_schedule(
319 parent => shift,
320 @_
321 );
322 }
323  
324 0 ▶ sub set_snapshot_schedule {
Subroutine set_snapshot_schedule: not called CC=1 SCAR=6.9
Pod documented
325 0 return NetApp::Snapshot->_set_snapshot_schedule(
326 parent => shift,
327 @_
328 );
329 }
330  
331 0 ▶ sub rename {
Subroutine rename: not called CC=1 SCAR=6.9
Pod documented
332  
333 0 my $self = shift;
334 0 my $ident = ident $self;
335  
336 0 my (%args) = validate( @_, {
337 newname => { type => SCALAR },
338 });
339  
340 0 my $oldname = $self->get_name;
341  
342 $self->get_filer->_run_command(
343 0 command => [qw(aggr rename), $oldname, $args{newname}],
344 );
345  
346 0 $name_of{$ident} = $args{newname};
347  
348 0 return 1;
349  
350 }
351  
352 0 ▶ sub offline {
Subroutine offline: not called CC=2 SCAR=17.9
Pod documented
353  
354 0 my $self = shift;
355 0 my $ident = ident $self;
356  
357 0 my (%args) = validate( @_, {
358 cifsdelaytime => { type => SCALAR,
359 optional => 1 },
360 });
361  
362 0 my @command = ( qw(aggr offline), $self->get_name );
363  
364 0 ▶ if ( $args{cifsdelaytime} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"cifsdelaytime"}) 0 0 0
365 0 push @command, '-t', $args{cifsdelaytime};
366 }
367  
368 $self->get_filer->_run_command(
369 0 command => \@command,
370 );
371  
372 0 delete $state_of{$ident}->{online};
373 0 delete $state_of{$ident}->{restricted};
374 0 $state_of{$ident}->{offline} = 1;
375
376 0 return 1;
377  
378 }
379  
380 0 ▶ sub online {
Subroutine online: not called CC=2 SCAR=17.9
Pod documented
381  
382 0 my $self = shift;
383 0 my $ident = ident $self;
384  
385 0 my (%args) = validate( @_, {
386 force => { type => SCALAR,
387 optional => 1 },
388 });
389  
390 0 my @command = ( qw( aggr online ), $self->get_name );
391  
392 0 ▶ if ( $args{force} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"force"}) 0 0 0
393 0 push @command, '-f';
394 }
395
396 $self->get_filer->_run_command(
397 0 command => \@command,
398 );
399  
400 0 delete $state_of{$ident}->{offline};
401 0 delete $state_of{$ident}->{restricted};
402 0 $state_of{$ident}->{online} = 1;
403
404 0 return 1;
405  
406 }
407  
408 0 ▶ sub restrict {
Subroutine restrict: not called CC=2 SCAR=17.9
Pod documented
409
410 0 my $self = shift;
411 0 my $ident = ident shift;
412  
413 0 my (%args) = validate( @_, {
414 cifsdelaytime => { type => SCALAR,
415 optional => 1 },
416 });
417  
418 0 my @command = ( qw(aggr restrict), $self->get_name );
419  
420 0 ▶ if ( $args{cifsdelaytime} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"cifsdelaytime"}) 0 0 0
421 0 push @command, '-t', $args{cifsdelaytime};
422 }
423  
424 $self->get_filer->_run_command(
425 0 command => \@command,
426 );
427  
428 0 delete $state_of{$ident}->{offline};
429 0 delete $state_of{$ident}->{online};
430 0 $state_of{$ident}->{restricted} = 1;
431  
432 0 return 1;
433  
434 }
435  
436
437  
438 }
439  
440 # Class methods for parsing aggr command output
441  
442 1 ▶sub _parse_aggr_status_headers {
Subroutine _parse_aggr_status_headers: called CC=4 SCAR=13.9
443  
444 4 my $class = shift;
445 4 my $header = shift;
446  
447 4 my $indices = {};
448 4 my $index = 0;
449  
450 4 ▶ my ($aggr) = ( $header =~ /(^\s+Aggr\s+)/ ) or
Branch: 1 branch
BranchTrueFalseTotal
my($aggr) = $header =~ /(^\s+Aggr\s+)/ or croak("Unable to match 'Aggr' column header\n") 3 1 4
451 croak(
452 "Unable to match 'Aggr' column header\n"
453 );
454  
455 3 $indices->{aggr} = [ 0, length($aggr) ];
456 3 $index += length($aggr);
457  
458 3 ▶ my ($state) = ( $header =~ /(State\s+)/ ) or
Branch: 1 branch
BranchTrueFalseTotal
my($state) = $header =~ /(State\s+)/ or croak("Unable to match 'State' column header\n") 2 1 3
459 croak(
460 "Unable to match 'State' column header\n"
461 );
462  
463 2 $indices->{state} = [ $index, length($state) ];
464 2 $index += length($state);
465  
466 2 ▶ my ($status) = ( $header =~ /(Status\s+)/ ) or
Branch: 1 branch
BranchTrueFalseTotal
my($status) = $header =~ /(Status\s+)/ or croak("Unable to match 'Status' column header\n") 1 1 2
467 croak(
468 "Unable to match 'Status' column header\n"
469 );
470
471 1 $indices->{status} = [ $index, length($status) ];
472 1 $index += length($status);
473  
474 1 $indices->{options} = [ $index ];
475  
476 1 return $indices;
477  
478 }
479  
480 2 ▶sub _parse_aggr_status_aggregate {
Subroutine _parse_aggr_status_aggregate: called CC=9 SCAR=22.0
481  
482 2 my $class = shift;
483
484 2 my %args = validate( @_, {
485 indices => { type => HASHREF },
486 line => { type => SCALAR },
487 aggregate => { type => HASHREF,
488 default => {},
489 optional => 1 },
490 });
491
492 2 my $indices = $args{indices};
493 2 my $aggregate = $args{aggregate};
494 2 my $line = $args{line};
495  
496 2 ▶ if ( $line =~ m{Volumes: <N/A>} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ m[Volumes: <N/A>]) 0 2 2
497 0 return $aggregate;
498 }
499  
500 2 foreach my $column ( qw( aggr state status options ) ) {
501  
502 8 my $value = "";
503  
504 8 ▶ if ( $indices->{$column}->[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($indices->{$column}[1]) { } 6 2 8
505 $value = substr( $line,
506 $indices->{$column}->[0],
507 6 $indices->{$column}->[1] );
508 } else {
509 $value = substr( $line,
510 2 $indices->{$column}->[0] );
511 }
512  
513 8 $value =~ s/$RE{ws}{crop}//g;
514  
515 8 ▶ if ( $column eq 'aggr' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($column eq 'aggr') { } 2 6 8
516 2 ▶ if ( $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) 1 1 2
517  
518 1 $aggregate->{name} = $value;
519  
520 1 my ($name) = split( /\s+/, $line );
521  
522 1 ▶ if ( length($name) > length($value) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $name > length $value) 1 0 1
523 1 $aggregate->{name} = $name;
524 1 $line =~ s/^$name/$value/;
525 }
526  
527 }
528 } else {
529 6 foreach my $entry ( split( /[,\s]+/, $value ) ) {
530  
531 7 my ($key,$value);
532  
533 7 ▶ if ( $entry =~ /=/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry =~ /=/) { } 1 6 7
534 1 ($key,$value) = split( /=/, $entry, 2 );
535 } else {
536 6 ($key,$value) = ($entry,1);
537 }
538  
539 7 $aggregate->{$column}->{$key} = $value;
540  
541 }
542 }
543  
544 }
545  
546 2 return $aggregate;
547  
548 }
549  
550 3 ▶sub _parse_aggr_status_volumes {
Subroutine _parse_aggr_status_volumes: called CC=2 SCAR=6.9
551  
552 3 my $class = shift;
553  
554 3 my %args = validate( @_, {
555 volumes => { type => HASHREF },
556 line => { type => SCALAR },
557 });
558
559 3 my $volumes = $args{volumes};
560 3 my $line = $args{line};
561  
562 3 $line =~ s/Volumes://g;
563 3 $line =~ s/$RE{ws}{crop}//g;
564 3 $line =~ s/,//g;
565  
566 3 foreach my $volume ( split( /\s+/, $line ) ) {
567 6 $volumes->{$volume}++;
568 }
569  
570 3 return 1;
571  
572 }
573  
574 1 ▶sub _parse_aggr_status_plex {
Subroutine _parse_aggr_status_plex: called CC=2 SCAR=7.0
575  
576 1 my $class = shift;
577 1 my $line = shift;
578  
579 1 $line =~ s/$RE{ws}{crop}//g;
580  
581 1 ▶ my ($name,$state) = ( $line =~ m{Plex\s+(\S+): (.*)} ) or
Branch: 1 branch
BranchTrueFalseTotal
() = $line =~ /Plex\s+(\S+): (.*)/ or croak("Unable to parse Plex name and state:\n$line\n") 1 0 1
582 croak(
583 "Unable to parse Plex name and state:\n$line\n"
584 );
585  
586 return {
587 name => $name,
588 1 state => { map { $_ => 1 } split( /[,\s]+/, $state ) },
589 };
590  
591 }
592  
593 1 ▶sub _parse_aggr_status_raidgroup {
Subroutine _parse_aggr_status_raidgroup: called CC=2 SCAR=7.0
594  
595 1 my $class = shift;
596 1 my $line = shift;
597  
598 1 $line =~ s/$RE{ws}{crop}//g;
599  
600 1 ▶ my ($name,$state) = ( $line =~ m{RAID group\s+(\S+): (.*)} ) or
Branch: 1 branch
BranchTrueFalseTotal
() = $line =~ /RAID group\s+(\S+): (.*)/ or croak("Unable to parse RAIDGroup name and state:\n$line\n") 1 0 1
601 croak(
602 "Unable to parse RAIDGroup name and state:\n$line\n"
603 );
604  
605 return {
606 name => $name,
607 1 state => { map { $_ => 1 } split( /[,\s]+/, $state ) },
608 };
609  
610 }
611  
612 1 1;
« NetApp/Snapshot.pm ↑ Summary NetApp/Volume.pm »