lib/NBU/Class.pm

filter: Statementstmt 10.6% 33 / 310 Branchbran 0.0% 0 / 176 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 17.0% 8 / 47 Podpod 0.0% 0 / 39 totaltotal 6.8% 41 / 595 CC 96 SCAR 41.1
CC
96
Cov
7%
loadClasses
342.0
active
72.0
loadSchedule
42.0
CRAP 61.1
« lib/NBU/Pool.pm ↑ Summary lib/NBU/Drive.pm »
1 #
2 # Copyright (c) 2002 Paul Winkeler. All Rights Reserved.
3 # This program is free software; you may redistribute it and/or modify it under
4 # the same terms as Perl itself.
5 #
6 package NBU::Class;
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use NBU::Host;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use NBU::Schedule;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 my %classRoom;
15  
16 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use AutoLoader qw(AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 $VERSION = do { my @r=(q$Revision: 1.29 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r };
21 1 @ISA = qw();
22 1 @EXPORT = qw();
23 1 @EXPORT_OK = qw();
24 1 %EXPORT_TAGS = qw();
25 }
26  
27 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod undocumented
28 0 my $proto = shift;
29 0 my $class;
30  
31 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
32 0 my $name = shift;
33 0 my $type = shift;
34 0 my $master = shift;
35  
36 0 ▶ if (!exists($classRoom{$name})) {
Branch: 2 branches
BranchTrueFalseTotal
if (not exists $classRoom{$name}) { } 0 0 0
elsif (not defined($class = $classRoom{$name}) or $class->{'TYPE'} ne $type) { } 0 0 0
37 0 $class = {
38 CLIENTS => [],
39 };
40 0 bless $class, $proto;
41  
42 0 $classRoom{$class->{NAME} = $name} = $class;
43 0 $class->{TYPE} = $type;
44 0 $class->{LOADED} = 0;
45 }
46 ▶ elsif (!defined($class = $classRoom{$name}) || ($class->{TYPE} ne $type)) {
Condition0%0/3
not defined($class = $classRoom{$name}) or $class->{"TYPE"} ne $type
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined($class = $classRoom{$name}) or $class->{"TYPE"} ne $type
not defined($class = $classRoom{$name}) $class->{"TYPE"} ne $type
Truth table0%0/3
not(A) or B
A= not defined($class = $classRoom{$name})B= $class->{"TYPE"} ne $type
ABresult
1X1
011
000
47 0 $class = {
48 CLIENTS => [],
49 };
50 0 bless $class, $proto;
51  
52 0 $classRoom{$class->{NAME} = $name} = undef;
53 0 $class->{TYPE} = $type;
54 0 $class->{LOADED} = 0;
55 }
56 0 $class->{MASTER} = $master;
57 }
58 0 return $class;
59 }
60  
61 1 my %classTypes = (
62 0 => "Standard",
63 3 => "Apollo_WBAK",
64 4 => "Oracle",
65 6 => "Informix",
66 7 => "Sybase",
67 10 => "NetWare",
68 11 => "BackTrack",
69 12 => "Auspex_Fastback",
70 13 => "Windows_NT",
71 14 => "OS2",
72 15 => "SQL_Server",
73 16 => "Exchange",
74 17 => "SAP",
75 18 => "DB2",
76 19 => "NDMP",
77 20 => "FlashBackup",
78 21 => "SplitMirror",
79 22 => "AFS",
80 29 => "VCB",
81 30 => "Vault",
82 35 => "NBU-Catalog",
83 );
84  
85 1 my $rollCalled = 0;
86 0 ▶sub populate {
Subroutine populate: not called CC=5 SCAR=34.0
Pod undocumented
87 0 my $proto = shift;
88 0 ▶ my $self = ref($proto) ? $proto : undef;;
Branch: 1 branch
BranchTrueFalseTotal
ref $proto ? : 0 0 0
89 0 my $master = shift;
90  
91 0 ▶ if (!defined($master)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $master) 0 0 0
92 0 my @masters = NBU->masters; $master = $masters[0];
93 }
94  
95 0 NBU::Pool->populate;
96  
97 0 ▶ my $source = defined($self) ? $self->name : "-allclasses";
Branch: 1 branch
BranchTrueFalseTotal
defined $self ? : 0 0 0
98 0 my $pipe = NBU->cmd("bpcllist $source -l -M ".$master->name." |");
99  
100 0 ▶ $proto->loadClasses($pipe, defined($self) ? "CLASS" : "ALL", $master);
Branch: 1 branch
BranchTrueFalseTotal
defined $self ? : 0 0 0
101  
102 #
103 # If the entire class was being loaded, we'll consider the roll to
104 # have been called.
105 0 $rollCalled = !defined($self);
106 }
107  
108 0 ▶sub loadClasses {
Subroutine loadClasses: not called CC=18 SCAR=58.3
Pod undocumented
109 0 my $proto = shift;
110 0 my $pipe = shift;
111 0 my $focus = shift;
112 0 my $master = shift;
113  
114 0 my $class;
115 my $className;
116 0 my $schedule;
117  
118 0 ▶ while (<$pipe>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $pipe)) 0 0 0
119 0 chop;
120 0 ▶ if (/^CLASS/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^CLASS/) 0 0 0
121 #
122 # Simply remember the initial class name and defer creating it until we know its
123 # type on the next INFO line. Just to be safe, we'll set the running class variable
124 # to null...
125 0 my ($tag, $name, $ptr1, $u1, $u2, $u3, $ptr2) = split;
126 0 $className = $name;
127 0 $class = undef;
128 0 next;
129 }
130 0 ▶ if (/^NAMES/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^NAMES/) 0 0 0
131 0 next;
132 }
133 0 ▶ if (/^INFO/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^INFO/) 0 0 0
134 0 my ($tag, $type, $networkDrives, $clientCompression, $priority, $ptr1,
135 $u2, $u3, $maxJobs, $crossMounts, $followNFS,
136 $inactive, $TIR, $u6, $u7, $restoreFromRaw, $multipleDataStreams, $ptr2) = split;
137  
138 0 $class = NBU::Class->new($className, $type, $master);
139 0 $class->{LOADED} = $focus =~ /CLASS|ALL/;
140  
141 0 $class->{NETWORKDRIVES} = $networkDrives;
142 0 $class->{COMPRESSION} = $clientCompression;
143 0 $class->{PRIORITY} = $priority;
144 0 $class->{MAXJOBS} = $maxJobs;
145 0 $class->{CROSS} = $crossMounts;
146 0 $class->{FOLLOW} = $followNFS;
147 0 $class->{ACTIVE} = !$inactive;
148 0 $class->{TIR} = $TIR;
149 0 $class->{RESTOREFROMRAW} = $restoreFromRaw;
150 0 $class->{MDS} = $multipleDataStreams;
151 0 next;
152 }
153 0 ▶ if (/^KEY /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^KEY /) 0 0 0
154 0 my ($tag, @keys) = split;;
155 0 ▶ $class->{KEYS} = \@keys unless ($keys[0] eq "*NULL*");
Branch: 1 branch
BranchTrueFalseTotal
unless $keys[0] eq "*NULL*" 0 0 0
156 0 next;
157 }
158 0 ▶ if (/^BCMD /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^BCMD /) 0 0 0
159 0 next;
160 }
161 0 ▶ if (/^RCMD /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^RCMD /) 0 0 0
162 0 next;
163 }
164 0 ▶ if (/^RES /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^RES /) 0 0 0
165 0 my ($tag, @residences) = split;
166 0 ▶ $class->{RESIDENCE} = NBU::StorageUnit->byLabel($residences[0]) unless ($residences[0] eq "*NULL*");
Branch: 1 branch
BranchTrueFalseTotal
unless $residences[0] eq "*NULL*" 0 0 0
167 0 next;
168 }
169 0 ▶ if (/^POOL /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^POOL /) 0 0 0
170 0 my ($tag, @pools) = split;
171 0 ▶ $class->{POOL} = NBU::Pool->byName($pools[0]) unless ($pools[0] eq "*NULL*");
Branch: 1 branch
BranchTrueFalseTotal
unless $pools[0] eq "*NULL*" 0 0 0
172 0 next;
173 }
174 0 ▶ if (/^CLIENT /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^CLIENT /) 0 0 0
175 0 my ($tag, $name, $platform, $os) = split;
176 0 my $client = NBU::Host->new($name);
177 0 $class->loadClient($client);
178 0 $client->makeClassMember($class);
179 0 ▶ $client->enrolled if ($focus =~ /CLIENT|ALL/);
Branch: 1 branch
BranchTrueFalseTotal
if $focus =~ /CLIENT|ALL/ 0 0 0
180 0 next;
181 }
182 0 ▶ if (/^INCLUDE /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^INCLUDE /) 0 0 0
183 0 my ($tag, $path) = split(/[\s]+/, $_, 2);
184 0 $class->include($path);
185 0 next;
186 }
187 0 ▶ if (/^EXCLUDE /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^EXCLUDE /) 0 0 0
188 0 my ($tag, $path) = split(/[\s]+/, $_, 2);
189 0 $class->exclude($path);
190 0 next;
191 }
192 0 ▶ if (/^SCHED /) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^SCHED /) 0 0 0
193 0 my ($tag, $name, $type, @schedAttr) = split;
194 0 $schedule = $class->loadSchedule(NBU::Schedule->new($class, $name, $type, $pipe, @schedAttr));
195 0 next;
196 }
197 }
198 0 close($pipe);
199 }
200  
201 0 ▶sub byName {
Subroutine byName: not called CC=3 SCAR=24.8
Pod undocumented
202 0 my $proto = shift;
203 0 my $name = shift;
204  
205 0 ▶ $proto->populate if (!$rollCalled);
Branch: 1 branch
BranchTrueFalseTotal
unless $rollCalled 0 0 0
206 0 ▶ if (my $class = $classRoom{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $class = $classRoom{$name}) 0 0 0
207 0 return $class;
208 }
209 0 return undef;
210 }
211  
212 0 ▶sub list {
Subroutine list: not called CC=2 SCAR=17.9
Pod undocumented
213 0 my $proto = shift;
214  
215 0 ▶ $proto->populate if (!$rollCalled);
Branch: 1 branch
BranchTrueFalseTotal
unless $rollCalled 0 0 0
216  
217 0 return (values %classRoom);
218 }
219  
220 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
221 0 my $proto = shift;
222  
223 }
224  
225 0 ▶sub clone {
Subroutine clone: not called CC=1 SCAR=6.9
Pod undocumented
226 0 my $self = shift;
227  
228 }
229  
230 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
Pod undocumented
231 0 my $self = shift;
232  
233 0 return $self;
234 }
235  
236 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod undocumented
237 0 my $self = shift;
238  
239 0 return $self;
240 }
241  
242 0 ▶sub loadClient {
Subroutine loadClient: not called CC=1 SCAR=6.9
Pod undocumented
243 0 my $self = shift;
244 0 my $newClient = shift;
245  
246 0 my $clientListR = $self->{CLIENTS};
247 0 push @$clientListR, $newClient;
248  
249 0 return $newClient;
250 }
251  
252 0 ▶sub clients {
Subroutine clients: not called CC=3 SCAR=24.8
Pod undocumented
253 0 my $self = shift;
254  
255 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
256 0 my $clientListR = $self->{CLIENTS};
257 0 ▶ return (defined($clientListR) ? (@$clientListR) : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $clientListR ? : 0 0 0
258 }
259  
260 0 ▶sub master {
Subroutine master: not called CC=1 SCAR=6.9
Pod undocumented
261 0 my $self = shift;
262  
263 0 return $self->{MASTER};
264 }
265  
266 0 ▶sub loadSchedule {
Subroutine loadSchedule: not called CC=6 SCAR=37.4
Pod undocumented
267 0 my $self = shift;
268 0 my $newSchedule = shift;
269 0 my $listR;
270  
271 0 ▶print "Policy ".$self->name." has undefined schedule?\n" if (!defined($newSchedule));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $newSchedule 0 0 0
272 0 ▶ if ($self->policyAware && ($newSchedule->type eq "UBAK")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->policyAware and $newSchedule->type eq 'UBAK') { } 0 0 0
Condition0%0/3
$self->policyAware and $newSchedule->type eq "UBAK"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->policyAware and $newSchedule->type eq "UBAK"
$self->policyAware $newSchedule->type eq "UBAK"
Truth table0%0/3
A and B
A= $self->policyAwareB= $newSchedule->type eq "UBAK"
ABresult
0X0
100
111
273 0 ▶ if (!defined($self->{POLICIES})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"POLICIES"}) 0 0 0
274 0 $self->{POLICIES} = [];
275 }
276 0 $listR = $self->{POLICIES};
277 }
278 else {
279 0 ▶ if (!defined($self->{SCHEDULES})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"SCHEDULES"}) 0 0 0
280 0 $self->{SCHEDULES} = [];
281 }
282 0 $listR = $self->{SCHEDULES};
283 }
284  
285 0 push @$listR, $newSchedule;
286  
287 0 return $newSchedule;
288 }
289  
290 0 ▶sub schedules {
Subroutine schedules: not called CC=3 SCAR=24.8
Pod undocumented
291 0 my $self = shift;
292  
293 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
294 0 my $schedulesR = $self->{SCHEDULES};
295 0 ▶ return (defined($schedulesR) ? (@$schedulesR) : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $schedulesR ? : 0 0 0
296 }
297  
298 0 ▶sub policies {
Subroutine policies: not called CC=4 SCAR=30.0
Pod undocumented
299 0 my $proto = shift;
300 0 ▶ my $self = ref($proto) ? $proto : undef;;
Branch: 1 branch
BranchTrueFalseTotal
ref $proto ? : 0 0 0
301  
302 0 ▶ $proto->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
303 0 my $policiesR = $proto->{POLICIES};
304 0 ▶ return (defined($policiesR) ? (@$policiesR) : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $policiesR ? : 0 0 0
305 }
306  
307 0 ▶sub exclude {
Subroutine exclude: not called CC=5 SCAR=34.0
Pod undocumented
308 0 my $self = shift;
309  
310 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
311 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
312 0 ▶ if (!defined($self->{EXCLUDE})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"EXCLUDE"}) 0 0 0
313 0 $self->{EXCLUDE} = [];
314 }
315 0 my $excludeListR = $self->{EXCLUDE};
316 0 my $newExclude = shift;
317  
318 0 push @$excludeListR, $newExclude;
319 }
320 0 my $excludeListR = $self->{EXCLUDE};
321
322 0 ▶ return (defined($excludeListR) ? (@$excludeListR) : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $excludeListR ? : 0 0 0
323 }
324  
325 0 ▶sub include {
Subroutine include: not called CC=5 SCAR=34.0
Pod undocumented
326 0 my $self = shift;
327  
328 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
329 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
330 0 ▶ if (!defined($self->{INCLUDE})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"INCLUDE"}) 0 0 0
331 0 $self->{INCLUDE} = [];
332 }
333 0 my $includeListR = $self->{INCLUDE};
334 0 my $newInclude = shift;
335  
336 0 push @$includeListR, $newInclude;
337 }
338 0 my $includeListR = $self->{INCLUDE};
339
340 0 ▶ return (defined($includeListR) ? (@$includeListR) : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $includeListR ? : 0 0 0
341 }
342  
343 0 ▶sub pool {
Subroutine pool: not called CC=4 SCAR=30.0
Pod undocumented
344 0 my $self = shift;
345  
346 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
347 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
348 0 ▶ print $self->name." already has a pool: ".$self->{POOL}."\n" if ($self->{POOL});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"POOL"} 0 0 0
349 0 $self->{POOL} = shift;
350 }
351  
352 0 return $self->{POOL};
353 }
354  
355 0 ▶sub residence {
Subroutine residence: not called CC=4 SCAR=30.0
Pod undocumented
356 0 my $self = shift;
357  
358 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
359 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
360 0 ▶ print $self->name." already has a residence: ".$self->{RESIDENCE}."\n" if ($self->{RESIDENCE});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"RESIDENCE"} 0 0 0
361 0 $self->{RESIDENCE} = shift;
362 }
363  
364 0 return $self->{RESIDENCE};
365 }
366  
367 0 ▶sub storageUnit {
Subroutine storageUnit: not called CC=1 SCAR=6.9
Pod undocumented
368 0 my $self = shift;
369  
370 0 return $self->residence(@_);
371 }
372  
373 1 my %policyAware = (
374 4 => "Oracle",
375 6 => "Informix",
376 7 => "Sybase",
377 15 => "SQL_Server",
378 16 => "Exchange",
379 17 => "SAP",
380 18 => "DB2",
381 );
382 0 ▶sub policyAware {
Subroutine policyAware: not called CC=2 SCAR=17.9
Pod undocumented
383 0 my $self = shift;
384  
385 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
386 0 return exists($policyAware{$self->{TYPE}});
387 }
388  
389 0 ▶sub type {
Subroutine type: not called CC=4 SCAR=30.0
Pod undocumented
390 0 my $self = shift;
391  
392 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
393 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
394 0 $self->{TYPE} = shift;
395 }
396 print STDERR "Asked to return unknown type ".$self->{TYPE}." for ".$self->{NAME}."\n"
397 0 ▶ if !defined($classTypes{$self->{TYPE}});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $classTypes{$self->{"TYPE"}} 0 0 0
398 0 return $classTypes{$self->{TYPE}};
399 }
400  
401 0 ▶sub license {
Subroutine license: not called CC=1 SCAR=6.9
Pod undocumented
402 0 my $self = shift;
403  
404 0 return NBU::Licenses->licenseForClass($self->{TYPE}, $self->master);
405 }
406  
407 0 ▶sub keywords {
Subroutine keywords: not called CC=3 SCAR=24.8
Pod undocumented
408 0 my $self = shift;
409  
410 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
411 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
412 0 $self->{KEYWORDS} = shift;
413 }
414 0 return $self->{KEYWORDS};
415 }
416  
417 0 ▶sub DR {
Subroutine DR: not called CC=3 SCAR=24.8
Pod undocumented
418 0 my $self = shift;
419  
420 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
421 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
422 0 $self->{DR} = shift;
423 }
424 0 return $self->{DR};
425 }
426  
427 0 ▶sub maxJobs {
Subroutine maxJobs: not called CC=3 SCAR=24.8
Pod undocumented
428 0 my $self = shift;
429  
430 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
431 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
432 0 $self->{MAXJOBS} = shift;
433 }
434 0 return $self->{MAXJOBS};
435 }
436  
437 0 ▶sub priority {
Subroutine priority: not called CC=3 SCAR=24.8
Pod undocumented
438 0 my $self = shift;
439  
440 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
441 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
442 0 $self->{PRIORITY} = shift;
443 }
444 0 return $self->{PRIORITY};
445 }
446  
447 0 ▶sub multipleDataStreams {
Subroutine multipleDataStreams: not called CC=3 SCAR=24.8
Pod undocumented
448 0 my $self = shift;
449  
450 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
451 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
452 0 $self->{MDS} = shift;
453 }
454 0 return $self->{MDS};
455 }
456  
457 0 ▶sub BLIB {
Subroutine BLIB: not called CC=3 SCAR=24.8
Pod undocumented
458 0 my $self = shift;
459  
460 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
461 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
462 0 $self->{BLIB} = shift;
463 }
464 0 return $self->{BLIB};
465 }
466  
467 #
468 # TIR codes are:
469 # 0 off
470 # 1 on
471 # 2 on with move detection
472 0 ▶sub TIR {
Subroutine TIR: not called CC=3 SCAR=24.8
Pod undocumented
473 0 my $self = shift;
474  
475 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
476 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
477 0 $self->{TIR} = shift;
478 }
479 0 return $self->{TIR};
480 }
481  
482 0 ▶sub crossMountPoints {
Subroutine crossMountPoints: not called CC=3 SCAR=24.8
Pod undocumented
483 0 my $self = shift;
484  
485 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
486 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
487 0 $self->{CROSS} = shift;
488 }
489 0 return $self->{CROSS};
490 }
491  
492 0 ▶sub followNFSMounts {
Subroutine followNFSMounts: not called CC=3 SCAR=24.8
Pod undocumented
493 0 my $self = shift;
494  
495 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
496 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
497 0 $self->{FOLLOW} = shift;
498 }
499 0 return $self->{FOLLOW};
500 }
501  
502 0 ▶sub clientCompression {
Subroutine clientCompression: not called CC=3 SCAR=24.8
Pod undocumented
503 0 my $self = shift;
504  
505 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
506 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
507 0 $self->{COMPRESSION} = shift;
508 }
509 0 return $self->{COMPRESSION};
510 }
511  
512 0 ▶sub clientEncrypted {
Subroutine clientEncrypted: not called CC=3 SCAR=24.8
Pod undocumented
513 0 my $self = shift;
514  
515 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
516 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
517 0 $self->{ENCRYPTION} = shift;
518 }
519 0 return $self->{ENCRYPTION};
520 }
521  
522 0 ▶sub active {
Subroutine active: not called CC=8 SCAR=42.8
Pod undocumented
523 0 my $self = shift;
524  
525 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
526 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
527 0 my $newState = shift;
528 0 ▶ if (($newState && !$self->{ACTIVE}) || (!$newState && $self->{ACTIVE})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newState and not $self->{"ACTIVE"} or not $newState and $self->{"ACTIVE"}) 0 0 0
Condition0%0/9
$newState and not $self->{"ACTIVE"} or not $newState and $self->{"ACTIVE"}
l!l&&r!l&&!r
000
$newState and not $self->{"ACTIVE"}
!ll&&!rl&&r
000
not $newState and $self->{"ACTIVE"}
!ll&&!rl&&r
000
MC/DC0%0/4
$newState and not $self->{"ACTIVE"} or not $newState and $self->{"ACTIVE"}
$newState not $self->{"ACTIVE"} not $newState $self->{"ACTIVE"}
Truth table0%0/7
A and not(B) or not(C) and D
A= $newStateB= not $self->{"ACTIVE"}C= not $newStateD= $self->{"ACTIVE"}
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
529 0 ▶ if ($self->{ACTIVE} = $newState) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'ACTIVE'} = $newState) { } 0 0 0
530 0 NBU->cmd("bpclinfo ".$self->name." -update -active");
531 }
532 else {
533 0 NBU->cmd("bpclinfo ".$self->name." -update -inactive");
534 }
535 }
536 }
537 0 return $self->{ACTIVE};
538 }
539  
540 0 ▶sub name {
Subroutine name: not called CC=3 SCAR=24.8
Pod undocumented
541 0 my $self = shift;
542  
543 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
544 0 ▶ if (defined($self->{NAME})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"NAME"}) 0 0 0
545 0 delete $classRoom{$self->{NAME}};
546 }
547 0 $self->{NAME} = shift;
548 0 $classRoom{$self->{NAME}} = $self;
549 }
550 0 return $self->{NAME};
551 }
552  
553 0 ▶sub providesCoverage {
Subroutine providesCoverage: not called CC=3 SCAR=24.8
Pod undocumented
554 0 my $self = shift;
555  
556 0 ▶ $self->populate if (!$self->{LOADED});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"LOADED"} 0 0 0
557 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
558 0 $self->{COVERS} = shift;
559 }
560  
561 0 return $self->{COVERS};
562 }
563  
564 #
565 # Load the list of images of this class
566 0 ▶sub loadImages {
Subroutine loadImages: not called CC=1 SCAR=6.9
Pod undocumented
567 0 my $self = shift;
568  
569 0 NBU::Image->loadImages(NBU->cmd("bpimmedia -l -class ".$self->name." |"));
570 }
571  
572 0 ▶sub images {
Subroutine images: not called CC=5 SCAR=34.0
Pod undocumented
573 0 my $self = shift;
574  
575 0 ▶ if (!defined($self->{IMAGES})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"IMAGES"}) 0 0 0
576 0 $self->loadImages;
577  
578 0 my @images;
579 0 for my $client ($self->clients) {
580 0 for my $image ($client->images) {
581 0 ▶ push @images, $image if ($image->class == $self);
Branch: 1 branch
BranchTrueFalseTotal
if $image->class == $self 0 0 0
582 }
583 }
584  
585 0 $self->{IMAGES} = \@images;
586 }
587 0 my $imageListR = $self->{IMAGES};
588  
589 0 return (@$imageListR);
590 }
591  
592 1 1;
593  
594 __END__
« lib/NBU/Pool.pm ↑ Summary lib/NBU/Drive.pm »