# $Id$ # # Copyright (c) 2001-2014 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary LunPersistentReservation ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::LunPersistentReservation =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP LunPersistentReservation. A related class is L, which represents access to an ONTAP LunPersistentReservation. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the LunPersistentReservation element are the attributes of the LunPersistentReservation 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<< protocol >> Protocol possible value(s) are, fcp,iscsi Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: reservation-type =item C<< reservation_type_code >> Reservation Type Filled in for CMode CLI/ZAPI, non-iter. =item C<< entry_type >> Reservation or Registration possible value(s) are, reservation,registration Filled in for CMode CLI/ZAPI, non-iter. =item C<< third_party_initiator_name >> Third Party Initiator Name Filled in for CMode CLI/ZAPI, non-iter. =item C<< isid >> Initiator Session ID Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< initiator_iqn >> iSCSI Initiator Name Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< lun >> LUN Name Filled in for CMode CLI/ZAPI, non-iter. =item C<< qtree >> Qtree Name Filled in for CMode CLI/ZAPI, non-iter. =item C<< vdisk_id >> Vdisk ID Filled in for CMode CLI/ZAPI, non-iter. =item C<< tpgroup_tag >> TPGroup Tag Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< third_party_port >> Third Party Initiator Port Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< reservation_key >> Reservation Key Filled in for CMode CLI/ZAPI, non-iter. =item C<< offset >> Offset into PR List Filled in for CMode CLI/ZAPI, non-iter. =item C<< third_party_iqn >> Third Party Initiator Name Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< volume >> Volume Name Filled in for CMode CLI/ZAPI, non-iter. =item C<< vserver >> Vserver Name Filled in for CMode CLI/ZAPI, non-iter. =item C<< initiator_port >> FCP Initiator Port Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< path >> LUN Path Filled in for CMode CLI/ZAPI, non-iter. =item C<< target_wwpn >> FCP Target WWPN Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: =item C<< online >> Online possible value(s) are, online,offline,nvfail,space-error,foreign-lun-error Filled in for CMode CLI/ZAPI, non-iter. =item C<< initiator_name >> Initiator Name Filled in for CMode CLI/ZAPI, non-iter. =item C<< scsi_revision >> SCSI Revision possible value(s) are, scsi2,scsi3 Filled in for CMode CLI/ZAPI, non-iter. =item C<< mapped >> Mapped possible value(s) are, mapped,unmapped Filled in for CMode CLI/ZAPI, non-iter. =item C<< aptpl >> Persist Through Power Loss possible value(s) are, true,false Filled in for CMode CLI/ZAPI, non-iter. =back =cut package NACL::CS::LunPersistentReservation; use strict; use warnings; use Params::Validate qw(validate); use NATE::Log qw(log_global); use NACL::Exceptions::NoElementsFound qw(:try); use NACL::C::_Mixins::Lun qw(:all); use NACL::CS::ComponentState::ZapiSkip qw(make_zapi_skip); use NACL::CS::ComponentState::ZapiArray qw(make_zapi_array); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'protocol', scalar => 'reservation_type_code', scalar => 'entry_type', scalar => 'third_party_initiator_name', scalar => 'isid', scalar => 'initiator_iqn', scalar => 'lun', scalar => 'qtree', scalar => 'vdisk_id', scalar => 'tpgroup_tag', scalar => 'third_party_port', scalar => 'reservation_key', scalar => 'offset', scalar => 'third_party_iqn', scalar => 'volume', scalar => 'vserver', scalar => 'initiator_port', scalar => 'path', scalar => 'target_wwpn', scalar => 'online', scalar => 'initiator_name', scalar => 'scsi_revision', scalar => 'mapped', scalar => 'aptpl', ]; my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); sub _check_non_iter { $Log->enter() if $may_enter; my ($pkg, @opts) = @_; $pkg->_base_check_non_iter( @opts, _primary_keys => [qw(lun qtree path offset volume vserver)], _vs_context => 1 ); $Log->exit() if $may_exit; } =head1 METHODS =head2 fetch my $LunPersistentReservation_state = NACL::CS::LunPersistentReservation->fetch(command_interface => $ci, ...); my @LunPersistentReservation_states = NACL::CS::LunPersistentReservation->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 CMode CLI/ZAPI. Invokes lun-get-persistent-reservation-info API for CMode ZAPI non-iter. =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 => 'lun persistent-reservation show', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', zapi_type => 'none', }, { method => '_fetch_cmode_zapi_non_iter', interface => 'ZAPI', set => 'CMode', zapi_type => 'non-iter', }, ], exception_text => 'No matching LunPersistentReservation(s) found', frontend => 'NACL::CS::LunPersistentReservation::fetch', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _update_state_objs_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->SUPER::_update_state_objs_cmode_zapi(@args, zapi_field_translations => {hyphenate_value => [qw(protocol scsi-revision)],},); $Log->exit() if $may_exit; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@args, api => 'lun_persistent_reservation_show',); $Log->exit() if $may_exit; return @state_objs; } sub _fetch_cmode_zapi_non_iter { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; $pkg->_construct_path(params => $opts{filter}); my @state_objs = $pkg->SUPER::_fetch_cmode_zapi_non_iter( %opts, copy => [ qw(lun qtree path reservation-type-code reservation-key volume vserver scsi-revision ) ], map => { 'isid' => ['iscsi-pr-nexus', make_zapi_skip('iscsi-pr-nexus'), 'isid',], 'initiator-port' => [ 'fcp-pr-nexus', make_zapi_skip('fcp-pr-nexus'), 'initiator-port', ], 'initiator-iqn' => [ 'iscsi-pr-nexus', make_zapi_skip('iscsi-pr-nexus'), 'initiator', ], 'tpgroup-tag' => [ 'iscsi-pr-nexus', make_zapi_skip('iscsi-pr-nexus'), 'tpgroup-tag', ], 'protocol' => 'reservation-type', 'third-party-port' => [ 'fcp-pr-nexus', make_zapi_skip('fcp-pr-nexus'), 'third-party-initiator-port', ], 'third-party-iqn' => [ 'iscsi-pr-nexus', make_zapi_skip('iscsi-pr-nexus'), 'third-party-initiator-name', ], 'target-wwpn' => [ 'fcp-pr-nexus', make_zapi_skip('fcp-pr-nexus'), 'target-port', ], }, api => "lun-get-persistent-reservation-info", vserver_operated_on => \my $vserver, primary_keys => [qw( lun volume qtree path offset )], ); $Log->exit() if $may_exit; return @state_objs; } sub _extra_filter_fields { $Log->enter() if $may_enter; $Log->exit() if $may_exit; return [qw( path vserver)]; } 1;