| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package NetApp::Qtree; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '500.002'; |
|
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic: StringyEval |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
606
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
32
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use English; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
10
|
1
|
|
|
1
|
|
544
|
use Carp; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
66
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
7
|
use Class::Std; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
13
|
1
|
|
|
1
|
|
120
|
use Params::Validate qw( :all ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
237
|
|
|
14
|
1
|
|
|
1
|
|
7
|
use Regexp::Common; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my %filer_of :ATTR( get => 'filer' ); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %volume_name_of :ATTR( get => 'volume_name' ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %name_of :ATTR( get => 'name' ); |
|
23
|
|
|
|
|
|
|
my %security_of :ATTR( get => 'security' ); |
|
24
|
|
|
|
|
|
|
my %oplocks_of :ATTR( get => 'oplocks' ); |
|
25
|
|
|
|
|
|
|
my %status_of :ATTR( get => 'status' ); |
|
26
|
|
|
|
|
|
|
my %id_of :ATTR( get => 'id' ); |
|
27
|
|
|
|
|
|
|
my %vfiler_of :ATTR( get => 'vfiler' ); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub BUILD { |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
0
|
0
|
my ($self,$ident,$args_ref) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
my @args = %$args_ref; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
my (%args) = validate( @args, { |
|
36
|
|
|
|
|
|
|
filer => { isa => 'NetApp::Filer' }, |
|
37
|
|
|
|
|
|
|
volume_name => { type => SCALAR }, |
|
38
|
|
|
|
|
|
|
name => { type => SCALAR }, |
|
39
|
|
|
|
|
|
|
security => { type => SCALAR }, |
|
40
|
|
|
|
|
|
|
oplocks => { type => SCALAR }, |
|
41
|
|
|
|
|
|
|
status => { type => SCALAR }, |
|
42
|
|
|
|
|
|
|
id => { type => SCALAR }, |
|
43
|
|
|
|
|
|
|
vfiler => { type => SCALAR, |
|
44
|
|
|
|
|
|
|
optional => 1 }, |
|
45
|
|
|
|
|
|
|
}); |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
$filer_of{$ident} = $args{filer}; |
|
48
|
0
|
|
|
|
|
0
|
$volume_name_of{$ident} = $args{volume_name}; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
0
|
$name_of{$ident} = $args{name}; |
|
51
|
0
|
|
|
|
|
0
|
$security_of{$ident} = $args{security}; |
|
52
|
0
|
|
|
|
|
0
|
$oplocks_of{$ident} = $args{oplocks}; |
|
53
|
0
|
|
|
|
|
0
|
$status_of{$ident} = $args{status}; |
|
54
|
0
|
|
|
|
|
0
|
$id_of{$ident} = $args{id}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
0
|
if ( $args{vfiler} ) { |
|
57
|
0
|
|
|
|
|
0
|
$vfiler_of{$ident} = $args{vfiler}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub get_volume { |
|
63
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
64
|
0
|
|
|
|
|
0
|
return $self->get_filer->get_volume( $self->get_volume_name ); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub get_aggregate { |
|
68
|
0
|
|
|
0
|
0
|
0
|
return shift->get_volume->get_aggregate; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub set_security { |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
74
|
0
|
|
|
|
|
0
|
my $ident = ident $self; |
|
75
|
0
|
|
|
|
|
0
|
my $security = shift; |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
0
|
if ( $security !~ /^(unix|ntfs|mixed)$/ ) { |
|
78
|
0
|
|
|
|
|
0
|
croak("Invalid qtree security value: $security\n"); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
0
|
my $name = $self->get_name; |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
$self->get_filer->_run_command( |
|
84
|
|
|
|
|
|
|
command => [qw( qtree security ), $name, $security ], |
|
85
|
|
|
|
|
|
|
); |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
0
|
$security_of{$ident} = $security; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub set_oplocks { |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
94
|
0
|
|
|
|
|
0
|
my $ident = ident $self; |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
0
|
my $state = shift; |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
0
|
my $enable = $state ? 'enable' : 'disable'; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
0
|
my $name = $self->get_name; |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
0
|
$self->get_filer->_run_command( |
|
103
|
|
|
|
|
|
|
command => [qw( qtree oplocks ), $name, $enable ], |
|
104
|
|
|
|
|
|
|
); |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
0
|
$oplocks_of{$ident} = $enable eq 'enable' ? 1 : 0; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub get_temporary_exports { |
|
111
|
0
|
|
|
0
|
0
|
0
|
return grep { $_->get_type eq 'temporary' } shift->get_exports; |
|
|
0
|
|
|
|
|
0
|
|
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub get_permanent_exports { |
|
115
|
0
|
|
|
0
|
0
|
0
|
return grep { $_->get_type eq 'permanent' } shift->get_exports; |
|
|
0
|
|
|
|
|
0
|
|
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub get_active_exports { |
|
119
|
0
|
|
|
0
|
0
|
0
|
return grep { $_->get_active } shift->get_exports; |
|
|
0
|
|
|
|
|
0
|
|
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub get_inactive_exports { |
|
123
|
0
|
|
|
0
|
0
|
0
|
return grep { not $_->get_active } shift->get_exports; |
|
|
0
|
|
|
|
|
0
|
|
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub get_export { |
|
127
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
128
|
0
|
|
|
|
|
0
|
my ($path) = validate_pos( @_, { type => SCALAR } ); |
|
129
|
0
|
|
|
|
|
0
|
return grep { $_->get_path eq $path } $self->get_exports; |
|
|
0
|
|
|
|
|
0
|
|
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub get_exports { |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
my @exports = (); |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
0
|
foreach my $export ( $self->get_filer->get_exports ) { |
|
139
|
|
|
|
|
|
|
|
|
140
|
0
|
0
|
|
|
|
0
|
if ( $export->get_path eq $self->get_name ) { |
|
|
|
0
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
0
|
push @exports, $export; |
|
142
|
|
|
|
|
|
|
} elsif ( $export->get_actual eq $self->get_name ) { |
|
143
|
0
|
|
|
|
|
0
|
push @exports, $export; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
0
|
return @exports; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub _parse_qtree_status_qtree { |
|
155
|
|
|
|
|
|
|
|
|
156
|
2
|
|
|
2
|
|
2700
|
my $class = shift; |
|
157
|
2
|
|
|
|
|
2
|
my $line = shift; |
|
158
|
|
|
|
|
|
|
|
|
159
|
2
|
|
|
|
|
4
|
my $qtree = {}; |
|
160
|
|
|
|
|
|
|
|
|
161
|
2
|
|
|
|
|
11
|
my @data = split( /\s+/, $line ); |
|
162
|
|
|
|
|
|
|
|
|
163
|
2
|
|
|
|
|
5
|
$qtree->{volume_name} = shift @data; |
|
164
|
|
|
|
|
|
|
|
|
165
|
2
|
|
|
|
|
5
|
$qtree->{name} = "/vol/$qtree->{volume_name}"; |
|
166
|
|
|
|
|
|
|
|
|
167
|
2
|
100
|
|
|
|
12
|
if ( $data[0] !~ /^(unix|ntfs|mixed)$/ ) { |
|
168
|
1
|
|
|
|
|
5
|
$qtree->{name} .= "/" . shift @data; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
2
|
|
|
|
|
4
|
$qtree->{security} = $data[0]; |
|
172
|
2
|
50
|
|
|
|
7
|
$qtree->{oplocks} = $data[1] eq 'enabled' ? 1 : 0; |
|
173
|
2
|
|
|
|
|
3
|
$qtree->{status} = $data[2]; |
|
174
|
2
|
|
|
|
|
4
|
$qtree->{id} = $data[3]; |
|
175
|
|
|
|
|
|
|
|
|
176
|
2
|
50
|
|
|
|
4
|
if ( $data[4] ) { |
|
177
|
2
|
|
|
|
|
4
|
$qtree->{vfiler} = $data[4]; |
|
178
|
|
|
|
|
|
|
} |
|
179
|
|
|
|
|
|
|
|
|
180
|
2
|
|
|
|
|
6
|
return $qtree; |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
1; |