# $Id: //depot/prod/test/nacldev/lib/NACL/C/LunAlignment.pm# $ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary LunAlignment ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::LunAlignment =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP LunAlignment. A related class is L, which represents access to an ONTAP LunAlignment. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the LunAlignment element are the attributes of the LunAlignment 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<< bin_number >> (array) Filled in for CMode CLI/ZAPI. Maps to : CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< lun >> LUN Name Filled in for CMode CLI/ZAPI. Input Mapping: These inputs will be filled in from path. =item C<< ostype >> *OS Type, possible value(s) are vmware,hyper_v,windows_2008,windows_gpt,windows,linux,xen,solaris,solaris_efi,hpux,aix,netware,openvms Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: $value =item C<< read_histogram >> *Read Alignment Histogram (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $read_histogram = $obj->read_histogram(); # $read_histogram contains a reference to the array of values my @read_histogram = $obj->read_histogram(); # @read_histogram contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { read_histogram = [ value1, value2...] } Filled in for CMode CLI/ZAPI. Maps to : CMode ZAPI: For "filter", "requested_fields" and Output mapping: @values =item C<< qtree >> Qtree Name Filled in for CMode CLI/ZAPI. Output Mapping: These inputs will be filled in from path. =item C<< alignment >> *Alignment, possible value(s) are aligned,misaligned,indeterminate Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< write_partial >> *Write Partial Blocks Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< volume >> Volume Name Filled in for CMode CLI/ZAPI. Output Mapping: These inputs will be filled in from path. =item C<< vserver >> Vserver Name Filled in for CMode CLI/ZAPI. For "filter", "requested_fields" and Output mapping: $value =item C<< path >> LUN Path Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< read_partial >> *Read Partial Blocks Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< partition_scheme >> *Partition Scheme, possible value(s) are mbr,gpt,unknown Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< partition_count >> *Partitions Count Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For "filter", "requested_fields" and Output mapping: $value =item C<< partition_type >> *Partition Type (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $partition_type = $obj->partition_type(); # $partition_type contains a reference to the array of values my @partition_type = $obj->partition_type(); # @partition_type contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { partition_type = [ value1, value2...] } Filled in for CMode CLI/ZAPI Maps to : CMode ZAPI: For "filter", "requested_fields" and Output mapping: @values =item C<< write_histogram >> *Write Alignment Histogram (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $write_histogram = $obj->write_histogram(); # $write_histogram contains a reference to the array of values my @write_histogram = $obj->write_histogram(); # @write_histogram contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { write_histogram = [ value1, value2...] } Filled in for CMode CLI/ZAPI. Maps to : CMode ZAPI: For "filter", "requested_fields" and Output mapping: @values =item C<< partition_offset >> *Partition start offset (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $partition_offset = $obj->partition_offset(); # $partition_offset contains a reference to the array of values my @partition_offset = $obj->partition_offset(); # @partition_offset contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { partition_offset = [ value1, value2...] } Filled in for CMode CLI/ZAPI Maps to : CMode ZAPI: For "filter", "requested_fields" and Output mapping: @values =back =cut package NACL::CS::LunAlignment; 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::C::_Mixins::Lun qw(:all); use NACL::Exceptions::NoElementsFound qw(:try); 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 [ array => 'bin_number', scalar => [ { '-default_ctor' => sub { if (defined $_[0]->path()) { return $_[0] ->_extract_lun_from_path(path => $_[0]->path()); } }, }, 'lun' ], scalar => 'ostype', array => 'read_histogram', scalar => [ { '-default_ctor' => sub { if (defined $_[0]->path()) { return $_[0] ->_extract_qtree_from_path(path => $_[0]->path()); } }, }, 'qtree' ], scalar => 'alignment', scalar => 'write_partial', scalar => [ { '-default_ctor' => sub { if (defined $_[0]->path()) { return $_[0] ->_extract_volume_from_path(path => $_[0]->path()); } }, }, 'volume' ], scalar => 'vserver', scalar => 'path', scalar => 'read_partial', scalar => 'partition_scheme', scalar => 'partition_count', array => 'partition_type', array => 'write_histogram', array => 'partition_offset', ]; =head1 METHODS =head2 fetch my $LunAlignment_state = NACL::CS::LunAlignment->fetch(command_interface => $ci, ...); my @LunAlignment_states = NACL::CS::LunAlignment->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. Invokes "lun-alignment-get-iter" of 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( @_, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode' } ], exception_text => 'No matching lun alignment(s) found', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@_, api => 'lun_alignment_show',); $Log->exit() if $may_exit; return @state_objs; } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my %filter = %{$opts{filter}}; if (%filter) { try { $pkg->_construct_path(params => \%filter); } otherwise { #Couldn't counstruct the path }; } my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( %opts, copy => [qw ( alignment partition-scheme partition-count path vserver )], map => { 'ostype' => 'multiprotocol-type', 'read-partial' => 'read-partial-blocks', "partition-type" => [ make_zapi_array('partition-table'), make_zapi_skip('partition-list-entry'), 'partition-type', ], "partition-offset" => [ make_zapi_array('partition-table'), make_zapi_skip('partition-list-entry'), 'partition-offset', ], "bin-number" => [ make_zapi_array('write-alignment-histogram'), make_zapi_skip('write-histogram-entry'), 'bin-number', ], 'write-histogram' => [ make_zapi_array('write-alignment-histogram'), make_zapi_skip('write-histogram-entry'), 'bin-value', ], 'read-histogram' => [ make_zapi_array('read-alignment-histogram'), make_zapi_skip('read-histogram-entry'), 'bin-value', ], 'write-partial' => 'write-partial-blocks', }, api => 'lun_alignment_get_iter', ); $Log->exit() if $may_exit; return @state_objs; } 1;