NetApp

 view release on metacpan or  search on metacpan

lib/NetApp/Volume.pm  view on Meta::CPAN

            push @clones, $self->get_filer->get_volume( $clone_name );
        }

        return @clones;

    }

    sub is_clone {
        my $self	= shift;
        return ( $self->get_parent_name ? 1 : 0 );
    }

    sub get_parent {
        my $self	= shift;
        if ( $self->is_clone ) {
            return $self->get_filer->get_volume( $self->get_parent_name );
        } else {
            return;
        }
    }

    sub get_snapmirrors {
        my $self	= shift;
        return $self->get_filer->_get_snapmirrors( volume => $self );
    }

    sub get_snapshots {
        return NetApp::Snapshot->_get_snapshots( parent => shift );
    }

    sub get_snapshot {
        my $self	= shift;
        my ($name)	= validate_pos( @_, { type => SCALAR } );
        return grep { $_->get_name eq $name } $self->get_snapshots;
    }

    sub create_snapshot {
        my $self	= shift;
        my ($name)	= validate_pos( @_, { type => SCALAR } );
        return NetApp::Snapshot->_create_snapshot(
            parent	=> $self,
            name	=> $name,
        );
    }

    sub delete_snapshot {
        my $self	= shift;
        my ($name)	= validate_pos( @_, { type => SCALAR } );
        return NetApp::Snapshot->_delete_snapshot(
            parent	=> $self,
            name	=> $name,
        );
    }

    sub delete_all_snapshots {

        croak(__PACKAGE__ . "->delete_all_snapshots not yet implemented\n");

        # XXX: This one's tricky to implement.  Should we parse the
        # output, and attempt to return a list of what was delete, and
        # what was busy?  Probably too ugly.

        my $self	= shift;

        return $self->get_filer->_run_command(
            command	=> [ qw( snap delete -a -f -q ), $self->get_name ],
        );

    }

    sub get_snapshot_deltas {
        return NetApp::Snapshot->_get_snapshot_deltas( parent => shift );
    }

    sub get_snapshot_reserved {
        return NetApp::Snapshot->_get_snapshot_reserved( parent => shift );
    }

    sub set_snapshot_reserved {
        my $self	= shift;
        my ($reserved)	= validate_pos( @_, { type => SCALAR } );
        return NetApp::Snapshot->_set_snapshot_reserved(
            parent 	=> $self,
            reserved	=> $reserved,
        );
    }

    sub get_snapshot_schedule {
        return NetApp::Snapshot->_get_snapshot_schedule(
            parent	=> shift,
            @_
        );
    }

    sub set_snapshot_schedule {
        return NetApp::Snapshot->_set_snapshot_schedule(
            parent	=> shift,
            @_
        );
    }

    sub enable_snapshot_autodelete {
        my $self	= shift;
        return $self->get_filer->_run_command(
            command	=> [ qw(snap autodelete), $self->get_name, qw(on) ],
        );
    }

    sub disable_snapshot_autodelete {
        my $self	= shift;
        return $self->get_filer->_run_command(
            command	=> [ qw(snap autodelete), $self->get_name, qw(off) ],
        );
    }

    sub reset_snapshot_autodelete {
        my $self	= shift;
        return $self->get_filer->_run_command(
            command	=> [ qw(snap autodelete), $self->get_name, qw(reset) ],
        );
    }



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