IBM-StorageSystem

 view release on metacpan or  search on metacpan

lib/IBM/StorageSystem/Array.pm  view on Meta::CPAN

package IBM::StorageSystem::Array;

use strict;
use warnings;

use Scalar::Util qw(weaken);
use Carp qw(croak);

our $VERSION = '0.01';
our @ATTR = qw(UID active_WWPN balanced block_size capacity controller_id controller_name 
ctrl_LUN_no ctrl_WWNN ctrl_type fast_write_state max_path_count mdisk_grp_id mdisk_grp_name 
mdisk_id mdisk_name mode path_count preferred_WWPN quorum_index raid_level raid_status 
redundancy spare_goal spare_protection_min status strip_size tier);

foreach my $attr ( @ATTR ) { 
        {   
                no strict 'refs';
                *{ __PACKAGE__ .'::'. $attr } = sub {
                        my( $self, $val ) = @_;
			$val =~ s/\#/no/ if $val; 
                        $self->{$attr} = $val if $val;
                        return $self->{$attr}
                }   
        }   
}

sub new {
        my( $class, $ibm, %args ) = @_; 
        my $self = bless {}, $class;
        defined $args{mdisk_id} or croak 'Constructor failed: mandatory mdisk_id argument not supplied';
	weaken( $self->{__ibm} = $ibm );

        foreach my $attr ( @ATTR ) { $self->{$attr} = $args{$attr} }

        return $self
}

1;

__END__

=pod

=head1 NAME

IBM::StorageSystem::Array - Class for operations with a IBM StorageSystem array

=head1 VERSION

Version 0.01

=head1 SYNOPSIS

IBM::StorageSystem::Array is a utility class for operations with a IBM StorageSystem array.

        use IBM::StorageSystem;
        
        my $ibm = IBM::StorageSystem->new(      user            => 'admin',
                                        host            => 'my-v7000',
                                        key_path        => '/path/to/my/.ssh/private_key'
                                ) or die "Couldn't create object! $!\n";

        # Get array 2 as an IBM::StorageSystem::Array object
	my $array = $ibm->array( 2 );
	
	# Print the array capacity
	print $array->capacity;

	# Print the array RAID level
	print $array->raid_level;

	# Alternately -	print $ibm->array( 2 )->raid_level

	# Print the array status of all arrays in our system
	map { print "Array ", $_->mdisk_id, " status ", $_->status, "\n" } $ibm->get_arrays;

=head1 METHODS

=head3 UID

Returns the array UID.

=head3 active_WWPN

Returns the array active WWPN.

=head3 balanced

Describes if the array is balanced to its spare goals:

=over 4

=item * exact - All populated members have exact capability match, exact location match.

=item * yes - All populated members have at least exact capability match, exact chain, or different enclosure or slot.

=item * no - Anything else.

=back

=head3 block_size

Returns the array block size 512 bytes (or blank) in each block of storage.

=head3 capacity

Returns the array capacity in bytes.

=head3 controller_id

Returns the array controller id.

=head3 controller_name

Returns the array controller name.

=head3 ctrl_LUN_no

Returns the control LUN number.



( run in 0.695 second using v1.01-cache-2.11-cpan-39bf76dae61 )