NAME
Solaris::Disk::SVM - Read, explore and manipulate SVM disk configurations
SYNOPSIS
my $svm = Solaris::Disk::SVM->new( init => 1 );
$svm->dumpconfig();
my $svm = Solaris::Disk::SVM->new( init => 1, sourcedir => 't/data' );
$svm->dumpconfig();
my $svm = Solaris::Disk::SVM->new( init => 0 );
$svm->{mnttab}->readmtab( mnttab => 't/data/mnttab.txt' );
$svm->{mnttab}->readstab( swaptab => 't/data/swaptab.txt' );
$svm->{vtoc}->readvtocdir( 't/data' );
$svm->readconfig( metastatp => 't/data/metastat-p.txt' );
DESCRIPTION
The Solaris::Disk::SVM object allows to read (all) the necessary information to restitute this information in a computer and human readable manner.
Its main purpose is to provide support to the svm(1) script included in the Solaris::Disk::SVM distribution.
METHODS
new
The new
method returns a new Solaris::Disk::SVM
object.
No initialisation nor information read:
$svm = Solaris::Disk::SVM->new();
Initialise and read tables, from optional sources:
$svm = Solaris::Disk::SVM->new(
init => 1,
metastatp => 'metastat -p |',
);
If running on different OS than Solaris, or on a different host than the target one, you may need to specify other data sources such as the one for Solaris::Disk::Mnttab
and Solaris::Disk::VTOC
.
sdscreateobject
$sds->createobject( $dev, $desc);
$sds->createobject( 'd101', '1 1 d102');
$sds->createobject( 'd100', '-m d101 d103');
We pass a new object description to sdscreateobject
to add it to the memory configuration, in order to propagate sub-objects to the whole configuration.
readconfig
$svm->readconfig( metastatp => 'metastatp.txt' );
readconfig
reads a data source in 'metastat -p' format, and creates configuration from it calling sdscreateobject and propagating device dependencies.
The metastatp
named argument can provide a file source to use instead of 'metastat -p |'.
Returns non 0 on error.
size
$svm->size( $device );
size
returns the size (in blocks) of $device
.
showconfig
$svm->showconfig(); # no argument
showconfig
dumps in a (almost) human readable manner the configuration.
dumpconfig
dumpconfig
will, when implemented, dump the loaded configuration in the "metastat -p" format.
showsp
$svm->showsp();
$svm->showsp( "c4t10d0s0" ); # for softparts on disk slice
$svm->showsp( "d100" ); # for softparts on devices
showsp
prints the list of the given soft-partition(s) container.
explaindev
$svm->explaindev( 'd1', 'd2' );
explaindev
prints an explaination about devices asked for. Multiple device names can be passed in arguments as a list.
getnextdev
my $nextdevid = 'd' . $svm->getnexdev;
getnextdev
takes no arguments, and returns the first free device number beyond the last one defined.
Used to find what number to give to a new device.
isdevfree
my $isfree{$dev} = $svm->isdevfree( $dev );
isdevfree
take a device name (/^d\d$/
) or a device number in argument and return 0 if the device is already defined, 1 if the device is not defined.
getsubdevs
@sdevs = $svm->getsubdevs( 'd10' );
@sdevs = $svm->getsubdevs( 'd10', 'd20' );
getsubdevs
returns the list of devices underlying those passed as argument(s). Only one level deep.
getphysdevs
@pdevs = $svm->getphysdevs( 'd10' );
@pdevs = $svm->getphysdevs( 'd10', 'd20' );
getphysdevs
returns the list of physical devices underlying those passed as argument(s).
mponslice
@mps = $svm->mponslice( 'c0t0d0s0' );
@mps = $svm->mponslice( 'c0t0d0s1' );
mponslice
returns the list of filesystems present on a physical disk slice.
This information is drawn from two sources: Solaris::Disk::Mnttab
, and from the SVM object hierarchy, so one can ask for mount points on SVM devices.
mpondisk
@mps = $svm->mpondisk( 'c0t0d0' );
@mps = $svm->mpondisk( 'c0t0d0s0' ); # idem
@mps = $svm->mpondisk( 'c0t0d0s1' ); # idem
mpondisk
returns the list of filesystems present on a physical disk.
mpondev
@mps = $svm->mpondev( 'd10' );
mpondev
returns the list of filesystems present on a SVM device.
devs4mp
@devs = $svm->devs4mp( '/export/home' );
devs4mp
returns the list of all devices (either the one directly under the mount point or other devices below) for a given mount point.
disks4mp
@disks = $svm->disks4mp( '/export/home' );
disks4mp
returns the list of all physical disks on which is a given mount point via SVM.
version
$version = $svm->version;
version
returns the current version of this package.
BUGS
Not all methods are implemented (dumpconfig
).
Many accessors are missing to the internal data structure, which may lead to the lost in data structure programer syndrom(tm).
RAID0 device size may not be accurate, particularly when the underlying devices are of different sizes. Your mileage may vary. This particularity needs testing and development in regard to the computing model (smallest device size * number of devices for RAID1).
The test suite has been augmented to cover all possible SVM configuration. However, these configurations may not be possible with SVM (I do not have access anymore to a Solaris+SVM machine), thus the module may accept unacceptable configuration schemes.
I really should take time to create weird configurations, with space loss as in concat stripes with different size components, and users, such as you, will help all of us sending me some weird configurations as well. The more data we have to test against, the more accurate the module will be. If nearly all code pathes are actually tested, some are better than others. One example is the size
method, which results are not tested against real world figures.
Please report any other bugs or feature requests to bug-solaris-disk-svm@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Solaris-Disk-SVM. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
AUTHOR
Jérôme Fenal <jfenal@free.fr>
You are welcome to send me sample configurations, bug reports or kudos.
VERSION
This is version 0.02 of the Solaris::Disk::SVM
module.
COPYRIGHT
Copyright (C) 2004, 2005 Jérôme Fenal. All Rights Reserved
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
See Solaris::Disk::VTOC to access disk slices information.
See Solaris::Disk::Mnttab to get current mounted devices.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 1087:
Non-ASCII character seen before =encoding in 'Jérôme'. Assuming CP1252