line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package NetApp::Snapmirror; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '500.002'; |
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic: StringyEval |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
562
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
9
|
1
|
|
|
1
|
|
5
|
use English; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
10
|
1
|
|
|
1
|
|
443
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Class::Std; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
13
|
1
|
|
|
1
|
|
121
|
use Params::Validate qw( :all ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
167
|
|
14
|
1
|
|
|
1
|
|
5
|
use Regexp::Common; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1050
|
use NetApp::Snapmirror::Source; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
17
|
1
|
|
|
1
|
|
508
|
use NetApp::Snapmirror::Destination; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
750
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %filer_of :ATTR( get => 'filer' ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %source_of :ATTR( get => 'source' ); |
24
|
|
|
|
|
|
|
my %destination_of :ATTR( get => 'destination' ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my %status_of :ATTR( get => 'status' ); |
27
|
|
|
|
|
|
|
my %progress_of :ATTR( get => 'progress' ); |
28
|
|
|
|
|
|
|
my %state_of :ATTR( get => 'state' ); |
29
|
|
|
|
|
|
|
my %lag_of :ATTR( get => 'lag' ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my %mirror_timestamp_of :ATTR( get => 'mirror_timestamp' ); |
32
|
|
|
|
|
|
|
my %base_snapshot_of :ATTR( get => 'base_snapshot' ); |
33
|
|
|
|
|
|
|
my %current_transfer_type_of |
34
|
|
|
|
|
|
|
:ATTR( get => 'current_transfer_type' ); |
35
|
|
|
|
|
|
|
my %current_transfer_error_of |
36
|
|
|
|
|
|
|
:ATTR( get => 'current_transfer_error' ); |
37
|
|
|
|
|
|
|
my %contents_of :ATTR( get => 'contents' ); |
38
|
|
|
|
|
|
|
my %last_transfer_type_of |
39
|
|
|
|
|
|
|
:ATTR( get => 'last_transfer_type' ); |
40
|
|
|
|
|
|
|
my %last_transfer_size_of |
41
|
|
|
|
|
|
|
:ATTR( get => 'last_transfer_size' ); |
42
|
|
|
|
|
|
|
my %last_transfer_duration_of |
43
|
|
|
|
|
|
|
:ATTR( get => 'last_transfer_duration' ); |
44
|
|
|
|
|
|
|
my %last_transfer_from_of |
45
|
|
|
|
|
|
|
:ATTR( get => 'last_transfer_from' ); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub BUILD { |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
0
|
0
|
my ($self,$ident,$args_ref) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
0
|
my @args = %$args_ref; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
my (%args) = validate( @args, { |
54
|
|
|
|
|
|
|
filer => { isa => 'NetApp::Filer' }, |
55
|
|
|
|
|
|
|
source => { type => HASHREF, |
56
|
|
|
|
|
|
|
optional => 1 }, |
57
|
|
|
|
|
|
|
destination => { type => HASHREF }, |
58
|
|
|
|
|
|
|
status => { type => SCALAR }, |
59
|
|
|
|
|
|
|
progress => { type => SCALAR }, |
60
|
|
|
|
|
|
|
state => { type => SCALAR }, |
61
|
|
|
|
|
|
|
lag => { type => SCALAR }, |
62
|
|
|
|
|
|
|
mirror_timestamp => { type => SCALAR }, |
63
|
|
|
|
|
|
|
base_snapshot => { type => SCALAR }, |
64
|
|
|
|
|
|
|
current_transfer_type => { type => SCALAR }, |
65
|
|
|
|
|
|
|
current_transfer_error => { type => SCALAR }, |
66
|
|
|
|
|
|
|
contents => { type => SCALAR }, |
67
|
|
|
|
|
|
|
last_transfer_type => { type => SCALAR }, |
68
|
|
|
|
|
|
|
last_transfer_size => { type => SCALAR }, |
69
|
|
|
|
|
|
|
last_transfer_duration => { type => SCALAR }, |
70
|
|
|
|
|
|
|
last_transfer_from => { type => SCALAR }, |
71
|
|
|
|
|
|
|
}); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
0
|
$filer_of{$ident} = $args{filer}; |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
0
|
if ( $args{source} ) { |
76
|
0
|
|
|
|
|
0
|
$source_of{$ident} = |
77
|
|
|
|
|
|
|
NetApp::Snapmirror::Source->new( $args{source} ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
0
|
$destination_of{$ident} = |
81
|
|
|
|
|
|
|
NetApp::Snapmirror::Destination->new( $args{destination} ); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
$status_of{$ident} = $args{status}; |
84
|
0
|
|
|
|
|
0
|
$progress_of{$ident} = $args{progress}; |
85
|
0
|
|
|
|
|
0
|
$state_of{$ident} = $args{state}; |
86
|
0
|
|
|
|
|
0
|
$lag_of{$ident} = $args{lag}; |
87
|
0
|
|
|
|
|
0
|
$mirror_timestamp_of{$ident} = $args{mirror_timestamp}; |
88
|
0
|
|
|
|
|
0
|
$base_snapshot_of{$ident} = $args{base_snapshot}; |
89
|
0
|
|
|
|
|
0
|
$current_transfer_type_of{$ident} = $args{current_transfer_type}; |
90
|
0
|
|
|
|
|
0
|
$current_transfer_error_of{$ident} = $args{current_transfer_error}; |
91
|
0
|
|
|
|
|
0
|
$contents_of{$ident} = $args{contents}; |
92
|
0
|
|
|
|
|
0
|
$last_transfer_type_of{$ident} = $args{last_transfer_type}; |
93
|
0
|
|
|
|
|
0
|
$last_transfer_size_of{$ident} = $args{last_transfer_size}; |
94
|
0
|
|
|
|
|
0
|
$last_transfer_duration_of{$ident} = $args{last_transfer_duration}; |
95
|
0
|
|
|
|
|
0
|
$last_transfer_from_of{$ident} = $args{last_transfer_from}; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub _parse_snapmirror_status { |
102
|
|
|
|
|
|
|
|
103
|
15
|
|
|
15
|
|
95
|
my $class = shift; |
104
|
|
|
|
|
|
|
|
105
|
15
|
|
|
|
|
348
|
my (%args) = validate( @_, { |
106
|
|
|
|
|
|
|
snapmirror => { type => HASHREF }, |
107
|
|
|
|
|
|
|
line => { type => SCALAR }, |
108
|
|
|
|
|
|
|
}); |
109
|
|
|
|
|
|
|
|
110
|
15
|
|
|
|
|
85
|
my $snapmirror = $args{snapmirror}; |
111
|
15
|
|
|
|
|
21
|
my $line = $args{line}; |
112
|
|
|
|
|
|
|
|
113
|
15
|
|
|
|
|
63
|
my ($key,$value) = split( /:\s+/, $line, 2 ); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# 'Last Transfer Type' => 'last_transfer_type' |
116
|
15
|
|
|
|
|
54
|
$key =~ s/\s/_/g; |
117
|
15
|
|
|
|
|
26
|
$key = lc($key); |
118
|
|
|
|
|
|
|
|
119
|
15
|
100
|
|
|
|
33
|
if ( $value eq '-' ) { |
120
|
5
|
|
|
|
|
10
|
$value = ''; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
15
|
100
|
100
|
|
|
61
|
if ( $key eq 'source' || $key eq 'destination' ) { |
124
|
2
|
50
|
|
|
|
11
|
if ( my ($hostname,$volume) = split( /:/, $value ) ) { |
125
|
2
|
|
|
|
|
9
|
$snapmirror->{$key} = { |
126
|
|
|
|
|
|
|
hostname => $hostname, |
127
|
|
|
|
|
|
|
volume => $volume, |
128
|
|
|
|
|
|
|
}; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} else { |
131
|
13
|
|
|
|
|
36
|
$snapmirror->{$key} = $value; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
15
|
|
|
|
|
67
|
return $snapmirror; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |