blib/lib/IBM/V7000.pm

filter: Statementstmt 73.4% 36 / 49 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 54.5% 6 / 11 Podpod 100% 1 / 1 totaltotal 70.4% 43 / 61 CC 1 SCAR 1.8
CC
1
Cov
73%
new
2.0
__ANON__
1.3
__ANON__
1.3
CRAP 1.2
↑ Summary
1 package IBM::V7000;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use IBM::StorageSystem;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '0.02';
10  
11 2 our @METHODS=qw(array drive enclosure host iogroup vdisk);
12  
13 2 our @ATTRS = qw(auth_service_cert_set auth_service_configured auth_service_enabled
14 auth_service_pwd_set auth_service_type auth_service_url auth_service_user_name
15 bandwidth cluster_isns_IP_address cluster_locale cluster_ntp_IP_address code_level
16 console_IP email_contact email_contact2 email_contact2_alternate email_contact2_primary
17 email_contact_alternate email_contact_location email_contact_primary email_reply
18 email_state gm_inter_cluster_delay_simulation gm_intra_cluster_delay_simulation
19 gm_link_tolerance gm_max_host_delay has_nas_key id id_alias inventory_mail_interval
20 iscsi_auth_method iscsi_chap_secret layer location name partnership rc_buffer_size
21 relationship_bandwidth_limit space_allocated_to_vdisks space_in_mdisk_grps
22 statistics_frequency statistics_status stats_threshold tier tier_capacity tier_free_capacity
23 time_zone total_allocated_extent_capacity total_free_space total_mdisk_capacity
24 total_overallocation total_used_capacity total_vdisk_capacity total_vdiskcopy_capacity
25 compression_cpu_pc cpu_pc drive_r_io drive_r_mb drive_r_ms drive_w_io
26 drive_w_mb drive_w_ms fc_io fc_mb iscsi_io iscsi_mb mdisk_r_io mdisk_r_mb mdisk_r_ms
27 mdisk_w_io mdisk_w_mb mdisk_w_ms sas_io sas_mb total_cache_pc vdisk_r_io vdisk_r_mb
28 vdisk_r_ms vdisk_w_io vdisk_w_mb vdisk_w_ms write_cache_pc);
29 # TO DO: mdsik
30  
31 2 foreach my $method ( @METHODS ) {
32 {
33 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
34 12 my $get_method = "get_$method";
35 12 my $get_methods = "get_${method}s";
36
37 12 ▶ *{ __PACKAGE__ ."::$method" } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
38 0 my $self = shift;
39 0 $self->{ss}->$method(@_)
40 12 };
41  
42 12 ▶ *{ __PACKAGE__ ."::$get_method" } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
43 0 my $self = shift;
44 0 $self->{ss}->$get_method(@_)
45 12 };
46  
47 12 ▶ *{ __PACKAGE__ ."::$get_methods" } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
48 0 my $self = shift;
49 0 $self->{ss}->$get_methods(@_)
50 }
51 12 }
52 }
53  
54 2 foreach my $attr ( @ATTRS ) {
55 {
56 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
57
58 164 ▶ *{ __PACKAGE__ ."::$attr" } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
59 0 my $self = shift;
60 0 $self->{ss}->$attr(@_)
61 164 };
62 }
63 }
64  
65 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
66 0 my ($class, %args) = @_;
67 0 my $self = bless {} , $class;
68 0 my %opts = ( user => $self->{user}, key_path => $self->{key_path}, batch_mode => 1, master_opts => '-q', );
69  
70 0 $self->{ss} = IBM::StorageSystem->new( %args );
71  
72 0 return $self
73 }
74  
75 =head1 NAME
76  
77 IBM::V7000 - Perl API to IBM V7000 CLI
78  
79 =head1 VERSION
80  
81 Version 0.01
82  
83 =head1 SYNOPSIS
84  
85 IBM::V7000 is a Perl API to IBM V7000 CLI.
86  
87 =head1 METHODS
88  
89 =head3 new
90  
91 my $ibm = IBM::V7000->new( user => 'admin',
92 host => 'my-v7000.company.com',
93 key_path => '/path/to/my/.ssh/private_key'
94 ) or die "Couldn't create object! $!\n";
95  
96 Constructor - creates a new IBM::V7000 object. This method accepts three mandatory parameters
97 and one optional parameter, the three mandatory parameters are:
98  
99 =over 3
100  
101 =item user
102  
103 The username of the user with which to connect to the device.
104  
105 =item host
106  
107 The hostname or IP address of the device to which we are connecting.
108  
109 =item key_path
110  
111 Either a relative or fully qualified path to the private ssh key valid for the
112 user name and device to which we are connecting. Please note that the executing user
113 must have read permission to this key.
114  
115 =back
116  
117 The optional parameter is:
118  
119 =over 3
120  
121 =item stats_threshold
122  
123 The period in seconds for which retrieved system statistics will be considered fresh,
124 after which they will be re-retrieved. If not set, the default value of this parameter
125 is zero meaning that the statistics are not refreshed unless done explicitly via the
126 B<refresh> method of an L<IBM:StorageSystem::Statistic> object.
127  
128 =back
129  
130 =head3 auth_service_cert_set
131  
132 Specifies if the authentication service certificate has been set.
133  
134 =head3 auth_service_configured
135  
136 True if the auth_service_type is configured and either one of the following is true:
137  
138 =over 3
139  
140 =item * The auth_service_type is LDAP-only (if at least one LDAP server is configured)
141  
142 =item * The auth_service_type is TIP-only:
143  
144 =over 5
145  
146 =item * The name, password, and URL are established
147  
148 =item * An SSL certificate is created (if an HTTPS URL is available)
149  
150 =back
151  
152 =back
153  
154 =head3 auth_service_enabled
155  
156 True if auth_service_type is configured.
157  
158 =head3 auth_service_pwd_set
159  
160 Specifies if the authentication password has been set.
161  
162 =head3 auth_service_type
163  
164 returns the authentication services type, either; Tivoli Integrated Portal (TIP) or Native Lightweight
165 Directory Access Protocol (LDAP)
166  
167 =head3 auth_service_url
168  
169 Returns the authentication services URL.
170  
171 =head3 auth_service_user_name
172  
173 Returns the user name used for authentication services.
174  
175 =head3 bandwidth
176  
177 Returns the bandwidth available on the intersystem link for background copy, in megabytes per second (MBps).
178  
179 =head3 cluster_isns_IP_address
180  
181 Returns the cluster ISNS IP address.
182  
183 =head3 cluster_locale
184  
185 Returns the cluster configured locale.
186  
187 =head3 cluster_ntp_IP_address
188  
189 Returns the cluster NTP service address.
190  
191 =head3 code_level
192  
193 Returns the cluster code level.
194  
195 =head3 console_IP
196  
197 Returns the cluster console IP address.
198  
199 =head3 email_contact
200  
201 Returns the clusters email contact information - this value is usually the system name.
202  
203 =head3 email_contact2
204  
205 Returns the clusters extended email contact information.
206  
207 =head3 email_contact2_alternate
208  
209 Returns the clusters extended alternate email contact information.
210  
211 =head3 email_contact2_primary
212  
213 Returns the clusters extended primary email contact information.
214  
215 =head3 email_contact_alternate
216  
217 Returns the clusters email contact alternate information.
218  
219 =head3 email_contact_location
220  
221 Returns the clusters email contact location.
222  
223 =head3 email_contact_primary
224  
225 Returns the clusters email contact phone number.
226  
227 =head3 email_reply
228  
229 Returns the clusters email reply email.
230  
231 =head3 email_state
232  
233 Returns the clusters email operational state.
234  
235 =head3 gm_inter_cluster_delay_simulation
236  
237 Returns the cluster gm inter cluster delay simulation.
238  
239 =head3 gm_intra_cluster_delay_simulation
240  
241 Returns the cluster gm intra cluster delay simulation.
242  
243 =head3 gm_link_tolerance
244  
245 Returns the cluster gm link delay tolerance in seconds.
246  
247 =head3 gm_max_host_delay
248  
249 Returns the cluster gm maximum host delay value.
250  
251 =head3 has_nas_key
252  
253 Specifies if the cluster has a NAS key configured.
254  
255 =head3 id
256  
257 Returns the cluster ID.
258  
259 =head3 id_alias
260  
261 Returns the cluster ID alias.
262  
263 =head3 inventory_mail_interval
264  
265 Returns the cluster inventory mail interval period in days.
266  
267 =head3 iscsi_auth_method
268  
269 Returns the cluster iSCSI authentication method.
270  
271 =head3 iscsi_chap_secret
272  
273 Returns the iSCSI CHAP secret.
274  
275 =head3 layer
276  
277 Returns the cluster layer type; either replication or storage (default).
278 Replication means the system can create partnerships with Storwize StorageSystem Unified.
279 Storage means the system can present storage to Storwize StorageSystem Unified.
280  
281 =head3 location
282  
283 Returns the cluster location type, either local or remote.
284  
285 =head3 name
286  
287 Returns the cluster name.
288  
289 =head3 partnership
290  
291 Returns the cluster partnership type, either one of; fully_configured, partially_configured_local,
292 partially_configured_local_stopped, not_present, fully_configured_stopped, fully_configured_remote_stopped,
293 fully_configured_local_excluded, fully_configured_remote_excluded or fully_configured_exceeded
294  
295 =head3 rc_buffer_size
296  
297 Returns the cluster resource buffer size assigned for Metro Mirror or Global Mirrored Copy Services.
298  
299 =head3 relationship_bandwidth_limit
300  
301 Returns the cluster relationship bandwidth limit in megabytes per second (MBps).
302  
303 =head3 space_allocated_to_vdisks
304  
305 Returns the space allocated to VDisks - this may be in a variable notation format.
306  
307 =head3 space_in_mdisk_grps
308  
309 Returns the space allocated to MDisk groups - this may be in a variable notation format.
310  
311 =head3 statistics_frequency
312  
313 Returns the statistics collection frequency interval.
314  
315 =head3 statistics_status
316  
317 Returns the statistics collection status.
318  
319 =head3 tier
320  
321 Returns an array containing the supported tier types for the cluster.
322  
323 B<Note> that this method returns an array of the available tier types and that the ordering
324 of these types is preserved from the CLI output. The ordering of these types can be used to
325 retrieve the tier capacity of each tier type with the B<tier_capacity> command.
326  
327 =head3 tier_capacity
328  
329 Returns the total tier capacity for each tier type in the cluster.
330  
331 B<Note> that this method returns an array of tier capacity ivalues, the index of
332 which corresponds with the array indexes of tier types as returned by the B<tier> method.
333  
334 For example, to print each tier type and the corresponding tier capacity for this cluster:
335  
336 for ( my $i = 0; $i < scalar @{ $ibm->tier } ; $i++ ) {
337 print "Tier: " . $ibm->tier->[$i] .
338 " - Capacity: " . $ibm->tier_capacity->[$i] . "\n"
339 }
340  
341 =head3 tier_free_capacity
342  
343 Returns the free tier capacity for each tier type in the cluster.
344  
345 B<Note> that like the B<tier> and B<tier_capacity> methods, this method also returns an
346 array of tier free capacity values, the order of which corresponds with the arrays returned
347 by the aforementioned methods.
348  
349 =head3 time_zone
350  
351 Returns the cluster time zone.
352  
353 =head3 total_allocated_extent_capacity
354  
355 Returns the clusters total allocated capacity - this may be in a variable notation format.
356  
357 =head3 total_free_space
358  
359 Returns the clusters total free space - this may be in a variable notation format.
360  
361 =head3 total_mdisk_capacity
362  
363 Returns the clusters total MDisk capacity - this may be in a variable notation format.
364  
365 =head3 total_overallocation
366  
367 Returns the cluster total overallocation limit.
368  
369 =head3 total_used_capacity
370  
371 Returns the clusters total used capacity - this may be in a variable notation format.
372  
373 =head3 total_vdisk_capacity
374  
375 Returns the clusters total VDisk capacity - this may be in a variable notation format.
376  
377 =head3 total_vdiskcopy_capacity
378  
379 Returns the clusters total VDisk copy capacity - this may be in a variable notation format.
380  
381 =head3 compression_cpu_pc
382  
383 Returns an L<IBM::StorageSystem::Statistic> object for allocated CPU capacity utilised for compression.
384  
385 =head3 cpu_pc
386  
387 Returns an L<IBM::StorageSystem::Statistic> object for allocated CPU capacity utilised for the system.
388  
389 =head3 drive_r_io
390  
391 Returns an L<IBM::StorageSystem::Statistic> object the average amount of I/O operations transferred
392 per second for read operations to drives during the sample period.
393  
394 =head3 drive_r_mb
395  
396 Returns an L<IBM::StorageSystem::Statistic> object for the average number of megabytes transferred
397 per second for read operations to drives during the sample period.
398  
399 =head3 drive_r_ms
400  
401 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of time in milliseconds
402 that the system takes to respond to read requests to drives over the sample period.
403  
404 =head3 drive_w_io
405  
406 Returns an L<IBM::StorageSystem::Statistic> object the average amount of I/O operations transferred
407 per second for write operations to drives during the sample period.
408  
409 =head3 drive_w_mb
410  
411 Returns an L<IBM::StorageSystem::Statistic> object for the average number of megabytes transferred
412 per second for write operations to drives during the sample period.
413  
414 =head3 drive_w_ms
415  
416 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of time in milliseconds
417 that the system takes to respond to write requests to drives over the sample period.
418  
419 =head3 fc_io
420  
421 Returns an L<IBM::StorageSystem::Statistic> object for the total input/output (I/O) operations
422 transferred per seconds for Fibre Channel traffic on the system. This value includes
423 host I/O and any bandwidth that is used for communication within the system.
424  
425 =head3 fc_mb
426  
427 Returns an L<IBM::StorageSystem::Statistic> object for the total number of megabytes transferred
428 per second for Fibre Channel traffic on the system. This value includes host I/O and any
429 bandwidth that is used for communication within the system.
430  
431 =head3 iscsi_io
432  
433 Returns an L<IBM::StorageSystem::Statistic> object for the total I/O operations transferred
434 per second for iSCSI traffic on the system.
435  
436 =head3 iscsi_mb
437  
438 Returns an L<IBM::StorageSystem::Statistic> object for the total number of megabytes
439 transferred per second for iSCSI traffic on the system.
440  
441 =head3 mdisk_r_io
442  
443 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of I/O operations
444 transferred per second for read operations to MDisks during the sample period.
445  
446 =head3 mdisk_r_mb
447  
448 Returns an L<IBM::StorageSystem::Statistic> object for the average number of megabytes transferred
449 per second for read operations to MDisks during the sample period.
450  
451 =head3 mdisk_r_ms
452  
453 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of time in milliseconds
454 that the system takes to respond to read requests to MDisks over the sample period.
455  
456 =head3 mdisk_w_io
457  
458 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of I/O operations
459 transferred per second for write operations to MDisks during the sample period.
460  
461 =head3 mdisk_w_mb
462  
463 Returns an L<IBM::StorageSystem::Statistic> object for the average number of megabytes transferred
464 per second for write operations to MDisks during the sample period.
465  
466 =head3 mdisk_w_ms
467  
468 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of time in milliseconds
469 that the system takes to respond to write requests to MDisks over the sample period.
470  
471 =head3 sas_io
472  
473 Returns an L<IBM::StorageSystem::Statistic> object for the total I/O operations transferred per
474 second for SAS traffic on the system. This value includes host I/O and bandwidth that
475 is used for background RAID activity.
476  
477 =head3 sas_mb
478  
479 Returns an L<IBM::StorageSystem::Statistic> object for the total number of megabytes
480 transferred per second for iSCSI traffic on the system.
481  
482 =head3 total_cache_pc
483  
484 Returns an L<IBM::StorageSystem::Statistic> object for the total percentage for both the
485 write and read cache usage for the node.
486  
487 =head3 vdisk_r_io
488  
489 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of I/O operations
490 transferred per second for read operations to volumes during the sample period.
491  
492 =head3 vdisk_r_mb
493  
494 Returns an L<IBM::StorageSystem::Statistic> object for the average number of megabytes
495 transferred per second for read operations to MDisks during the sample period.
496  
497 =head3 vdisk_r_ms
498  
499 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of time in
500 milliseconds that the system takes to respond to read requests to MDisks over the
501 sample period.
502  
503 =head3 vdisk_w_io
504  
505 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of I/O operations
506 transferred per second for read operations to drives during the sample period.
507  
508 =head3 vdisk_w_mb
509  
510 Returns an L<IBM::StorageSystem::Statistic> object for the average number of megabytes transferred
511 per second for read operations to drives during the sample period
512  
513 =head3 vdisk_w_ms
514  
515 Returns an L<IBM::StorageSystem::Statistic> object for the average amount of time in milliseconds
516 that the system takes to respond to read requests to MDisks over the sample period.
517  
518 =head3 write_cache_pc
519  
520 Returns an L<IBM::StorageSystem::Statistic> object for the percentage of the write cache usage
521 for the node.
522  
523 =head3 refresh_system_stats
524  
525 This method refreshes all system statistics with updated values from the system. This
526 method may be handy if instantiate an IBM::StorageSystem object within a long running or non-exiting
527 process and wish to either periodically retrieve updated system statistics.
528  
529 B<Note> that you can call B<refresh> on individual system statistics which may have a slight
530 performance increase over this method.
531  
532 =head3 stats_threshold
533  
534 This method allows you specify the statistics threshold freshness interval in seconds. This
535 interval is used to determine if the value sreturned by a statistics method are fresh or
536 whether they should be refreshed from the atregt system.
537  
538 By default this value is zero, meaning that the statistics are never refreshed unless explicitly
539 done so by calling the B<reefresh> method of the statistic object. This may result in a
540 performance increase in situations where statistic methods are frequently used, and may also
541 result in more consistent reporting of the target system state as the statistic values will more
542 closely represent a single point in time overview of the system rather than a series of
543 consecutive snapshots.
544  
545 In situation where you may want to gather a set of statistical values for the target system over
546 a finite period, you could set the threshold value low, and reset it afterwards. e.g.
547  
548 # Print the current FC IOPS value every two seconds for a minute
549 $ibm->stats_threshold = 1;
550 for ( 1 .. 30 ) {
551 print $ibm->fc_io_current;
552 sleep 2
553 }
554 # Disable automatic refreshing
555 $ibm->stats_threshold = 0;
556  
557 =head3 array( $id )
558  
559 # Print the capacity and RAID level of array 1 in GB
560 my $array = $ibm->array( 1 );
561 print "Array 1 capacity: " . int ( $array->capacity / ( 1024 ** 3 ) )
562 . " (" . $array->raid_level . ")\n"
563  
564 # e.g. Array 1 capacity: 5824G (raid10)
565  
566 Returns an L<IBM::StorageSystem::Array> object representing the array specified by the numerical
567 id parameter.
568  
569 B<Note> that this is a caching method and that a previously retrieved L<IBM::StorageSystem::Array> object will
570 be returned if one has been cached from previous invocations.
571  
572 =head3 get_array( $id )
573  
574 Returns the array specified by the value of the numerical ID argument as an L<IBM::StorageSystem:Array> object.
575  
576 B<Note> that this method is non-caching and the array information will always be retrieved from the StorageSystem
577 system even if a cached object exists.
578  
579 =head3 get_arrays
580  
581 # Print the array status of all arrays in our system
582 map { print "Array ", $_->mdisk_id, " status ", $_->status, "\n" } $ibm->get_arrays;
583  
584 Returns an array of L<IBM::StorageSystem::Array> objects representing all arrays in the target system.
585  
586 =head3 drive ( $id )
587  
588 # Get drive ID 2 as an IBM::StorageSystem::Drive object
589 my $drive = $ibm->drive( 2 );
590  
591 # Print the drive capacity in bytes
592 print $drive->capacity;
593  
594 # Alternately;
595 print $ibm->drive( 2 )->capacity;
596  
597 # Print the drive vendor and product IDs
598 print "Vendor ID: ", $drive->vendor_id, " - Product ID: ", $drive->product_id, "\n";
599  
600 Returns the drive specified by the value of the integer argument as a L<IBM::StorageSystem::Drive> object.
601  
602 B<note> that this method implements caching and that a cached object will be retrieved if present.
603  
604 If you require a non-cached object, then use the B<get_drive> method instead.
605  
606 =head3 get_drive( $id )
607  
608 Returns the drive specified by the value of the integer argument. This method is non-caching and
609 always retrieves information directly from the target system even if a cached object is present.
610  
611 =head3 get_drives( $id )
612  
613 # Print the SAS port status and drive status for all drives in a nicely formatted list
614 printf("%-20s%-20s%-20s%-20s\n", 'Drive', 'SAS Port 1 Status', 'SAS Port 2 Status', 'Status');
615 printf("%-20s%-20s%-20s%-20s\n", '-'x18, '-'x18, '-'x18, '-'x18);
616 map { printf( "%-20s%-20s%-20s%-20s\n", $_->id, $_->port_1_status, $_->port_2_status, $_->status) } $ibm->get_drives;
617  
618 # e.g.
619 # Drive SAS Port 1 Status SAS Port 2 Status Status
620 # ------------------ ------------------ ------------------ ------------------
621 # 0 online online online
622 # 1 online online online
623 # 2 online online online
624 # 3 online online online
625 # ...
626  
627 Returns all drives as an array of L<IBM::StorageSystem::Drive> objects.
628  
629 =head3 enclosure( $id )
630  
631 # Print the status of a specific enclosure
632 print "Enclosure two status is " . $ibm->enclosure(2)->status . "\n";
633  
634 # Get all PSUs in an enclosure as L<IBM::StorageSystem::Enclosure::PSU> objects.
635 my @psus = $ibm->enclosure(1)->psus;
636  
637 Returns the enclosure specified by the numerical identifer of the id parameter as an
638 L<IBM::StorageSystem::Enclosure> object.
639  
640 B<Note> that this is a caching method and that a cached object will be returned if one is present.
641 If you require a non-cached result, then please use the B<get_enclosure> method.
642  
643 =head3 get_enclosure( $id )
644  
645 This method is a functionally equivalent non-caching implementation of the B<enclosure> method.
646  
647 =head3 get_enclosures
648  
649 # Print the status of each enclosure in our system.
650 foreach my $enclosure ( $ibm->get_enclosures ) {
651 print "Enclosure ", $enclosure->id, " status: ", $enclosure->status, "\n"
652 }
653  
654 Returns an array of L<IBM::StorageSystem::Enclosure> objects representing all enclosures present in teh target
655 system.
656  
657 =head3 host( $hostname )
658  
659 # Print the host status of the attached host 'sauron'
660 print "Status: " . $ibm->host(sauron)->status . "\n";
661  
662 Returns the host specified by the value of the named host parameter as an L<IBM::StorageSystem::Host> object.
663  
664 B<Note> that this is a caching method and a cached object will be returned if one exists. If you require
665 a non-cached object, then please use the B<get_host> method.
666  
667 =head3 get_host( $hostname )
668  
669 This is a functionally equivalent non-caching implementation of the B<host> method.
670  
671 =head3 get_hosts
672  
673 # Print a list of all configured hosts sorted by hostname, their WWPNs,
674 # port state and login status.
675  
676 foreach $host ( map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, $_->name ] } $ibm->get_hosts ) {
677 my $c = 0;
678  
679 foreach $wwpn ( @{ $host->WWPN } ) {
680 print ( $c ? "\t" : ('-'x100)."\n".$host->name );
681 print "\t\t\t$wwpn\t" . @{ $host->state }[$c] . "\t\t" .
682 ( @{$host->node_logged_in_count }[$c] ? '' : 'not ' ) . "logged in\n";
683 $c++
684 }
685 }
686  
687 # Prints something similar to:
688 # ----------------------------------------------------------------------------------------------------
689 # host-3 2101001B32A3D94C active logged in
690 # 2100001B3283D94C active logged in
691 # ----------------------------------------------------------------------------------------------------
692 # host-4 2100001B320786E7 active logged in
693 # 2101001B322786E7 active logged in
694 # ----------------------------------------------------------------------------------------------------
695 # storage-2 210100E08BB40A08 offline not logged in
696 # 210000E08B940A08 offline not logged in
697 # ... etc.
698  
699 Returns an array of L<IBM::StorageSystem::Host> objects representing all host attached to the target system.
700  
701 =head3 iogroup( $id )
702  
703 # Get I/O group 0
704 my $io_group = $ibm->get_iogroup(0);
705  
706 # Print the I/O group maintenance state
707 print $io_group->maintenance_state;
708  
709 # Alternately:
710 print $ibm->iogroup(0)->maintenance_state;
711  
712 Returns the I/O group identified by the value of the numerical ID parameter as an L<IBM::StorageSystem::IOGroup>
713 object.
714  
715 B<Note> that this method implements caching and a cached object will be returned shoudl one be present.
716 If you require a non-cached object then please use the B<get_iogroup> method.
717  
718 =head3 get_iogroup( $id )
719  
720 This is a functionally equivalent non-caching implementation of the B<iogroup> method.
721  
722 =head3 get_iogroups
723  
724 # Print a formatted listing of all I/O groups by ID and name, along with
725 # their VDisk count, host count, node count and maintenance state.
726 map { printf("%-8s%-20s%-20s%-20s%-20s%-20s\n",
727 $_->id,
728 $_->name,
729 $_->vdisk_count,
730 $_->host_count,
731 $_->node_count,
732 $_->maintenance )
733 } $ibm->get_iogroups;
734  
735 # Prints something like:
736 #
737 # ID Name VDisk Count Host Count Node Count Maintenance
738 # 0 io_grp0 2 3 2 no
739 # 1 io_grp1 0 3 0 no
740 # 2 io_grp2 0 3 0 no
741 # 3 io_grp3 0 3 0 no
742 # ... etc.
743  
744 Returns an array of L<IBM::StorageSystem::IOGroup> objects representing all configured I/O groups on the target system.
745  
746 =head3 vdisk( $id )
747  
748 # Get the VDisk ID 3 and print the VDisk UUID
749 my $vdisk = $ibm->vdisk(3);
750 print $vdisk->vdisk_UUID;
751  
752 # Alternately:
753 print $ibm->vdisk(3)->vdisk_UUID;
754  
755 Returns an L<IBM::StorageSystem::VDisk> object representing the VDisk identified by the numerical ID parameter.
756  
757 B<Note> that this method implements caching to improve performance and reduce network overhead, and that a cached
758 object will be returned if one is present. If you require a non-cached object then please use the B<get_vdisk>
759 method.
760  
761 =head3 get_vdisk( $id )
762  
763 This is a functionally equivalent non-caching implementation of the B<vdisk> method.
764  
765 =head3 get_vdisks
766  
767 # Print the name, ID, capacity in GB and MDisk group name of all VDisks in a
768 # nicely formatted output
769 printf( "%-20s%-8s%-15s%20s\n", 'Name', 'ID', 'Capacity (GB)', 'MDisk Group Name' );
770 printf( "%-20s%-8s%-15s%20s\n", '-'x18, '-'x4, '-'x12, '-'x15 );
771 map { printf( "%-20s%-8s%-15s%20s\n", $_->name, $_->id, (int($_->capacity / (1024**3))), $_->mdisk_grp_name) }
772 grep { $_->status eq 'online' } $ibm->get_vdisks;
773  
774 # Should print something like:
775 # Name ID Capacity (GB) MDisk Group Name
776 # ------------------ ---- ------------ ---------------
777 # file-host-1 0 5823 FILE_POOL
778 # backup-host-2 1 2330 BACKUP_POOL
779 # ... etc.
780  
781 Returns all configured VDisks in the target system as an array of L<IBM::StorageSystem::VDisk> objects.
782  
783 =head1 AUTHOR
784  
785 Luke Poskitt, C<< <lukep at deakin.edu.au> >>
786  
787 =head1 BUGS
788  
789 Please report any bugs or feature requests to C<bug-ibm-v7000 at rt.cpan.org>, or through
790 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IBM-V7000>. I will be notified, and then you'll
791 automatically be notified of progress on your bug as I make changes.
792  
793 =head1 SUPPORT
794  
795 You can find documentation for this module with the perldoc command.
796  
797 perldoc IBM::V7000
798  
799  
800  
801 =over 4
802  
803 =item * RT: CPAN's request tracker (report bugs here)
804  
805 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=IBM-V7000>
806  
807 =item * AnnoCPAN: Annotated CPAN documentation
808  
809 L<http://annocpan.org/dist/IBM-V7000>
810  
811 =item * CPAN Ratings
812  
813 L<http://cpanratings.perl.org/d/IBM-V7000>
814  
815 =item * Search CPAN
816  
817 L<http://search.cpan.org/dist/IBM-V7000/>
818  
819 =back
820  
821  
822 =head1 ACKNOWLEDGEMENTS
823  
824  
825 =head1 LICENSE AND COPYRIGHT
826  
827 Copyright 2013 Luke Poskitt.
828  
829 This program is free software; you can redistribute it and/or modify it
830 under the terms of either: the GNU General Public License as published
831 by the Free Software Foundation; or the Artistic License.
832  
833 See http://dev.perl.org/licenses/ for more information.
834  
835  
836 =cut
837  
838 2 1;
↑ Summary