IBM-StorageSystem
view release on metacpan or search on metacpan
lib/IBM/StorageSystem/VDisk.pm view on Meta::CPAN
return $self
}
foreach my $obj ( keys %{ $OBJ } ) {
{
no strict 'refs';
my $m = 'get_'.$obj.'s';
*{ __PACKAGE__ ."::$obj" } = sub {
my( $self, $id ) = @_;
defined $id or return;
return ( $self->{$obj}->{$id} ? $self->{$obj}->{$id} : $self->$m( $id ) )
};
*{ __PACKAGE__ .'::get_'. $obj } = sub { return $_[0]->$m( $_[1] ) };
*{ __PACKAGE__ ."::$m" } = sub {
my( $self, $id ) = @_;
my @objects = map { ( split /:/, $_ )[2] . " $self->{id}" }
split /\n/, $self->{__ibm}->__cmd( "$OBJ->{ $obj }->{ bcmd } $self->{ id }");
my %a = (objects=> [ @objects ],
cmd => $OBJ->{ $obj }->{ cmd },
class => $OBJ->{ $obj }->{ class },
nocache=> 1 );
@objects = $self->{__ibm}->__get_ml_objects( %a );
foreach my $object ( @objects ) {
$self->{ $OBJ->{ $obj }->{ type } }->{ $object->{ $OBJ->{ $obj }->{ id } } } = $object
}
return ( defined $id ? $self->{ $OBJ->{ $obj }->{ type } }->{ $id } : @objects )
}
}
}
1;
__END__
=pod
=head1 NAME
IBM::StorageSystem::VDisk - Class for operations with IBM StorageSystem VDisks
=head1 VERSION
Version 0.01
=head1 SYNOPSIS
IBM::StorageSystem::VDisk - Class for operations with IBM StorageSystem VDisks
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 the VDisk ID 3 and print the VDisk UUID
my $vdisk = $ibm->vdisk(3);
print $vdisk->vdisk_UUID;
# Alternately:
print $ibm->vdisk(3)->vdisk_UUID;
# Print the name, ID, capacity in GB and MDisk group name of all VDisks in a
# nicely formatted output
printf( "%-20s%-8s%-15s%20s\n", 'Name', 'ID', 'Capacity (GB)', 'MDisk Group Name' );
printf( "%-20s%-8s%-15s%20s\n", '-'x18, '-'x4, '-'x12, '-'x15 );
map { printf( "%-20s%-8s%-15s%20s\n", $_->name, $_->id, (int($_->capacity / (1024**3))), $_->mdisk_grp_name) }
grep { $_->status eq 'online' } $ibm->get_vdisks;
# Should print something like:
# Name ID Capacity (GB) MDisk Group Name
# ------------------ ---- ------------ ---------------
# file-host-1 0 5823 FILE_POOL
# backup-host-2 1 2330 BACKUP_POOL
# ... etc.
=head1 METHODS
=head3 FC_id
Specifies the ID of the FlashCopy mapping that the volume belongs to. The value B<many> indicates
that the volume belongs to more than one FlashCopy mapping.
=head3 FC_name
Specifies the name of the FlashCopy mapping that the volume belongs to. The value B<many> indicates
that the volume belongs to more than one FlashCopy mapping.
=head3 IO_group_id
Specifies the I/O Group that the volume belongs to.
=head3 IO_group_name
Specifies the I/O Group that the volume belongs to.
=head3 RC_change
Specifies if a volume is a change volume of a Global Mirror or Metro Mirror relationship.
=head3 RC_id
Specifies the ID of the Global Mirror or Metro Mirror relationship that the volume belongs to. The value must
be numerical.
=head3 RC_name
Specifies the name of the Global Mirror or Metro Mirror relationship that the volume belongs to.
=head3 cache
Specifies the cache mode of the volume. The value can be B<readwrite> or <none>.
( run in 0.648 second using v1.01-cache-2.11-cpan-39bf76dae61 )