Oo class for creating and managing netapp filer volumes
use NetApp::Filer; use NetApp::Aggregate; my $filer = NetApp::Filer->new({ .... }); my @volume_names = $filer->get_volume_names; my @volumes = $filer->get_volumes; my $volume = $filer->get_volume( 'volname' );
This class encapsulates a single NetApp filer volume, and provides methods for querying information about the volume and it's sub-objects (eg. qtrees), as well as methods for managing the volume itself.
Returns the NetApp::Filer object representing the filer on which the aggregate exists.
Returns the name of the volume as a string.
Each of these methods returns a list of strings, each of which represents a single state, status, or option for the volume.
NOTE: All you English grammar pluralization rules fanatics can give up trying to convince the author to call that one method get_stati. Each of these methods returns the value for the specified state, status or option. If that particular key wasn't present, then this method will return undef. This makes it easy to tell the difference between a key that doesn't exist, and one that has a false value. This method sets a single option to the specified value. It always returns true, and raises a fatal exception if it can not set the option.
Returns the name of the aggregate on which the volume lives. For a \*(L"traditonal\*(R" volume, this will be a false value.
Returns the NetApp::Aggregate object representing the aggregate on which the volume lives. For a \*(L"traditonal\*(R" volume, this will be a false value.
Returns a list of strings, each of which is the name of a qtree on the volume.
Returns a list of NetApp::Qtree objects, each of which represents a single qtree on the volume. Returns a single NetApp::Qtree object for the specified qtree name. The name must in the form of a pathname, for example:
/vol/volume_name/qtree_name
The qtree_name is optional if querying the object for a volume's qtree. This method simply returns nothing if the specified qtree doesn't exist on the volume.
Returns a string representing the language code for the volume. Set the language code to the specified value. Always returns a true value, or raises a fatal exception if the language code can not be set.
Returns the size of the volume as a string. This method sets the size of the volume to the specified value. In all cases, the $size value is of the same form accepted by the create() method, and the underlying \s-1ONTAP\s0 \s-1CLI\s0 command:
[+|-] <number> k|m|g|t
Returns the maxfiles value for the volume. Sets the maxfiles value for the volume.
Returns true if the volume is a clone, false otherwise.
Returns a string representing the name of the parent volume, if this volume is a clone.
Returns a NetApp::Volume object representing the parent volume, if this volume is a clone.
Returns a string representing the snapshot name, if the volume is a clone.
\s-1NOT\s0 \s-1YET\s0 \s-1IMPLEMENTED\s0. This will return a NetApp::Snapshot object, once the \s-1API\s0 is extended to support snapshots (\s-1RSN\s0, I'm sure...)
Returns a list of NetApp::Snapmirror objects, each of which represents a snapmirror relationship for this volume. Takes the volume offline. The arguments are as follows:
$volume->offline( # Optional arguments cifsdelaytime => $cifsdelaytime, ); Bring the volume online. The arguments are as follows:
$volume->online( # Optional arguments force => 1, ); Renames the volume to the specified newname. Always returns a true value, and raises a fatal exception if the name can not be changed. The arguments are as follows:
$volume->rename( # Required arguments newname => $newname, ); Puts the volume into the restricted state. The arguments are as follows:
$volume->restrict( # Optional arguments cifsdelaytime => $cifsdelaytime, );
get_snapshots
Returns a list of NetApp::Snapshot objects for each of the snapshots of the volume.
get_snapshot( $name )
Returns a single NetApp::Snapshot object matching the specified name, if it exists for the volume.
create_snapshot( $name )
Creates a snapshot of the volume with the specified name.
delete_snapshot( $name )
Deletes a snapshot of the volume with the specified name.
get_snapshot_deltas
Returns a list of NetApp::Snapshot::Delta objects for each snapshot delta for the volume.
get_snapshot_reserved
Returns a string representing the amount of reserved space, as a percentage. This string does \s-1NOT\s0 include the % sign.
set_snapshot_reserved( $percentage )
Sets the snapshot reserved space to the specified percentage, which should also \s-1NOT\s0 include the % sign.
get_snapshot_schedule
Returns a NetApp::Snapshot::Schedule object representing the snapshot schedule for the volume.
set_snapshot_schedule( %args )
Sets the snapshot schedule for the volume based on the arguments passed. The argument syntax is:
$volume->set_snapshot_schedule( weekly => $weekly, daily => $daily, hourly => $hourly, hourlist => [ $hour1, $hour2, $hour3, .... ], );
enable_shapshot_autodelete
This method turns on snapshot autodelete for the volume.
disable_snapshot_autodelete
This method turns off snapshot autodelete for the volume.
reset_snapshot_autodelete
This method resets snapshot autodelete for the volume to the filer defaults.
set_snapshot_autodelete_option( $name => $value )
Sets the specified snapshot autodelete option ($name) to the specified $value.
get_snapshot_autodelete_option( $name )
Returns the value of the specified autodelete option ($name). Note that if the prefix is \*(L"(not specified)\*(R", then the value returned is the empty string.
The following \s-1ONTAP\s0 vol commands are not implemented, because the same functionality and information is provided through this \s-1API\s0 via some other means.
The aggregate containing the volume can be obtained using:
$volume->get_aggregate;
which will return the NetApp::Aggregate object for it.
All other commands will be implemented in a future release of this \s-1API\s0. Commands for flexible volumes will most likely have preference over traditional volumes.
It's not yet clear just how this one should be implemented, since the command does several things. It enables and disables the autosize feature, or resets it to defaults, and it also sets the maximum and incremental sizes to autosize to.
This could be implemented a few different ways, for example:
$volume->autosize( # Optional arguments maximum => $maximum, incremental => $incremental, # Optional, but mutually exclusive: on => 1, off => 1, reset => 1, );
That seems a little clumsy, though. Perhaps a better interface would be to have methods to control the state of the feature:
$volume->enable_autosize; $volume->disable_autosize; $volume->reset_autosize;
and then methods to set/get the autosize values:
$volume_set_autosize( # Required but mutually exclusive options maximum => $maximum, incremental => $incremental, );
$volume->get_autosize;