# # Copyright (c) 2001-2013 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_footprint() (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VolumeShowFootprint =head1 DESCRIPTION C is a derived class of L. Object(s) of this type are returned when NACL::C::Volume->show_footprint() 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_footprint() is invoked.) =head1 ATTRIBUTES The fields of the output are fields of the ComponentState object. =over =item C<< delayed_free_fp_percent >> Delayed Free Footprint Percent Filled in for CMode CLI. =item C<< percent_used >> Used Percentage Filled in for CMode CLI. =item C<< flexvol_metadata_fp >> Flexible Volume's Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< delayed_free_fp >> Delayed Free Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< volume_guarantee_fp_percent >> Guarantee Footprint Percent Filled in for CMode CLI. =item C<< dedupe_metafiles_fp_percent >> Deduplication Metadata Footprint Percent Filled in for CMode CLI. =item C<< total_fp >> Total Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< tape_backup_metafiles_fp_percent >> Tape Backup Metadata Percent Filled in for CMode CLI. =item C<< dedupe_metafiles_fp >> Deduplication Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< total_fp_percent >> Total Footprint Percent Filled in for CMode CLI. =item C<< snapmirror_destination_fp >> SnapMirror Destination Transfer Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< dedupe_metafiles_tmp_fp >> Temporary Deduplication Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< volume >> Volume Name Filled in for CMode CLI/ZAPI, 7Mode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI/ZAPI: For "Filter": volume For "requested_fields", Not applicable, but the field will be populated in the CS object. =item C<< dedupe_metafiles_tmp_fp_percent >> Temporary Deduplication Metadata Footprint Percent Filled in for CMode CLI. =item C<< vserver >> Vserver Name Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< flexvol_metadata_fp_percent >> Flexible Volume's Metadata Footprint Percent Filled in for CMode CLI. =item C<< snapmirror_destination_fp_percent >> SnapMirror Destination Transfer Footprint Percent Filled in for CMode CLI. =item C<< volume_blocks_fp_percent >> Volume Blocks Written Footprint Percent Filled in for CMode CLI. =item C<< total >> Total User-Visible Size, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< volume_guarantee_fp >> Guarantee Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< used >> Used Size, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< tape_backup_metafiles_fp >> Tape Backup Metadata, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< volume_blocks_fp >> Volume Blocks Written Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< snapmirror_destination_footprint >> SnapMirror Destination Transfer Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< flexvol_metadata_footprint_percent >> Flexible Volume's Metadata Footprint Percent Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI: 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<< delayed_free_footprint_percent >> Delayed Free Footprint Percent Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI: 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_blocks_footprint_percent >> Volume Blocks Written Footprint Percent Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI: 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<< hostname >> Hostname Filled in for CMode CLI. =item C<< volume_dsid >> Volume DSID Filled in for CMode CLI. =item C<< tape_backup_metafiles_footprint >> Tape Backup Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< dedupe_metafiles_temporary_footprint >> Temporary Deduplication Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< total_footprint >> Total Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI, 7Mode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI/ZAPI: 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<< dedupe_metafiles_footprint >> Deduplication Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< total_footprint_percent >> Total Footprint Percent Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI: 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<< vserver_uuid >> Vserver UUID Filled in for CMode CLI. =item C<< snapmirror_destination_footprint_percent >> SnapMirror Destination Transfer Footprint Percent Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< aggregate >> Aggregate Name Filled in for CMode CLI. =item C<< dedupe_metafiles_temporary_footprint_percent >> Temporary Deduplication Metadata Footprint Percent Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< flexvol_metadata_footprint >> Flexible Volume's Metadata Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI, 7Mode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI/ZAPI: 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<< tape_backup_metafiles_footprint_percent >> Tape Backup Metadata Footprint Percent Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< volume_blocks_footprint >> Volume Blocks Written Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI, 7Mode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI/ZAPI: 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<< delayed_free_footprint >> Delayed Free Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI, 7Mode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode CLI/ZAPI: 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_guarantee_footprint >> Guarantee Footprint, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI/ZAPI, 7Mode CLI/ZAPI. Maps to: 7Mode CLI/ZAPI: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< aggregate_uuid >> Aggregate UUID Filled in for CMode CLI. =item C<< aggregate_size >> Containing Aggregate Size, possible value(s) are [KB,MB,GB,TB,PB] Filled in for CMode CLI. =item C<< volume_guarantee_footprint_percent >> Guarantee Footprint Percent Filled in for CMode/7Mode CLI/ZAPI. Maps to: 7Mode CLI: For "filter": Applicable, Filtering will be done by Components. For "requested_fields", Not applicable, but the field will be populated in the CS object. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< dedupe_metafiles_footprint_percent >> Deduplication Metadata Footprint Percent Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< volume_msid >> Volume MSID Filled in for CMode CLI. =item C<< file_operation_metadata >> File Operation Metadata Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< file_operation_metadata_percent >> File Operation Metadata Percent Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =back =cut package NACL::CS::VolumeShowFootprint; 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 => 'delayed_free_fp_percent', scalar => 'percent_used', scalar => 'flexvol_metadata_fp', scalar => 'delayed_free_fp', scalar => 'volume_guarantee_fp_percent', scalar => 'dedupe_metafiles_fp_percent', scalar => 'total_fp', scalar => 'tape_backup_metafiles_fp_percent', scalar => 'dedupe_metafiles_fp', scalar => 'total_fp_percent', scalar => 'snapmirror_destination_fp', scalar => 'dedupe_metafiles_tmp_fp', scalar => 'volume', scalar => 'dedupe_metafiles_tmp_fp_percent', scalar => 'vserver', scalar => 'flexvol_metadata_fp_percent', scalar => 'snapmirror_destination_fp_percent', scalar => 'volume_blocks_fp_percent', scalar => 'total', scalar => 'volume_guarantee_fp', scalar => 'used', scalar => 'tape_backup_metafiles_fp', scalar => 'volume_blocks_fp', scalar => 'snapmirror_destination_footprint', scalar => 'flexvol_metadata_footprint_percent', scalar => 'delayed_free_footprint_percent', scalar => 'volume_blocks_footprint_percent', scalar => 'hostname', scalar => 'volume_dsid', scalar => 'tape_backup_metafiles_footprint', scalar => 'dedupe_metafiles_temporary_footprint', scalar => 'total_footprint', scalar => 'dedupe_metafiles_footprint', scalar => 'total_footprint_percent', scalar => 'vserver_uuid', scalar => 'snapmirror_destination_footprint_percent', scalar => 'aggregate', scalar => 'dedupe_metafiles_temporary_footprint_percent', scalar => 'flexvol_metadata_footprint', scalar => 'tape_backup_metafiles_footprint_percent', scalar => 'volume_blocks_footprint', scalar => 'delayed_free_footprint', scalar => 'volume_guarantee_footprint', scalar => 'aggregate_uuid', scalar => 'aggregate_size', scalar => 'volume_guarantee_footprint_percent', scalar => 'dedupe_metafiles_footprint_percent', scalar => 'volume_msid', scalar => 'file_operation_metadata', scalar => 'file_operation_metadata_percent', ]; =head1 METHODS =head2 fetch my $VolumeShowFootprint_state = NACL::CS::VolumeShowFootprint->fetch(command_interface => $ci, ...); my @VolumeShowFootprint_states = NACL::CS::VolumeShowFootprint->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. Supports CMode CLI/ZAPI, 7Mode CLI/ZAPI. Invokes "volume-footprint-get-iter" API for CMode ZAPI. Invokes "vol status('show-footprint' => 1)" command for 7Mode/Nodescope CLI. Invokes "volume-footprint-list-info" API for 7Mode ZAPI. =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, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_7mode_cli', interface => 'CLI', set => '7Mode|Nodescope' }, { method => '_fetch_7mode_zapi', interface => 'ZAPI', set => '7Mode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', } ], show_cmd => 'volume show-footprint', exception_text => 'No matching volume(s) found', ); $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 = shift; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@_, api => 'volume_show_footprint',); $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 ($response, $caught_exception); # We should not be modifying the original reference passed in # Make a local copy and then modify that my %copy_filter = %{$opts{filter}}; my @copy_requested_fields = @{$opts{requested_fields}}; $pkg->_remove_relational_regex_filters( filter => \%copy_filter, requested_fields => \@copy_requested_fields ); my $cmd_args = $pkg->_hash_copy( source => \%copy_filter, # See VolumeQuota.pm for an example of map copy => ['volume'], ); try { $response = $apiset->vol_status( 'show-footprint' => 1, %$cmd_args ); } ## end try catch NACL::APISet::Exceptions::InvalidParamValueException with { # A caught exception indicates that the volume being looked for # does not exist. We catch the exception and return immediately. The # 'fetch' frontend decides whether to throw a NoElementsFound # exception based on the value of 'allow_empty' $caught_exception = 1; }; if ($caught_exception) { $Log->exit() if $may_exit; return; } my $output = $response->get_parsed_output(); my @state_objs; foreach my $row (@$output) { # Due to loss of precision, we are not converting the values to bytes my $final_attributes = $pkg->_hash_copy( source => $row, copy => [qw( volume )], # If we find more fields need to be added to the 7Mode APIset, we # can add them to copy or map later map => { 'total' => 'total_footprint', 'total_percent' => 'total_footprint_percent', 'volume_data_footprint' => 'volume_blocks_footprint', 'volume_data_footprint_percent' => 'volume_blocks_footprint_percent', 'volume_guarantee' => 'volume_guarantee_footprint', 'volume_guarantee_percent' => 'volume_guarantee_footprint_percent', 'flexible_volume_metadata' => 'flexvol_metadata_footprint', 'flexible_volume_metadata_percent' => 'flexvol_metadata_footprint_percent', 'delayed_frees' => 'delayed_free_footprint', 'delayed_frees_percent' => 'delayed_free_footprint_percent', }, ); my $obj = $pkg->new(command_interface => $opts{command_interface}); $obj->_set_fields(row => $final_attributes); push @state_objs, $obj; } ## end foreach my $row (@$output) $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_7mode_cli sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( @args, api => 'volume_footprint_get_iter', copy => [ qw ( dedupe-metafiles-footprint dedupe-metafiles-footprint-percent dedupe-metafiles-temporary-footprint dedupe-metafiles-temporary-footprint-percent delayed-free-footprint delayed-free-footprint-percent flexvol-metadata-footprint-percent flexvol-metadata-footprint snapmirror-destination-footprint snapmirror-destination-footprint-percent tape-backup-metafiles-footprint tape-backup-metafiles-footprint-percent total-footprint-percent total-footprint volume-blocks-footprint-percent volume-blocks-footprint vserver volume volume-guarantee-footprint volume-guarantee-footprint-percent file-operation-metadata file-operation-metadata-percent ) ] ); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi sub _fetch_7mode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my $apiset = $opts{apiset}; my $response; my %copy_filter = %{$opts{filter}}; my @copy_requested_fields = @{$opts{requested_fields}}; $pkg->_remove_relational_regex_filters( filter => \%copy_filter, requested_fields => \@copy_requested_fields ); my $cmd_args = $pkg->_hash_copy( source => \%copy_filter, copy => ['volume'], ); $response = $apiset->volume_footprint_list_info(%$cmd_args); my $output = $response->get_parsed_output(); my @state_objs; my $footprint_info = defined($output->[0]->{'footprint-infos'}->[0]->{'footprint-info'}) ? $output->[0]->{'footprint-infos'}->[0]->{'footprint-info'} : $output->[0]->{'vol-footprint-infos'}->[0]->{'vol-footprint-info'}; foreach my $row (@$footprint_info) { my $final_attributes = $pkg->_hash_copy( source => $row, copy => [qw( volume )], map => { 'total' => 'total-footprint', 'volume-data-footprint' => 'volume-blocks-footprint', 'volume-guarantee' => 'volume-guarantee-footprint', 'flexible-volume-metadata' => 'flexvol-metadata-footprint', 'delayed-frees' => 'delayed-free-footprint', }, ); my $obj = $pkg->new(command_interface => $opts{command_interface}); $obj->_set_fields(row => $final_attributes); push @state_objs, $obj; } ## end foreach my $row (@$output) $Log->exit() if $may_exit; return @state_objs; } 1;