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