# # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary Volume64bitUpgrade ComponentState Module ## @author madhav.shekar@netapp.com, dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::Volume64bitUpgrade =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP Volume64bitUpgrade. A related class is L, which represents access to an ONTAP Aggregate. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the Volume64bitUpgrade element are the attributes of the Volume64bitUpgrade ComponentState. =over =item C<< space_estimate_complete => $string >> =item C<< scan_time_to_complete => $string >> =item C<< include_all_volumes => $string >> =item C<< scan_progress => $string >> =item C<< uuid => $string >> =item C<< scan_percent_completed => $string >> =item C<< estimated_used_space => $string >> =item C<< size_fixed => $string >> =item C<< estimated_available_space => $string >> =item C<< volume => $string >> =item C<< vserver => $string >> =item C<< total_size => $string >> =item C<< estimated_percent_used_space => $string >> =item C<< format => $string >> =item C<< scanner_status => $string >> =item C<< estimated_grow_vol_size_by => $string >> =item C<< estimated_available_size => $string >> =item C<< last_errorno => $string >> =item C<< estimate_data_exists => $string >> =back =head1 ADDITIONAL FILTER FIELDS These are the additional filter fields that can be provided. =over =item C<< aggregate >> This is the aggregate containing the volume, is mandatory for 7Mode and ignored for CMode. =back =cut package NACL::CS::Volume64bitUpgrade; use strict; use warnings; use Params::Validate qw(validate); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use NACL::ComponentUtils qw(Dumper); use base 'NACL::CS::ComponentState::ONTAP'; use NACL::CS::Volume; use NACL::CS::StorageAggregate64bitUpgrade; use NACL::Exceptions::NoElementsFound qw(:try); use NATE::BaseException qw(:try); use Class::MethodMaker [ scalar => "space_estimate_complete", scalar => "scan_time_to_complete", scalar => "include_all_volumes", scalar => "scan_progress", scalar => "uuid", scalar => "scan_percent_completed", scalar => "estimated_used_space", scalar => "size_fixed", scalar => "volume", scalar => "vserver", scalar => "total_size", scalar => "estimated_percent_used_space", scalar => "format", scalar => "scanner_status", scalar => "estimated_grow_vol_size_by", scalar => "estimated_available_space", scalar => "last_errorno", scalar => "estimate_data_exists", ]; =head1 METHODS =head2 fetch my $vol_64bit_upgrade_state = NACL::CS::Volume64bitUpgrade->fetch(command_interface=>$ci,...); my @vol_64bit_upgrade_states = NACL::CS::Volume64bitUpgrade->fetch(command_interface=>$ci,...); see L =over =item Exceptions =over =item C When there are no elements matching the query specified or elements of that type doesn't exist, then this exception will be thrown. =back =back =cut sub fetch { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::fetch( @_, choices => [ { method => "_fetch_cmode_cli", interface => "CLI", set => "CMode", }, { method => '_fetch_7mode_cli', interface => 'CLI', set => '7Mode', }, ], exception_text => 'No matching volume64bit upgrade(s) found', show_cmd => 'volume 64bit-upgrade status', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my %filter = %{ $opts{filter} }; #Aggregate is an extra filter field which is not listed #in method maker ,this needs to deleted from the filter hash #before being passed to base class method delete $filter{aggregate}; my @ret = $pkg->SUPER::_fetch_cmode_cli( %opts, filter => \%filter, api => "volume_64bit_upgrade_status" ); $Log->exit() if $may_exit; return @ret; } sub _fetch_7mode_cli{ $Log->enter() if $may_enter; my $pkg = shift; my %opts = validate @_, $pkg->_fetch_backend_validate_spec(); my $command_interface = delete $opts{command_interface}; my $apiset = delete $opts{apiset}; my $aggregate; if ( !defined( $opts{filter}->{aggregate} ) ) { NATE::BaseException->throw("aggregate is the required field for 7Mode"); } else { $aggregate = $opts{filter}->{aggregate}; } my $aggr_info = NACL::CS::StorageAggregate64bitUpgrade->fetch( command_interface => $command_interface, filter => { aggregate => $aggregate, "include-all-volumes" => "true", }, ); my @vol_64bit = $aggr_info->volumes_64bit(); $Log->exit() if $may_exit; return @vol_64bit; } ## end sub _fetch_7mode_cli sub _extra_filter_fields { $Log->enter() if $may_enter; $Log->exit() if $may_exit; return [ qw( aggregate ) ]; } 1;