# $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 LunCopy ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com, benjaram@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::LunCopy =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP LunCopy. A related class is L, which represents access to an ONTAP LunCopy. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the LunCopy element are the attributes of the LunCopy ComponentState. Additionally, the command_interface used to obtain the ComponentState object is also an attribute of the object. This makes it easier to obtain the component object corresponding to the CS object, using L. =over =item command_interface The command_interface with which the CS object was obtained. (Available in all CS objects regardless of requested_fields and the mode/interface) =item C<< max_cutover_time >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< max_throughput >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< scanner_total >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< vserver >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< scanner_paused >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< dest_vdisk_id >> Filled in for CMode CLI. =item C<< src_vdisk_id >> Filled in for CMode CLI. =item C<< scanner_status >> Filled in for CMode CLI/ZAPI. =item C<< destination_path >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< scanner_progress >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< job_uuid >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< source_path >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< promote_early >> *Promote Early Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value Filled in for CMode CLI. =item C<< scanner_progress >> Filled in for CMode CLI. =item C<< job_uuid >> Filled in for CMode CLI. =item C<< source_path >> Filled in for CMode CLI. =item C<< promote_early >> *Promote Early Filled in for CMode CLI. =item C<< cursor >> Filled in for CMode CLI. =item C<< scanner_progress_bytes >> *LUN Copy Progress(bytes) Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< node >> *Node Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< dest_ready >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For 'requested_fields', 'filter' and Output mapping: $value =item C<< scanner_progress_percent >> *LUN Copy Progress(%) Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< last_failure_reason >> *Last Failure Reason Filled in for CMode CLI/ZAPI. =item C<< cutover_time >> *Cutover Time (s) Filled in for CMode CLI/ZAPI. =item C<< is_snapshot_fenced >> *Is Snapshot Fenced, possible value(s) are true,false Filled in for CMode CLI/ZAPI. =item C<< elapsed_time >> *Elapsed Time Filled in for CMode CLI. =item C<< destination_node >> *Destination Node Filled in for CMode CLI. =item C<< job_status >> LUN Copy Status Filled in for CMode CLI/ZAPI. =item C<< source_vserver >> Source Vserver Name Filled in for CMode CLI. =item C<< lun_index >> LUN Index Filled in for CMode CLI/ZAPI. =item C<< is_promoted_early >> Is Destination Promoted Early possible value(s) are, true,false Filled in for CMode CLI/ZAPI. =item C<< progress_percent >> LUN Copy Progress (%) Filled in for CMode CLI. =item C<< is_destination_ready >> Is Destination Ready possible value(s) are, true,false Filled in for CMode CLI/ZAPI. =item C<< source_snapshot_instance_uuid >> Source Snapshot Instance UUID Filled in for CMode CLI. =item C<< source_snapshot >> Source Snapshot Name Filled in for CMode CLI. =item C<< source_snapshot_id >> Source Snapshot ID Filled in for CMode CLI. =back =cut package NACL::CS::LunCopy; 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 NACL::C::_Mixins::LunCopyRelocation qw(:all); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'max_cutover_time', scalar => 'max_throughput', scalar => 'scanner_total', scalar => 'vserver', scalar => 'scanner_paused', scalar => 'dest_vdisk_id', scalar => 'src_vdisk_id', scalar => 'scanner_status', scalar => 'destination_path', scalar => 'scanner_progress', scalar => 'job_uuid', scalar => 'source_path', scalar => 'promote_early', scalar => 'cursor', scalar => 'scanner_progress_bytes', scalar => 'node', scalar => 'dest_ready', scalar => 'scanner_progress_percent', scalar => 'last_failure_reason', scalar => 'cutover_time', scalar => 'is_snapshot_fenced', scalar => 'elapsed_time', scalar => 'destination_node', scalar => 'job_status', scalar => 'source_vserver', scalar => 'lun_index', scalar => 'is_promoted_early', scalar => 'progress_percent', scalar => 'is_destination_ready', scalar => 'source_snapshot_instance_uuid', scalar => 'source_snapshot', scalar => 'source_snapshot_id', ]; =head1 METHODS =head2 fetch my $LunCopy_state = NACL::CS::LunCopy->fetch(command_interface => $ci, ...); my @LunCopy_states = NACL::CS::LunCopy->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/ZAPI APISet. Uses lun-copy-get-iter method for CMode ZAPI. Supports CMode CLI/ZAPI. Invokes "lun-copy-get-iter" API for CMode 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 = shift; my @state_objs = $pkg->SUPER::fetch( @_, show_cmd => 'lun copy show', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode' } ], exception_text => 'No matching lun copy(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 => 'lun_copy_show',); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; my $common_copy = $pkg->_common_fetch_zapi_copy(); push @$common_copy, ('is-promoted-early', 'source-vserver'); my $map = {'vserver' => 'destination-vserver'}; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( %opts, api => 'lun_copy_get_iter', copy => $common_copy, map => $map, ); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi sub _compute_cmode_cli_options { $Log->enter() if $may_enter; my ($pkg, %args) = @_; my @requested_fields; @requested_fields = @{$args{requested_fields}}; my $opts = $pkg->SUPER::_compute_cmode_cli_options(%args); foreach my $requested_field (@requested_fields) { if($requested_field =~ /job-uuid|lun-index/) { $opts->{fields} .= ",$requested_field"; } } # remove leading ,(comma) if its there if ( defined $opts->{fields} ) { $opts->{fields} =~ s/^,//; } $Log->exit() if $may_exit; return $opts; } ## end sub _compute_cmode_cli_options 1;