The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Salaris::Disk::SVM

SYNOPSIS

  my $svm = Solaris::Disk::SVM->new( init => 1 );
  $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::Partitions.

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 |'.

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 permettra de sortir la configuration au format metastat -p.

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 is quite limited as to possible SVM configuration. I really should take time to create weird configurations, with space loss as in concat stripes with different size components.

Another good test to implement is a simple showconfig, and see if there are no 'Use of uninitialized value' warnings. Seems I need to re-read Schwern's testing tutorial.

AUTHOR

Jérôme Fenal <jfenal@free.fr>

VERSION

This is version 0.01 of the Solaris::Disk::SVM.

COPYRIGHT

Copyright (C) 2004 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::Partitions to access slice information. See Solaris::Disk::Mnttab to get current mounted devices.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 1016:

Non-ASCII character seen before =encoding in 'Jérôme'. Assuming CP1252