#!/usr/software/bin/perl # $Id: //depot/prod/test/main/storage/hdd/NADQ_SEA/TEST_SCRIPTS/SSD/NADQ02_Durability_Test_Test.thpl#0 $ ## ## Copyright (c) 2005 Network Appliance, Inc. ## All rights reserved. ## ## @summary Mode ## Add SSD Durability test ## ## @description ## Verify that if a drive is power cycled while under heavy IO it can come back online in a reasonable time and tracks that it has gone through a power loss. ## ## @Test Mode ## File System Creation Mode ## ## @Test bed setup ## SSD :Dual Path Fabric ## SAS :Dual Path Fabric ## ## @usage ## The test can be run independently or with other tests as part of STEST. ## ## @dependencies ## There is no dependency ## ## @steps ## The test will execute steps mentioned below: ## 1. Create an aggregate with 7 spare disks and Create a flexible raid volume vol1 at 90% of aggregate created in Gbytes. ## 2. Check the df output. ## 3. Delete snapshot on the volume created. ## 4. Turn off the snap scheduler. ## 5. Collect the attributes from all the disk. ## 6. Use 3/4th of the volume created in Gigabytes - From the filer console start filersio commands for ever. ## 7. By issuing this command frequently, ensure that filersio is running. If not notify user. ## 8. Collect the attributes from all the disk. ## 9. Collect log page info for all the drives. ## 10. Collect log page info for all the drives. ## 11. Repeat the steps 8-10 per frequency (NDATE user input) specified by the user. ## 12. Ensure that all devices seen in disk_list and this count match. ## 13. Allow the test to continue (filersio command still active) for total number of days (length of test per NDATE user input) specified by user. STEP 18 must be repeated in the frequency per user input throughout the length of the test. ## 14. Stop filersio when the length of the test is reached. ## ## @param FILER - optional for cluster setup ## - required for Dual path setup Name of filer to be used ## @param FILERA - required for cluster setup ## - optional for Dual path setup Name of filer to be used ## @param FILERB - required for cluster setup ## - optional for Dual path setup Name of the partner node ## @param TEST_CONFIG - optional Type of the setup, C for cluster, D for dual path (default) ## @param TEST_SETUP - optional Default value set to 'SAS' ## @param FILER_CONN - optional Type of connection, default is set to 'console' for this test ## @param Mode - optional Filer mode maint/normal, default set to 'normal' for this test ## @param FILER_PROMPT - optional prompt of the filer ## @param LOGDIR - optional This is required to generate 'END-LOG'. Default set to main log directory. ## @param EOE - optional 'default' is set to default value ## @param BOOT_MODE - optional Boot mode for filer , default set to '1' for this test ## @param BOOT_TYPE - optional Boot type, default set to 'A' (automatic) for this test ## @param SSD - optional Setup is SSD or not, default set to 'no' ## @param EMAIL - optional. This will indicate if the user wants to recieve mails for FAIL scenarios ## @param MAIL_TO - The email ids of the receiving users ## @param MAIL_FROM - The email id from where the above email will be send. ## @param FILER_TYPE - This is used to differentiate between BR and IC filers ## ## @status Automated ## @auther abalaji@netapp.com ## @burt 845905 ## @change YY/MM/DD from auther: Description of the change ## ############################################################################# ######################################### ### Library functions ########################################## # Compiler directives. ######## Module imports ######### ##### Common Modules ##### use strict; # Module imports use TCD; use Storage::Common_Lib; use POSIX; use boot; use NATE::BaseException qw(:try); # Global parameters use vars qw( $FILER $TEST_CONFIG $TEST_SETUP $MODE $FILER_PROMPT $LOGDIR $EOE $TEST_WAIT_TIME $BOOT_MODE $BOOT_TYPE $SSD $EMAIL $MAIL_TO $MAIL_FROM $FILER_TYPE $Primary_Node $frequency_14_19 $total_no_day ); my $params = NATE::ParamSet->new( global => 1 ); $LOGDIR = $params->get( 'LOGDIR', default => '' ); $FILER = $params->get( 'FILER', default => '' ); $TEST_CONFIG = $params->get( 'TEST_CONFIG', default => 'D' ); $TEST_SETUP = $params->get( 'TEST_SETUP', default => 'SAS' ); $MODE = $params->get( 'MODE', default => 'normal' ); $FILER_PROMPT = $params->get( 'FILER_PROMPT', default => '\*>' ); $EOE = $params->get( 'EOE', default => 'default' ); $TEST_WAIT_TIME = $params->get( 'TEST_WAIT_TIME', default => '3' ); $BOOT_MODE = $params->get( 'BOOT_MODE', default => '1' ); $BOOT_TYPE = $params->get( 'BOOT_TYPE', default => 'A' ); $SSD = $params->get( 'SSD', default => 'no' ); $EMAIL = $params->get( 'EMAIL', default => 'y' ); $MAIL_TO = $params->get( 'MAIL_TO', default => 'Email to' ); $MAIL_FROM = $params->get( 'MAIL_FROM', default => 'Email from' ); $FILER_TYPE = $params->get( 'FILER_TYPE', default => 'filer type' ); $Primary_Node = $params->get( 'Primary_Node', default => 'N' ); $frequency_14_19 = $params->get( 'frequency_14_19', default => '1' ); $total_no_day = $params->get( 'total_no_day', default => '1' ); ################ # Testcase name ################ my $TC_name; $TC_name = "800_NADQ02_Durability_Test"; ##### CMode global variables ##### my @Nodes = (); my @Nodes_all = (); my %nodes_filer = (); ##### 7Mode global variables ##### my $filer; my $filer_con; my $filerip; my $bootfile; my $gateway; my @filers; my @hosts; my @filers_rsh; my $filer_con_rsh = ""; my $def_password; # Test case parameters my $Mode; my $Filer_names; my @spares; #Set test fail parameter to 0 my $test_status = 0; my $started_time = scalar( localtime() ); my $start_time_sec; my $end_time; logcomment ("DEBUG : $TC_name started : $started_time"); logcomment ("Frequency per day that the durability data needs to be collected (NDATE User Input) : $frequency_14_19"); logcomment ("Total number of days the durability test to continue running (NDATE User Input) : $total_no_day"); #Wait time calculation my $test_wait_time = 86400; #Default is 24 hours i.e 1 day logcomment("Default wait time is 24 HOURS"); if ( $TEST_WAIT_TIME == 1 ) { $test_wait_time = ( $test_wait_time / 10 ); my ( $sec, $min, $hour, $dy ) = gmtime($test_wait_time * $total_no_day); $dy -= 1; logcomment ("Total wait time is reduced to 10% i.e $dy DAYS $hour HOURS $min MINUTES $sec SECONDS as user selected the option -w = 1"); } elsif ( $TEST_WAIT_TIME == 2 ) { $test_wait_time = ( $test_wait_time / 2 ); my ( $sec, $min, $hour, $dy ) = gmtime($test_wait_time * $total_no_day); $dy -= 1; logcomment ("Total wait time is reduced to 50% i.e $dy DAYS $hour HOURS $min MINUTES $sec SECONDS as user selected the option -w = 2"); } elsif ( $TEST_WAIT_TIME == 4 ) { $test_wait_time = ( $test_wait_time * .95 ); my ( $sec, $min, $hour, $dy ) = gmtime($test_wait_time * $total_no_day); $dy -= 1; logcomment ("Total wait time is reduced to 95% i.e $dy DAYS $hour HOURS $min MINUTES $sec SECONDS as user selected the option -w = 4"); } $start_time_sec = convertTime(time_val => $started_time); $end_time = $start_time_sec + ($test_wait_time); ###These vars need to be modified my %Fil_aggr_disk = (); my $Filer_con = ""; my $Host = ""; my $filer_names; my ( $email_subject, $email_body ); ######################################## # Testcase available for execution ######################################### ## Pre-test processes ######################################### my @Testcases = ( Durability_Test => "SSD_Durability Cmode" ); &main(); sub main { # Debug break point $DB::single = 2; # Create Test Case Driver object $Test = new TCD( -testcases => [@Testcases] ); if ( $Test->error ) { $Test->log( $Test->errmsg ); $test_status = 1; $email_subject = "$TC_name : Test FAILED: FAIL"; $email_body = "Failed to instantiate Test object.\nLog Location : $LOGDIR\n"; send_message( mail_subject => $email_subject, mail_body => $email_body, MAIL_FROM => $MAIL_FROM, MAIL_TO => $MAIL_TO, EOE => $EOE, EMAIL => $EMAIL ); return $TCD::FAIL; } # Performs method callbacks $Test->run_test(); if ( $Test->error ) { $Test->log( $Test->errmsg ); return $TCD::FAIL; } exit(0); } ## end sub main ########## INIT ################################################### # init automatically called before executing tests #################################################################### sub init() { $Test->description(" Initialising all required variables and FILER connections "); $filer_names = $Test->get_param("FILER"); # Capturing Filer names from the param(Test_Suite) ##Check for duplicate node object and push unique node object in Nodes array. my @temp_nodes = NACL::C::Node->find(); # Find Nodes/Filers used in the test, Based on FILER param. foreach my $Node (@temp_nodes) { my $FILER_C = $Node->name(); $nodes_filer{$FILER_C} = [$Node]; } @Nodes = map { @{$_} } grep { (/\S/) } values(%nodes_filer); # Contains Node objects used for test execution grep { logcomment( "Filers passed to the ntest are " . $_->name() ) } @Nodes; logcomment("Changing state to CLI MODE"); my @subtests; foreach my $node (@Nodes) { my $filer_name = $node->name(); push( @subtests, subtest( \&boot_filer_in_req_state, -runid, "boot_filer_in_req_state_" . "$filer_name", -bg, "--", Test => $Test, filer_name => $filer_name, change_state_to => 'CLI', ) ); } Subtest::wait_finish( subtest => [@subtests] ); $Mode = $Nodes[0]->mode(); version_test( node_present => \@Nodes, tc_name => $TC_name ); logcomment("Checking for execution mode"); logcomment( "FILER- $filer_names : $TC_name : started, expected max completion time 12 hours : " . scalar( localtime() ) ); logcomment( "FILER- $filer_names : Log file for this test case: \n $LOGDIR/$TC_name" . ".log " . scalar( localtime() ) ); return $TCD::PASS; } ########## SETUP ################################################### # Setup automatically called before executing tests ################################################################################### sub setup() { $Test->description( "Setup the environment for the test exectuion "); logcomment("Mode of filer $filer_names : $Mode"); my $node_ref = \@Nodes; foreach my $Node(@Nodes){ my @spares; my $no_create = 0; my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); my $result = $Api_Set_Obj->execute_command( 'command' => 'version' ); if($result !~ /<1>/){ logcomment("**FATAL**:$FILER_C : Test will run only on the non-debug kernel"); logresult( 'FATAL', "$FILER_C : Test will run only on the non-debug kernel"); } #Spare disk count check my $required_spare = 9; my @non_root_aggr; logcomment("$FILER_C : Checking availability of spare disk on node"); logcomment("$FILER_C : Required no. of spare disks is $required_spare (7 spare disks for aggregate creation, 2 for potential error handling)"); my $spare_cnt = spare_count_cmode( Node => $Node, run_local => 'YES',required_spare => $required_spare ); #check for and deleting the additional non root aggregate if ($spare_cnt < $required_spare){ logcomment("$FILER_C : Available no. of spare drives is $spare_cnt which is less than the required spare $required_spare (7 spare disks for aggregate creation, 2 for potential error handling)"); logcomment("$FILER_C : Checking for existence of non-root aggregate to create spare disks"); try { my @aggregates=NACL::C::Aggregate->find( command_interface => $Node, filter => {nodes => [$FILER_C]}, canned_filters => [ qw(not-root) ] ); my $disk_count = 0; foreach my $aggr (@aggregates) { my $aggr_name = $aggr->get_one_state_attribute('aggregate'); $disk_count += $aggr->get_one_state_attribute('diskcount'); logcomment("**DEBUG** : aggregate with $disk_count disks is $aggr_name"); my $vol = $aggr->get_one_state_attribute('volcount'); push(@non_root_aggr,$aggr_name); #push(@non_root_aggr_obj,$aggr); } logcomment("$FILER_C : Non root aggregates are @non_root_aggr and the no. of disks are $disk_count disks"); $no_create = 1; }catch NACL::Exceptions::NoElementsFound with { logcomment("**FATAL** : $FILER_C : NON-ROOT ARE NOT FOUND TO CREATE SPARE DISKS. ALSO THE AVAILABLE SPARE DISKS COUNT IS LESS THAN THE REQUIRED SPARE DISKS $required_spare. EXITING THE EXECUTION"); logresult('FATAL' ,"$FILER_C : NON-ROOT ARE NOT FOUND TO CREATE SPARE DISKS. ALSO THE AVAILABLE SPARE DISKS COUNT IS LESS THAN THE REQUIRED SPARE DISKS $required_spare. EXITING THE EXECUTION"); }; #Deleting non root aggregates if ($no_create == 1){ aggregate_volume_delete(Node =>$Node,Aggr_array =>[@non_root_aggr]); #Check for spares my $spare_cnt = spare_count_cmode( Node => $Node, waiting => "wait", run_local => 'YES', required_spare => $required_spare ); if($spare_cnt < $required_spare){ logcomment("**FATAL**: $FILER_C - No. of spare disks available are not sufficient to create aggregate"); logresult('FATAL' , "$FILER_C - No. of spare disks available are not sufficient to create aggregate"); } } } my %hash = (filter => {'container-type' => "spare",'owner' => $FILER_C}); my @broken_obj = NACL::C::Disk->find( command_interface => $Node, %hash, ); foreach my $state_obj (@broken_obj){ my $free_disk = $state_obj->disk(); push( @spares,$free_disk); } logcomment ("$FILER_C : Total number of drives present in the system are " . scalar @spares . " and the drives are : @spares"); @spares = @spares[0..6]; $Fil_aggr_disk{$FILER_C} = [@spares]; logcomment ("$FILER_C : 7 Spares Disks are : @spares"); } ##################################################################### # Pre test proces : call for pre_n_post test process ##################################################################### execute_pre_test( node_present => $node_ref, Test => $Test, change_state_to => "CLI", filer_mode => $Mode, LOGDIR => $LOGDIR, BOOT_TYPE => $BOOT_TYPE, test_setup => $TEST_SETUP, ); #Setting RAID options foreach my $Node(@Nodes){ my $FILER_C = $Node->name(); logcomment("$FILER_C : Setting the raid options"); NACL::C::Options->option( command_interface => $Node, 'option-name' => 'raid.media_scrub.enable', 'option-value' => 'on' ); NACL::C::Options->option( command_interface => $Node, 'option-name' => 'raid.media_scrub.spares.enable', 'option-value' => 'on' ); NACL::C::Options->option( command_interface => $Node, 'option-name' => 'raid.scrub.enable', 'option-value' => 'off' ); } return $TCD::PASS; } ## end sub setup() ############################################## ## NADQ02 SSD Durability Test ############################################## sub Durability_Test { my @subtests; logcomment( "Number of nodes are " . scalar @Nodes . " and the filers are $filer_names" ); foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); push( @subtests, subtest( \&Durability_Test_sub, -runid, "Durability_Test_$FILER_C", -bg, "--", $Node ) ); } Subtest::wait_finish( subtest => [@subtests] ); my $return = status_return( subtest_ref => [@subtests] ); if ( $return == 0 ) { return $TCD::PASS; } else { return $TCD::FAIL; } } ############################## ##Subtest_Create ############################## sub Durability_Test_sub { $Test->description(" Durability_Test "); logcomment("Starting execution of test steps. Total steps to be executed as part of the script is: 17"); my @Nodes; push( @Nodes, shift(@_) ); my $vol_size_KB; my $volsize_before; my @temp_disk_info; my $numberofvols = 1; my $numraidgroups = 1; my $bootmode = "4"; my $netmask = "255.255.0.0"; my $disk_max_sup = 40; my ( $disk_show_output, $driveA, $driveB ); my @disk_arr_driveA; my @disk_arr_driveB; my $FILER_C; my $aggregate_name; my $vserver_name; my $volume_name; my $vol_size; my @drives_step5; my $cur_time = 0; #------------------------------------------------------------------------------ ## STEP 1 - Create an aggregate with 7 disks and Create a ## flexible raid volume vol1 at 90% of aggregate created in Gbytes. ## Pass/Fail criteria:N/A #------------------------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 1 of 14: $FILER_C : Create an aggregate with 7 disks and Create a flexible raid volume vol1 at 90% of aggregate created in Gbytes", ); my @SSD_drive = @{$Fil_aggr_disk{$FILER_C}}; $aggregate_name = "aggr1_SSD_Dur_"."$FILER_C"; $aggregate_name =~s/\-/_/g if($aggregate_name =~ /\-/); logcomment ("$FILER_C : Creating aggregate $aggregate_name... "); try{ my $job; my $stask_aggr_obj = NACL::STask::Aggregate->create(command_interface => $Node, aggregate => $aggregate_name, if_exists => "reuse", job_component => \$job, disklist => \@SSD_drive, ); }catch NACL::APISet::Exceptions::CommandFailedException with { logcomment("**FATAL**: $FILER_C : Cannot create $aggregate_name."); return logresult( "INFO", msg => 1); } #Volume size calculation my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); my $output = $Api_Set_Obj->execute_raw_command( 'command' => "aggr show $aggregate_name -fields availsize" ); foreach my $line ( split( /\n/, $output )){ if ( $line =~ /^$aggregate_name\s+(\S+)[GT]B/i ){ $vol_size = $1; $vol_size = $vol_size*1024 if ($line =~ /^$aggregate_name\s+(\S+)TB/i); my ($val) = readable_disk_size (GB => $vol_size); logcomment ("$FILER_C : Aggregate Size --> $val"); $vol_size = $vol_size * 0.90; $vol_size = floor($vol_size); ($val) = readable_disk_size (GB => $vol_size); logcomment ("$FILER_C : Volume Size to be created --> $val"); } } $vserver_name = "vser_SSD_Dur_"."$FILER_C"; $vserver_name =~ s/\-/_/g if($vserver_name =~ /\-/); logcomment ("$FILER_C : Creating vserver $vserver_name"); my $root = "vol0"; my $ns = "file"; my $sec = "unix"; my $vserver_obj = NACL::STask::Vserver->create(command_interface => $Node, vserver => $vserver_name, nacltask_if_exists => 'reuse', rootvolume => $root, aggregate => $aggregate_name, "ns-switch" => $ns, "rootvolume-security-style" => $sec ); try { my $vol_size_90 = "$vol_size"."GB"; $volume_name = "vol1_SSD_Dur_"."$FILER_C"; $volume_name =~ s/\-/_/g if($volume_name =~ /\-/); my $stask_vol = NACL::STask::Volume->create( command_interface => $Node, vserver => $vserver_name, volume => $volume_name, aggregate => $aggregate_name, if_exists => "reuse", size => $vol_size_90 ); }catch NACL::APISet::Exceptions::CommandFailedException with { logcomment ("**FATAL** : $FILER_C : Cannot create volume $volume_name on aggregate $aggregate_name"); return logresult( "INFO", msg => 1); }; } #------------------------------------------------------------ ## STEP 2 - Check the df output. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 2 of 14 : $FILER_C : Check the df output", ); { my $raw_output = $Api_Set_Obj->execute_command( 'command' => 'df' ); foreach my $line ( split( /\n/, $raw_output ) ) { if ( $line =~ /^\/vol\/$volume_name\/\s+(\d+)\s+(\d+)/ ) { $volsize_before = sprintf( "%.0f", $2 ); $vol_size_KB = sprintf( "%.0f", $1 * .95 ); $vol_size_KB = "$vol_size_KB" . "k"; } } } sleep(120); logcomment("df output recorded"); logcomment("Vol size used before creating the file : $volsize_before"); } #------------------------------------------------------------ ## STEP 3 - Turn off the snap scheduler. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 3 of 14 : $FILER_C : Turn off the snap scheduler", ); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); $Api_Set_Obj->execute_raw_command( 'command' => "volume snapshot policy modify-schedule -policy default -schedule daily -newcount 0" ); $Api_Set_Obj->execute_raw_command( 'command' => "volume snapshot policy modify-schedule -policy default -schedule weekly -newcount 0" ); $Api_Set_Obj->execute_raw_command( 'command' => "volume snapshot policy modify-schedule -policy default -schedule hourly -newcount 0" ); } #------------------------------------------------------------ ## STEP 4 - Delete snapshot on the volume created. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 4 of 14 : $FILER_C : Delete snapshot on the volume created", ); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); $Api_Set_Obj->execute_raw_command( 'command' => 'run local' ); $Api_Set_Obj->execute_raw_command( 'command' => 'priv set -q test' ); $Api_Set_Obj->execute_raw_command( 'command' => 'snap list' ); my $prompts_answers = [ "Are you sure you want to" => 'y' ]; $Api_Set_Obj->execute_raw_command( 'command' => "snap delete -a $volume_name", 'connectrec-match_table' => $prompts_answers ); $Api_Set_Obj->execute_raw_command( 'command' => 'exit' ); } #------------------------------------------------------------ ## STEP 5 - Collect the attributes from all the disk. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 5 of 14 : $FILER_C : Collect the attributes from all the disk", ); my $output = storage_show_disk_a_data(Node=>$Node); my @drives = keys $output; foreach my $drive (@drives){ push @drives_step5 , $drive if ($drive =~ /\w+\.\S+/) } logcomment ("$FILER_C : Initial number of drives : ".scalar @drives_step5); } #------------------------------------------------------------ ## STEP 6 - Use 3/4th of the volume created in Gigabytes ## - From the filer console start filersio commands for ever ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 6 of 14 : $FILER_C : Use 3/4th of the volume created in Gigabytes - From the filer console start filersio commands for ever", ); $vol_size = $vol_size * 0.75; $vol_size = int($vol_size); $vol_size = $vol_size * 1024 * 1024 * 2 ; $Api_Set_Obj->execute_command( 'command' => "filersio asyncio_active 0 -r 100 4096 0 $vol_size -1 16 /vol/$volume_name/f1 -create" ); $Api_Set_Obj->execute_command( 'command' => "filersio asyncio_active 0 -r 100 4096 0 $vol_size -1 16 /vol/$volume_name/f2 -create" ); $Api_Set_Obj->execute_command( 'command' => "filersio asyncio_active 80 -r 40 4096 0 $vol_size -1 16 /vol/$volume_name/f3 -create" ); } sleep (30); #--------------------------------------------------------------------------------------------------- ## STEP 7 - By issuing this command frequently, ensure that filersio is running. If not notify user. ## Pass/Fail criteria:N/A #--------------------------------------------------------------------------------------------------- foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 7 of 14 : $FILER_C : By issuing this command frequently, ensure that filersio is running. If not notify user", ); my $instance_flag = 0; do { my $raw_output = $Api_Set_Obj->execute_command( 'command' => "filersio status" ); if ( $raw_output =~ /no instances currently running/ ) { $instance_flag = $instance_flag + 1; logcomment( "**FATAL**: filersio is not running." ); return logresult( "INFO", msg => 1); } elsif ( $raw_output =~ /running/ ) { $instance_flag = $instance_flag + 1; } } while ( $instance_flag != 1 ); } my $i = 0; for ( $i = 0 ; $i < $total_no_day ; $i++ ) { my $day = $i+1; my @drives_step8; my @drives_step12; my $FILER_C = $Nodes[0]->name(); logcomment ("$FILER_C : Execution starts for the day $day. Total no. of days user requested to run the test : $total_no_day"); for ( my $j = 1 ; $j <= $frequency_14_19 ; $j++ ) { logcomment ("$FILER_C : Iteration $j of $frequency_14_19 for the day $day"); #------------------------------------------------------------ ## STEP 8 - Collect the attributes from all the disk. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my @drives_s8; my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 8 of 14 : $FILER_C - Collect the attributes from all the disk", ); my $output = storage_show_disk_a_data(Node=>$Node); my @drives = keys $output; foreach my $drive (@drives){ push @drives_s8 , $drive if ($drive =~ /\w+\.\S+/) } logcomment ("$FILER_C : Number of drives during the frequency of execution : ".scalar @drives_s8); @drives_step8 = @drives_s8; } #------------------------------------------------------------ ## STEP 9 - collect log page info for all the drives. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 9 of 14 : $FILER_C - collect log page info for all the drives", ); my $disk_values = disk_show_drive_maint( API_Obj => $Api_Set_Obj, Filer => $FILER_C ); @temp_disk_info = @{ $disk_values->{'driveA'} }; logcomment("DEBUG : temp_disk_info = @temp_disk_info"); foreach my $disk (@temp_disk_info) { $Api_Set_Obj->execute_command('command' => "scsi logsense -p 0x2f $disk" ); } } #------------------------------------------------------------ ## STEP 10 - collect log page info for all the drives. ## Pass/Fail criteria:N/A #------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); eye_catcher(Test => $Test, string => "STEP 10 of 14 : $FILER_C - collect log page info for all the drives", ); foreach my $disk (@temp_disk_info) { $Api_Set_Obj->execute_command('command' => "scsi logsense -p 0x33 -s 0x09 $disk" ); $Api_Set_Obj->execute_command('command' => "scsi logsense -p 0x19 $disk" ); } } logcomment ("$FILER_C : Iteration $j of $frequency_14_19 for the day $day ends"); #----------------------------------------------------------------------------------------- ## STEP 11 - Repeat the steps 8-10 per frequency (NDATE user input) specified by the user ## Pass/Fail criteria: N/A #----------------------------------------------------------------------------------------- foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 11 of 14 : $FILER_C - Repeat the steps 8-10 per frequency (NDATE user input) specified by the user", ); } } ## end for ( my $j=1 ; $j<=$frequency_14_19 ; $j++ ) logcomment("$FILER_C : All $frequency_14_19 iterations are complete. Proceeding with further steps"); #----------------------------------------------------------------------------------------- ## STEP 12 - Ensure that all the devices seen in disk_list and this count match. ## Pass/Fail criteria: N/A #----------------------------------------------------------------------------------------- foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 12 of 14 : $FILER_C - Ensure that all devices seen in disk_list and this count match", ); my $output = storage_show_disk_a_data(Node=>$Node); my @drives = keys $output; foreach my $drive (@drives){ push @drives_step12 , $drive if ($drive =~ /\w+\.\S+/) } logcomment ("$FILER_C : Number of drives post the specified frequency of execution : ".scalar @drives_step12); if (scalar @drives_step8 == scalar @drives_step12){ logcomment ("$FILER_C : Drive count during and post the specified frequency of execution matches"); } else{ logcomment ("$FILER_C : Drive count does not matches"); } } while ($cur_time != $end_time){ $cur_time = scalar (localtime()); my $cur_time_sec = convertTime(time_val => $cur_time); if ($cur_time_sec >= $end_time){ last; } } #------------------------------------------------------------------------------------------------------------------------------------ ## STEP 13 - Allow the test to continue (filersio command still active) for total number of days (length of test per NDATE user input) ## specified by user. STEP 11 must be repeated in the frequency per user input throughout the length of the test. ## Pass/Fail criteria: N/A #------------------------------------------------------------------------------------------------------------------------------------ foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 13 of 14: $FILER_C - Allow the test to continue (filersio command still active) for total number of days (length of test per NDATE user input) specified by user. STEP 11 must be repeated in the frequency per user input throughout the length of the test.", ); logcomment ("$FILER_C : Execution for the day $day of $total_no_day ends"); } } ## end for ( my $i=0 ; $i<=$total_no_day ; $i++ ) logcomment("START TIME :$started_time END TIME :$cur_time"); #----------------------------------------------------------------- ## STEP 14:- Stop filersio when the length of the test is reached. ## Pass/Fail criteria: N/A #----------------------------------------------------------------- foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher(Test => $Test, string => "STEP 14 of 14 : $FILER_C - Stop filersio when the length of the test is reached", ); my $Api_Set_Obj = $Node->get_7m_or_nodescope_apiset(); $Api_Set_Obj->execute_command('command' => "priv set -q test;filersio stop" ); logcomment("DEBUG:filersio stop command is completed"); } return $TCD::PASS; } ######################################################### ## Test stops here. Call pre_n_post_test_process routine ## after END_LOG files ######################################################### ##################################################################### # Cleanup - Post Process ##################################################################### sub cleanup() { logcomment("$Filer_names - Clean up and post test process"); my $node_ref = \@Nodes; foreach my $Node (@Nodes) { my $FILER_C = $Node->name; logcomment("Deleting the non root aggregate created with 7 disks for this test"); my @aggrs_obj; my @non_root_aggr; @aggrs_obj = NACL::C::Aggregate->find( command_interface => $Node, filter => {nodes => [$FILER_C],'root' => 'false'}); foreach my $aggr (@aggrs_obj) { my $name = $aggr->get_one_state_attribute('aggregate'); if ($name =~ /aggr1_SSD_Dur_/) { logcomment("Deleting aggregate $name"); my @aggr_to_del; push (@aggr_to_del, $name); aggregate_volume_delete(Node => $Node, Aggr_array => [@aggr_to_del]); } } vserver_delete(Node =>$Node); } ########################################################################################### ## Post Test process - Category : "post_test" ########################################################################################### execute_post_test( node_present => $node_ref, Test => $Test, change_state_to => "CLI", filer_mode => $Mode, BOOT_TYPE => $BOOT_TYPE, LOGDIR => $LOGDIR, test_setup => $TEST_SETUP, ); return $TCD::PASS; }