# $Id$ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary ComponentState Module for the method NACL::C::Volume->show_df() (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VolumeShowDf =head1 DESCRIPTION C is a derived class of L. Object(s) of this type are returned when NACL::C::Volume->show_df() is invoked. ((This module does not represent the state of any element, but is an object repesentation of the output obtained when NACL::C::Volume->show_df() is invoked.) =head1 ATTRIBUTES The fields of the output are fields of the ComponentState object. =over =item C<< dedupe_saved >> Space Saved by Deduplication possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : deduplicated Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< percent_inodes_used >> Percentage of Inodes Used possible value(s) are, percent_no_limit Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : %iused Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< percent_total_saved >> Percentage Total Space Saved possible value(s) are, percent_no_limit Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : %total-saved Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< dsid >> Volume Data Set ID possible value(s) are, integer Filled in for CMode CLI =item C<< filesys_name >> Volume File System Name possible value(s) are, text Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : filesystem Input: For "filter: filesystem For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< node >> Node Name possible value(s) are, ,local Filled in for CMode CLI =item C<< uuid >> Volume UUID possible value(s) are, UUID Filled in for CMode CLI =item C<< inodes_used >> Inodes Used possible value(s) are, integer Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : iused Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< inodes_free >> Inodes Available possible value(s) are, integer Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : ifree Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< percent_vbn_zero_saved >> Percentage Saved by Zero Detection possible value(s) are, percent_no_limit Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : %vbn_zero Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< total_space >> Total Space possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : kbytes Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< mounted_on >> Mounted Name of the File System possible value(s) are, text Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : mounted_on Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< total_saved >> Total Space Saved possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : total-saved Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< used_space >> Used Space possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : used Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< aggregate >> Containing Aggregate Name possible value(s) are, aggregate name Filled in for CMode CLI =item C<< percent_compression_saved >> Percentage Saved by Compression possible value(s) are, percent_no_limit Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : %compressed Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< percent_used_space >> Percentage of Used Space possible value(s) are, percent_no_limit Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : capacity Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< vbn_zero_saved >> Space Saved by Zero Detection possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : vbn_zero Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< volume >> Volume Name possible value(s) are, volume name Filled in for CMode CLI =item C<< vserver >> Virtual Server Name possible value(s) are, vserver name Filled in for CMode CLI =item C<< volume_style >> Volume Style possible value(s) are, flex,striped,infinitevol Filled in for CMode CLI =item C<< reserved_space >> Reserved Space possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : reserved Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< fs_type >> Snapshot or Active File System possible value(s) are, active,snapshot Filled in for CMode CLI =item C<< percent_dedupe_saved >> Percentage Saved by Deduplication possible value(s) are, percent_no_limit Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : %deduplicated Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< available_space >> Available Space possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : avail Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< compression_saved >> Space Saved by Compression possible value(s) are, [KB,MB,GB,TB,PB] Filled in for CMode CLI and 7M CLI. Maps to: 7M CLI : compressed Input: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. =back =cut package NACL::CS::VolumeShowDf; 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::Exceptions::NoElementsFound qw(:try); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'dedupe_saved', scalar => 'percent_inodes_used', scalar => 'percent_total_saved', scalar => 'dsid', scalar => 'filesys_name', scalar => 'node', scalar => 'uuid', scalar => 'inodes_used', scalar => 'inodes_free', scalar => 'percent_vbn_zero_saved', scalar => 'total_space', scalar => 'mounted_on', scalar => 'total_saved', scalar => 'used_space', scalar => 'aggregate', scalar => 'percent_compression_saved', scalar => 'percent_used_space', scalar => 'vbn_zero_saved', scalar => 'volume', scalar => 'vserver', scalar => 'volume_style', scalar => 'reserved_space', scalar => 'fs_type', scalar => 'percent_dedupe_saved', scalar => 'available_space', scalar => 'compression_saved', ]; =head1 METHODS =head2 fetch my $VolumeShowDf_state = NACL::CS::VolumeShowDf->fetch(command_interface => $ci, ...); my @VolumeShowDf_states = NACL::CS::VolumeShowDf->fetch(command_interface => $ci, ...); (Class method) Discovers which elements are present and returns their state in ComponentState objects. Called in scalar context it returns only one state object, in list context it returns all state objects. See L for a more detailed description along with a complete explanation of the options it accepts. Uses a CMode CLI, 7Mode CLI APISet. Invokes "df -V" commands along with -i,-r,-S options each for 7Mode CLI. =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, @args) = @_; my @state_objs = $pkg->SUPER::fetch( @args, show_cmd => 'volume show-df', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_7mode_cli', interface => 'CLI', set => '7Mode', } ], exception_text => 'No matching volume(s) found', frontend => 'NACL::CS::VolumeShowDf::fetch', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub fetch sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@args, api => 'volume_show_df',); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _fetch_7mode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my $apiset = $opts{apiset}; my $requested_fields = [@{$opts{requested_fields}}]; my $filter = {%{$opts{filter}}}; $pkg->_remove_relational_regex_filters( requested_fields => $requested_fields, filter => $filter ); my @state_objs; my %temp_hash; my $response = $apiset->df('volume' => 1); my $output = $response->get_parsed_output(); foreach my $row (@$output) { my $modified_row = $pkg->_hash_copy( source => $row, copy => [qw(mounted_on )], map => { 'kbytes' => 'total_space', 'filesystem' => 'filesys_name', 'used' => 'used_space', 'capacity' => 'percent_used_space', 'avail' => 'available_space', }, ); my $obj = $pkg->new(command_interface => $opts{command_interface}); $obj->_set_fields(row => $modified_row); push @state_objs, $obj; $temp_hash{$obj->filesys_name()} = $obj; } if ($pkg->_want_any_field_of( requested_fields => $requested_fields, filter => $filter, fields_filled_by_api => [qw( inodes_used inodes_free percent_inodes_used )] ) ) { $response = $apiset->df('volume' => 1, 'inode-usage' => 1); $output = $response->get_parsed_output(); foreach my $row (@$output) { my $filesystem = $row->{filesystem}; my $obj = $temp_hash{$filesystem}; my $inode_info = $pkg->_hash_copy( source => $row, map => { 'iused' => 'inodes_used', 'ifree' => 'inodes_free', '%iused' => 'percent_inodes_used', }, ); $obj->_set_fields(row => $inode_info); } } if ($pkg->_want_any_field_of( requested_fields => $requested_fields, filter => $filter, fields_filled_by_api => [ qw(total_saved dedupe_saved compression_saved percent_total_saved percent_dedupe_saved percent_compression_saved vbn_zero_saved percent_vbn_zero_saved) ] ) ) { $response = $apiset->df( 'volume' => 1, 'block-sharing-and-compression-statistics' => 1 ); $output = $response->get_parsed_output(); foreach my $row (@$output) { my $filesystem = $row->{filesystem}; my $obj = $temp_hash{$filesystem}; my $sharing_compression_info = $pkg->_hash_copy( source => $row, copy => [qw(total-saved)], map => { 'deduplicated' => 'dedupe_saved', 'compressed' => 'compression_saved', '%total-saved' => 'percent_total_saved', '%deduplicated' => 'percent_dedupe_saved', '%compressed' => 'percent_compression_saved', 'vbn_zero' => 'vbn_zero_saved', '%vbn_zero' => 'percent_vbn_zero_saved', }, ); $obj->_set_fields(row => $sharing_compression_info); } } if ($pkg->_want_any_field_of( requested_fields => $requested_fields, filter => $filter, fields_filled_by_api => [qw( reserved_space )] ) ) { $response = $apiset->df('volume' => 1, 'reserved-space' => 1); $output = $response->get_parsed_output(); foreach my $row (@$output) { my $filesystem = $row->{filesystem}; if (defined $temp_hash{$filesystem}) { my $obj = $temp_hash{$filesystem}; my $reserve_info; $reserve_info->{reserved_space} = $row->{reserved}; $obj->_set_fields(row => $reserve_info); } } } $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_7mode_cli 1;