# # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary ResourceAgitation ComponentState Module ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::ResourceAgitation =head1 DESCRIPTION C is a derived class of L. It represents the current agitation levels for various resources. A related class L, which represents access to the resource agitation levels. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the ResourceAgitation element are the attributes of the ResourceAgitation ComponentState. =over =item C<< cpu_percentage_consumed >> Filled in for 7Mode CLI. =item C<< malloc_percentage_consumed >> Filled in for 7Mode CLI. =item C<< malloc_random_deny >> Filled in for 7Mode CLI. =item C<< random_sleep >> Filled in for 7Mode CLI. =item C<< sleep_time >> Filled in for 7Mode CLI. =item C<< mbuf_percentage_consumed >> Filled in for 7Mode CLI. =item C<< mbuf_random_deny >> Filled in for 7Mode CLI. =item C<< waflbuf_percentage_consumed >> Filled in for 7Mode CLI. =item C<< waflbuf_random_deny >> Filled in for 7Mode CLI. =item C<< fd_percentage_consumed >> Filled in for 7Mode CLI. =item C<< fd_random_deny >> Filled in for 7Mode CLI. =item C<< pBlk_percentage_consumed >> Filled in for 7Mode CLI. =item C<< pBlk_random_deny >> Filled in for 7Mode CLI. =item C<< raidrm_percentage_consumed >> Filled in for 7Mode CLI. =item C<< raidrm_random_deny >> Filled in for 7Mode CLI. =item C<< java_random_deny >> Filled in for 7Mode CLI. =item C<< random_garbage_collect >> Filled in for 7Mode CLI. =item C<< page_random_denies_reciprocal >> Filled in for 7Mode CLI. =item C<< hseg_random_denies_reciprocal >> Filled in for 7Mode CLI. =item C<< socket_random_denies_reciprocal >> Filled in for 7Mode CLI. =item C<< nwdrop_random_drop_reciprocal >> Filled in for 7Mode CLI. =item C<< nwcorrupt_random_corrupt >> Filled in for 7Mode CLI. =item C<< spinhicsm_random_deny >> Filled in for 7Mode CLI. =item C<< spinhimem_random_deny >> Filled in for 7Mode CLI. =item C<< nblhostrpc_random_deny >> Filled in for 7Mode CLI. =item C<< incl_rtags >> (Array) Filled in for 7Mode CLI. =item C<< excl_rtags >> Filled in for 7Mode CLI. =item C<< agitation >> Filled in for 7Mode CLI. Specifies whether resource agitation is active or not =back =cut package NACL::CS::ResourceAgitation; use strict; use warnings; use Params::Validate qw(validate); use NACL::ComponentUtils qw(_dump_one); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use Data::Dumper; use NACL::Exceptions::NoElementsFound qw(:try); use NACL::APISet::Exceptions::ResponseException qw(:try); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'cpu_percentage_consumed', scalar => 'malloc_percentage_consumed', scalar => 'malloc_random_deny', scalar => 'random_sleep', scalar => 'sleep_time', scalar => 'mbuf_percentage_consumed', scalar => 'mbuf_random_deny', scalar => 'waflbuf_percentage_consumed', scalar => 'waflbuf_random_deny', scalar => 'fd_percentage_consumed', scalar => 'fd_random_deny', scalar => 'pBlk_percentage_consumed', scalar => 'pBlk_random_deny', scalar => 'raidrm_percentage_consumed', scalar => 'raidrm_random_deny', scalar => 'java_random_deny', scalar => 'random_garbage_collect', scalar => 'page_random_deny', scalar => 'hseg_random_deny', scalar => 'socket_random_deny', scalar => 'nwdrop_random_drop', scalar => 'nwdrop_random_deny', scalar => 'nscorrupt_random_corrupt', scalar => 'nwcorrupt_random_corrupt', scalar => 'spinhicsm_random_deny', scalar => 'spinhimem_random_deny', scalar => 'nblhostrpc_random_deny', array => 'included_rtags', array => 'excluded_rtags', array => 'stats', scalar => 'agitation', scalar => 'waflbdata_random_deny', scalar => 'waflbdata_percentage_consumed', scalar => 'delay_max_usecs', scalar => 'delay_hz', scalar => 'delay_domain', ]; =head1 METHODS =head2 fetch my $ResourceAgitation_state = NACL::CS::ResourceAgitation->fetch(command_interface => $ci, ...); (Class method) Discovers which elements are present and returns their state in ComponentState objectsi. While this can be invoked in scalar or list context, like the 'fetch' for all other ComponentStates, this will always return only one ComponentState object. (returns an array with one element when invoked in list context). This is because ResourceAgitation is modeled per node/cluster. See L for a more detailed description along with a complete explanation of the options it accepts. Supports 7Mode CLI and Nodescope. =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_7mode_cli', interface => 'CLI', set => '7Mode|Nodescope', }, ], exception_text => 'No matching resource agitation(s) found' ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_7mode_cli { $Log->enter() if $may_enter; my $pkg = shift; my %opts = validate @_, $pkg->_fetch_backend_validate_spec(); my $apiset = $opts{apiset}; my ( $response, $output, $setral_state, $caught_exception ); try { $response = $apiset->setral( show => 1 ); $output = $response->get_parsed_output(); $setral_state = $output->[0]; } catch NACL::APISet::Exceptions::ResponseException with { $caught_exception = 1; }; if ($caught_exception) { $Log->exit() if $may_exit; return; } my @state_objs; my $obj = $pkg->new( command_interface => $opts{command_interface} ); $obj->_set_fields( row => $setral_state ); push @state_objs, $obj; $Log->exit() if $may_exit; return @state_objs; } 1;