#!/usr/software/bin/perl # $Id: //depot/prod/test/main/storage/hdd/NADQ_SEA/TEST_SCRIPTS/FC/NADQ02_FC_Perf_DskQul.thpl#13 $ # Copyright (c) 2005 Network Appliance, Inc. # All rights reserved # ## @summary Mode ## Basic Drive Performance: disk_qual ## ## @description ## Determine the basic drive performance using disk_qual as a measurement tool. ## ## ## hardware configuration ## Connect the filer to only one shelf with 14 Drives of each capacity in family. ## ## @Test Mode ## Maintenance mode ## ## @Test bed setup ## FC :Dual Path ## SATA :Dual Path ## SAS :Dual Path ## ## @usage ## The test can be run independently or with other tests as part of STEST. ## ## @dependencies ## None ## ## @steps ## The test will execute steps mentioned below: ## 1. Record version of Kernel used in test ## 2. List of all drives on all loop(s). Verify the physical count. ## 3. Record the FC link statistics/sasadmin dev_stats for all adapters and drives. ## 4. Record the FC_AL link statistics/storage show statistics. ## 5. Record the fcadmin device_map/sasadmin expander_map statistics. ## 6. Select a single drive ID, or a shelf ID.Run list of Performance Test Scripts. ## 7. Start execution of the performance script on HDD. ## 8. Allow script to complete. ## 9. Record the test results summary from each drive. ## 10. REPEAT Process for each test script in the list. ## ## ## @param FILER - optional for cluster setup ## - required for Dual path setup Name of filer to be used ## @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 'FC' ## @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 'maint' 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 '5' 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 ## @author arunak@netapp.com ## @burt ## @change YY/MM/DD from auther: Description of the change ## ############################################################################# ######################################### ### Library functions ########################################## use Storage::Common_Lib; use Storage::NVMe_Common_Lib; use Storage::DiskUtils qw(get_disk_wwn); use Storage::SASUtils qw(disable_dbg_msgs); ######################################### ### Initialization/declaration ######################################### # Global parameters use vars qw( $FILER $MODE $TEST_CONFIG $TEST_SETUP $FILER_PROMPT $LOGDIR $EOE $TEST_WAIT_TIME $BOOT_MODE $BOOT_TYPE $SSD $EMAIL $MAIL_TO $MAIL_FROM $FILER_TYPE $TEST_DRIVES $DRIVE_ID $DRIVE_ID_B ); 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 => 'FC' ); $MODE = $params->get( 'MODE', default => 'maint' ); $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 => '5' ); $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' ); $TEST_DRIVES = $params->get( 'TEST_DRIVES', default => 'single' ); $DRIVE_ID = $params->get( 'DRIVE_ID', default => '' ); $DRIVE_ID_B = $params->get( 'DRIVE_IDB', default => '' ); # 7Mode Global Variables my $host; my $hostB; my $filer; my $filerB; my $filer_con; my $filer_conB; my $filerip; my $fileripB; my $bootfile; my $bootfileB; my @filers; my @hosts; my $def_password; my $logname; # CMode Global Variables my $test_status = 0; my %nodes_filer = (); my %FILER_API = (); my %FILER_DISK = (); my %FILER_DISK_USED_ALL = (); my %FILER_DISK_USED_1 = (); my $Filer_names; my $test_drv_details = {}; my @FILER_ARR; my @Nodes; my $Mode; my $Host; my $node_ref; my @API_ARRAY; my @Nodes_all; my ( $disk_list_s2, @disk_array_s2 ); my ( $temp_ref, $temp_array ); my $TIME_OUT_20 = 1200; my $log_serial; logcomment("TEST CONFIG - $TEST_CONFIG"); my ( $email_subject, $email_body ); my $TC_name = "301_NADQ02_NVMe_Disk_Qual_BDP"; # Testcase available for execution my @Testcases = ( Disk_Qual_BDP => "Basic Drive Performance: disk_qual - Maintenance mode" ); ######################################### ## Pre-test processes ######################################### &main(); sub main { # Debug break point $DB::single = 2; # Create Test Case Driver object $Test = new TCD( -testcases => [@Testcases] ); if ( $Test->error ) { $Test->nlog( $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->nlog( $Test->errmsg ); return $TCD::FAIL; } exit(0); } ## end sub main ########## INIT ################################################### # This init subroutine will initialise the filer. #################################################################### sub init() { $Test->description(" Initialising all required variables and FILER connections "); logcomment("User selected Drive IDs to run the test : $DRIVE_ID and $DRIVE_ID_B"); $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; sort(@Nodes); $Mode = $Nodes[0]->mode(); return $TCD::PASS; } ## end sub init() ########## 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"); version_test( node_present => \@Nodes, tc_name => $TC_name ); my $node_ref = \@Nodes; ##################################################################### # Pre test proces : call for pre_n_post test process ##################################################################### nvme_pre_test( node_present => $node_ref, Test => $Test, change_state_to => "MAINT", filer_mode => $Mode ); ############################################################### #Creating API object and getting disk information ############################################################### foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); logcomment(" Creating API object for filer - $FILER_C"); my $Host = host($FILER_C); my $API_obj = NACL::APISet->new( hostobj => $Host, category => "Node", interface => "CLI", set => "Maintenance" ); push( @API_ARRAY, $API_obj ); $FILER_API{$FILER_C} = $API_obj; } ############################################## ### checking for serial number of the drive selected ############################################## { my $Node = $Nodes[0]; my $FILER_C = $Node->name(); my $FILERA = $Nodes[0]->name(); my $FILERB = $Nodes[1]->name(); my $API_OBJ = $FILER_API{$FILER_C}; my $API_OBJA = $FILER_API{$FILERA}; my $API_OBJB = $FILER_API{$FILERB}; my $Api_obj; my $target; my $serno_exists = 0; my $all_dvr_list; if ( "$TEST_DRIVES" eq "all" ) { $drive = "all"; logcomment("As user selected 'ALL' option, disk_qual will run on all drives"); $logname = "mt"; logcomment("FILER ::: $FILER_C and DRIVE : $drive"); $test_drv_details->{$FILER_C}->{'TST_DRV'} = $drive; } else { $logname = "1t"; logcomment("Checking for the ownership of the drive selected by user with serial number : $DRIVE_ID and $DRIVE_ID_B"); $all_dvr_list = disk_show_v( Node => $Node ); logcomment("Check for Filer - $FILERA"); foreach my $disk ( keys %$all_dvr_list ) { my $owner = $all_dvr_list->{$disk}->{'OWNER'}; my $serial = $all_dvr_list->{$disk}->{'SERIAL'}; if ( ( $serial =~ /^$DRIVE_ID$/ ) || ( $serial =~ /^$DRIVE_ID_B$/ ) ) { logcomment("Drive Found - $disk - $serial belongs to $owner"); $test_drv_details->{$owner} = { 'filer_name' => $owner }; $test_drv_details->{$owner}->{'TST_DRV'} = $disk; $test_drv_details->{$owner}->{'SRLNO'} = $serial; $test_drv_details->{$owner}->{'API_OBJ'} = $FILER_API{$owner}; logcomment("Add filer $owner to $serial and Drive $disk "); } } logcomment("Get all captured details "); foreach my $fil ( keys %$test_drv_details ) { my $drv = $test_drv_details->{$fil}->{'TST_DRV'}; my $ser = $test_drv_details->{$fil}->{'SRLNO'}; my $API = $test_drv_details->{$fil}->{'API_OBJ'}; logcomment("ASH DETAL- $drv - $ser - $fil - $API"); } my @fil_with_srl = keys %$test_drv_details; my $sz = @fil_with_srl; logcomment("**DEBUG** : @fil_with_srl"); if ( $sz == 2 ) { logcomment("Both filer has serial numbers "); } else { logcomment("Filer doesnt have serial number"); logcomment("Filer Present are : @fil_with_srl"); logcomment("Execute ssyconfig -v and get system id "); logcomment("Remove drive from one node and assign to node b"); my ( $drv, $API, $fil_o, $fil_assin ); foreach my $fil ( keys %$test_drv_details ) { $drv = $test_drv_details->{$fil}->{'TST_DRV'}; $API = $test_drv_details->{$fil}->{'API_OBJ'}; logcomment("Un-assign Drive $drv from filer $fil"); $fil_o = $fil; $API->execute_raw_command( 'command' => "disk remove_ownership -f $drv" ); last; } if ( $fil_o =~ /$FILERA/ ) { logcomment("Filer : $fil_o was used to remove dirve "); $fil_assin = $FILERB; } elsif ( $fil_o =~ /$FILERB/ ) { logcomment("Filer : $fil_o was used to remove dirve "); $fil_assin = $FILERA; } logcomment("Assign Drive $drv to Filer $fil_assin"); my $API = $FILER_API{$fil_assin}; my $sys_id_a = sysconfig_v_data( node => $Node, API_Obj => $API )->{'system_id'}; $API->execute_raw_command( 'command' => "disk assign $drv -o $fil_assin -s $sys_id_a -f" ); logcomment("Drive $drv assigned to $fil_assin with system id $sys_id_a"); } } } my $all_dvr_list = disk_show_v( Node => $Nodes[0] ); my @disk_array_B; my @disk_array_A; foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); foreach my $disk ( keys %$all_dvr_list ) { my $owner = $all_dvr_list->{$disk}->{'OWNER'}; if ( $owner =~ /$FILER_C/ ) { push( @disk_array_A, $disk ); } else { push( @disk_array_B, $disk ); } } } logcomment("FILER A : @disk_array_A"); logcomment("FILER B : @disk_array_B"); # $FILER_DISK{$FILER_C} = [@disk_array]; # logcomment("DEBUG :Drives in the Filer $FILER_C : @{$FILER_DISK{$FILER_C}}"); my ($actual_log_dir) = $LOGDIR =~ /(\S+)\/HDD/; my $disk_qual_path = $actual_log_dir . "/disk_qual_cnt_$TC_name.log"; logcomment("**DEBUG** : log path : $disk_qual_path"); open( FH, ">>$disk_qual_path" ) || die "Failed to open the write file disk_qual.txt"; close(FH); return $TCD::PASS; } ########## TEST 1 ################################################### #NADQ02_Disk_Qual_BDP_ ##################################################################### sub Disk_Qual_BDP { 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( \&Disk_Qual_BDP_sub, -runid, "Disk_Qual_BDP_$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 Disk_Qual_BDP_sub { my @Nodes; push( @Nodes, shift(@_) ); $Test->description("Disk_Qual_BDP : Basic Drive Performance Disk Qual"); eye_catcher( Test => $Test, string => "Starting execution of test steps. Total steps to be executed as part of the script are: 5" ); ################## ## Test variables ################## my $disk_list_result_1 = {}; my $drive; my $fw; my %disk_qual_cnt; #my @disk_array; ############################################################################################################# ## Step 1 - SELECT A SINGLE DRIVE ID. Execute each command into the console of the filer for the drive chosen ############################################################################################################# foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); eye_catcher( Test => $Test, string => "STEP 1 of 5 : $FILER_C : Checking the drive(s) to be used for disk qual perf tests", ); my $target; my $serno_exists = 0; my @disk_array = @{ $FILER_DISK{$FILER_C} }; if ( "$TEST_DRIVES" eq "all" ) { $drive = "all"; logcomment("As user selected 'ALL' option, disk_qual will run on all drives"); $logname = "mt"; logcomment("Selected Drive : $drive"); } else { logcomment("Checking for the Drive serial number $DRIVE_ID and $DRIVE_ID_B "); $logname = "1t"; foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $drv = $test_drv_details->{$FILER_C}->{'TST_DRV'}; my $API = $test_drv_details->{$FILER_C}->{'API_OBJ'}; my $ser = $test_drv_details->{$FILER_C}->{'SRLNO'}; logcomment("FILER : $FILER_C : Drive : $drv with serial number :$ser "); } } #$fw = get_revision( $Node, $drive ); } ##################################################################################### # Step 2 - Function run_dq_perfm_1_8 SEQUENTIAL READ PERF; OD/MD/ID; QUEUE 4K-256K Transfers # ##################################################################################### eye_catcher( Test => $Test, string => "STEP 2 of 5 : $FILER_C : Performing disk qual Sequential Read Perf tests", ); foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $API_OBJ = $FILER_API{$FILER_C}; my $drv_list_all = nvme_list_only_nvme( node_present => [$Node] ); my $drive = $test_drv_details->{$FILER_C}->{'TST_DRV'}; $drive = "all" if ( "$TEST_DRIVES" eq "all" ); my $fw = $drv_list_all->{$drive}->{'REV'}; $fw = get_revision( $Node, $drive ) if ( "$TEST_DRIVES" eq "all" ); $log_serial = $drv_list_all->{$drive}->{'SERIAL'}; my @disk_list = nvme_get_disk_owned( Node => $Node ); logcomment("$FILER_C: Disk list used in disk_qual start command : @disk_list and the drives selected by user : $drive"); my $logfile = "$LOGDIR/Disk_Qual_BDP_$FILER_C" . "\.log"; my $que_path = 1; nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T1" ); logcomment("$FILER_C : Test Script # $que_path execution is Started"); logcomment("DEBUG PRINT "); logcomment("NODE : $Node "); logcomment("Mode : $MODE "); logcomment("API : $API_OBJ "); logcomment("FW :$fw "); logcomment("Drive : $drive"); logcomment("Ques : $que_path "); logcomment("Drives : @disk_list"); my $cmd = "run_dq_perfm_1_8_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",que_path => " . '$que_path' . ",disk_list => " . '\@disk_list' . ")"; logcomment("COMMAND : $cmd"); eval("$cmd"); if ($@) { logcomment( "**FATAL** : $FILER_C :FILER PANIC DURING DISK_QUAL T" . "$que_path - STEP : 2" ); return logresult( "INFO", msg => 1 ); } else { logcomment("$FILER_C : Test Script # 1 Completed"); gen_log( $que_path, $FILER_C, $log_serial ); } for ( $que_path = 2 ; $que_path <= 8 ; $que_path++ ) { nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T$que_path" ); logcomment("$FILER_C : Test Script # $que_path execution is Started"); my $cmd = "run_dq_perfm_1_8_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",que_path => " . '$que_path' . ",disk_list => " . '\@disk_list' . ")"; logcomment("COMMAND 1: $cmd"); eval("$cmd"); if ($@) { logcomment( "**FATAL** : $FILER_C :FILER PANIC DURING DISK_QUAL T" . "$que_path - STEP : 2" ); return logresult( "INFO", msg => 1 ); } else { logcomment("$FILER_C : Test Script # $que_path Completed"); gen_log( $que_path, $FILER_C, $log_serial ); logcomment("$FILER_C : Disk qual Sequential Read Perf tests completed"); } } disk_qual_drive_assign_maint( Node_ref => \@Nodes, disk_ref => \@disk_list ); } ################################################################################################### # Step 3 - Function run_dq_perfm_9 T9; SEQUENTIAL WRITE PERF; OD/MD/ID; QUEUE 1 2 3 4; 128K&256K Transfers # ################################################################################################### foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $API_OBJ = $FILER_API{$FILER_C}; eye_catcher( Test => $Test, string => "STEP 3 of 5 : $FILER_C : Performing disk qual Sequential Write Perf test", ); my $drv_list_all = nvme_list_only_nvme( node_present => [$Node] ); my $drive = $test_drv_details->{$FILER_C}->{'TST_DRV'}; $drive = "all" if ( "$TEST_DRIVES" eq "all" ); my $fw = $drv_list_all->{$drive}->{'REV'}; $fw = get_revision( $Node, $drive ) if ( "$TEST_DRIVES" eq "all" ); $log_serial = $drv_list_all->{$drive}->{'SERIAL'}; my @disk_list = nvme_get_disk_owned( Node => $Node ); logcomment("$FILER_C: Disk list used in disk_qual start command : @disk_list and the drives selected by user : $drive"); my $logfile = "$LOGDIR/Disk_Qual_BDP_$FILER_C" . "\.log"; nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T9" ); logcomment("DEBUG PRINT "); logcomment("NODE : $Node "); logcomment("Mode : $MODE "); logcomment("API : $API_OBJ "); logcomment("FW :$fw "); logcomment("Drive : $drive"); logcomment("Drives : @disk_list"); logcomment("$FILER_C : Test Script # 9 execution is Started"); my $cmd = "run_dq_perfm_9_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",disk_list => " . '\@disk_list' . ")"; eval("$cmd"); if ($@) { logcomment("**FATAL** : $FILER_C : FILER PANIC DURING DISK_QUAL T9 - STEP : 3"); return logresult( "INFO", msg => 1 ); } else { my $que_path = 9; logcomment("$FILER_C : Test Script # 9 Completed"); gen_log( $que_path, $FILER_C, $log_serial ); logcomment("$FILER_C : Disk qual Sequential Write Perf test completed"); } disk_qual_drive_assign_maint( Node_ref => \@Nodes, disk_ref => \@disk_list ); } ################################################################################################### # Step 4 - Function run_dq_perfm_10_12 T10; NEAR SEQUENTIAL WRITE PERF; OD/MD/ID16MB Range; QUEUE 1 2 3 4; # # Transfers 12K&40K Skip 4K 12K 24K # ################################################################################################## foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $API_OBJ = $FILER_API{$FILER_C}; eye_catcher( Test => $Test, string => "STEP 4 of 5 : $FILER_C : Performing disk qual near Sequential Write Perf tests", ); my $drv_list_all = nvme_list_only_nvme( node_present => [$Node] ); my $drive = $test_drv_details->{$FILER_C}->{'TST_DRV'}; $drive = "all" if ( "$TEST_DRIVES" eq "all" ); my $fw = $drv_list_all->{$drive}->{'REV'}; $fw = get_revision( $Node, $drive ) if ( "$TEST_DRIVES" eq "all" ); $log_serial = $drv_list_all->{$drive}->{'SERIAL'}; my @disk_list = nvme_get_disk_owned( Node => $Node ); logcomment("$FILER_C: Disk list used in disk_qual start command : @disk_list and the drives selected by user : $drive"); my $logfile = "$LOGDIR/Disk_Qual_BDP_$FILER_C" . "\.log"; nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T10" ); logcomment("DEBUG PRINT "); logcomment("NODE : $Node "); logcomment("Mode : $MODE "); logcomment("API : $API_OBJ "); logcomment("FW :$fw "); logcomment("Drive : $drive"); logcomment("Drives : @disk_list"); logcomment("$FILER_C : Test Script # 10 execution is Started"); my $cmd = "run_dq_perfm_10_12_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",zone => " . '0' . ",TS_no => " . 'T10' . ",disk_list => " . '\@disk_list' . ")"; eval("$cmd"); if ($@) { logcomment("**FATAL** : $FILER_C :FILER PANIC DURING DISK_QUAL T10 - STEP : 4"); return logresult( "INFO", msg => 1 ); } else { my $que_path = 10; logcomment("$FILER_C : Test Script # 10 Completed"); gen_log( $que_path, $FILER_C, $log_serial ); } nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T11" ); logcomment("$FILER_C : Test Script # 11 execution is Started"); my $cmd = "run_dq_perfm_10_12_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",zone => " . 'md' . ",TS_no => " . 'T11' . ",disk_list => " . '\@disk_list' . ")"; eval("$cmd"); if ($@) { logcomment("**FATAL** : $FILER_C :FILER PANIC DURING DISK_QUAL T11 - STEP : 4"); return logresult( "INFO", msg => 1 ); } else { my $que_path = 11; logcomment("$FILER_C : Test Script # 11 Completed"); gen_log( $que_path, $FILER_C, $log_serial ); } nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T12" ); logcomment("$FILER_C : Test Script # 12 execution is Started"); my $cmd = "run_dq_perfm_10_12_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",zone => " . 'id' . ",TS_no => " . 'T12' . ",disk_list => " . '\@disk_list' . ")"; eval("$cmd"); if ($@) { logcomment("**FATAL** : $FILER_C :FILER PANIC DURING DISK_QUAL T12 - STEP : 4"); return logresult( "INFO", msg => 1 ); } else { my $que_path = 12; logcomment("$FILER_C : Test Script # 12 Completed"); gen_log( $que_path, $FILER_C, $log_serial ); logcomment("$FILER_C : Disk qual near Sequential Write Perf tests completed"); } disk_qual_drive_assign_maint( Node_ref => \@Nodes, disk_ref => \@disk_list ); } ################################################################################################# # Step 5 - # Function run_dq_perfm_13 up to 17 are executed one after the other # # run_dq_perfm_13 NEAR SEQUENTIAL READ PERF; Full Disk; QUEUE 1-8; Transfers 4K Skip 4K 12K 24K # # run_dq_perfm_14 NEAR SEQUENTIAL READ PERF; Full Disk; QUEUE 1-8; Transfers 8K Skip 4K 12K 24K # # run_dq_perfm_15 RANDOM READ PERF; FULL DISK; QUEUE 1-4 # # run_dq_perfm_16 RANDOM READ PERF; FULL DISK; QUEUE 5-8 # # run_dq_perfm_17 MULTI-STREAM SEQUENTIAL READ PERF; FD/OD/MD/ID; QUEUE 1-6; Transfer 4K # ################################################################################################# logcomment( "Performance Test: T13 to T14; NEAR SEQUENTIAL READ PERF; Full Disk; QUEUE 1-8; Transfers 4K - 8K Skip 4K 12K 24K \nPerformance Test: T15, T16; RANDOM READ PERF; FULL DISK; QUEUE 1-4, QUEUE 5-8 \nPerformance Test: T17; MULTI-STREAM SEQUENTIAL READ PERF; FD/OD/MD/ID; QUEUE 1-6; Transfer 4K" ); foreach my $Node (@Nodes) { my $FILER_C = $Node->name(); my $API_OBJ = $FILER_API{$FILER_C}; eye_catcher( Test => $Test, string => "STEP 5 of 5 : $FILER_C : Performing disk qual Random Read & Multi stream sequential read tests", ); my $drv_list_all = nvme_list_only_nvme( node_present => [$Node] ); my $drive = $test_drv_details->{$FILER_C}->{'TST_DRV'}; $drive = "all" if ( "$TEST_DRIVES" eq "all" ); my $fw = $drv_list_all->{$drive}->{'REV'}; $fw = get_revision( $Node, $drive ) if ( "$TEST_DRIVES" eq "all" ); $log_serial = $drv_list_all->{$drive}->{'SERIAL'}; my @disk_list = nvme_get_disk_owned( Node => $Node ); logcomment("$FILER_C: Disk list used in disk_qual start command : @disk_list and the drives selected by user : $drive"); my $logfile = "$LOGDIR/Disk_Qual_BDP_$FILER_C" . "\.log"; logcomment("DEBUG PRINT "); logcomment("NODE : $Node "); logcomment("Mode : $MODE "); logcomment("API : $API_OBJ "); logcomment("FW :$fw "); logcomment("Drive : $drive"); logcomment("Drives : @disk_list"); for ( my $suffix = 13 ; $suffix <= 17 ; $suffix++ ) { nvme_eye_catcher( Test => $Test, string => "Disk Qual Performance Script - T$suffix" ); logcomment("$FILER_C : Test Script # $suffix execution is Started"); my $cmd = "run_dq_perfm_" . "$suffix" . "_Cmode" . "(Node => " . '$Node' . ",MODE => " . '$MODE' . ",API => " . '$API_OBJ' . ",fw => " . '$fw' . ",drid => " . '$drive' . ",disk_list => " . '\@disk_list' . ")"; eval("$cmd"); if ($@) { logcomment( "**FATAL** : $FILER_C : FILER PANIC DURING DISK_QUAL T" . "$suffix - STEP : 5" ); return logresult( "INFO", msg => 1 ); } else { logcomment("$FILER_C : Test Script # $suffix Completed"); gen_log( $suffix, $FILER_C, $log_serial ); logcomment("$FILER_C : Disk qual Random read & Multi stream sequential read tests completed"); } } disk_qual_drive_assign_maint( Node_ref => \@Nodes, disk_ref => \@disk_list ); } my ($actual_log_dir) = $LOGDIR =~ /(\S+)\/HDD/; my $disk_qual_path = $actual_log_dir . "/disk_qual_cnt_$TC_name" . "_$FILER_C.log"; logcomment("**DEBUG** : log path : $disk_qual_path"); open( FH, ">>$disk_qual_path" ) || die "Failed to open the write file disk_qual.txt"; foreach my $dsk ( keys %disk_qual_cnt ) { logcomment("$dsk\t\t$disk_qual_cnt{$dsk}"); print FH "$dsk\t\t$disk_qual_cnt{$dsk}\n"; } close FH; ########################################################################################### ## Test log/results ########################################################################################### logcomment("Test $TC_name is completed."); logresult( "INFO", msg => $test_status ); } ## end sub Perf_DskQul ############################################################# #Cleanup ############################################################# sub cleanup() { logcomment(" $filer_names - Clean up and post test process"); $Test->description("Preforming Post test process - Check filer state, Check disk, check root volume,halt hammer, halt scrub, filer config"); my $node_ref = \@Nodes; ########################################################################################### ## Post Test process - Category : "post_test" ########################################################################################## nvme_post_test( node_present => $node_ref, Test => $Test, filer_mode => $Mode, change_state_to => "MAINT", ); return $TCD::PASS; } ################################## ## SUBROUTINES ################################## sub get_revision { my ( $Node, $drive ) = @_; my $FILER_C = $Node->name(); my $API = $FILER_API{$FILER_C}; my $after = $API->execute_raw_command( command => "disk_list" ); my @lines = split( /\n/, $after ); my $n = 0; my @faculty = (); my %faculty_hash = (); # skip to the start of table contents while ( $n <= $#lines ) { last if ( $lines[$n] =~ /^-----/ ); $n++; } $n++; foreach my $line ( @lines[ $n .. $#lines ] ) { if ( $drive eq 'all' ) { #DISK CHAN VENDOR PRODUCT ID REV SERIAL# HW (BLOCKS BPS) DQ if ( $line =~ /\S+\s+\.*\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+\S+/ ) { push @faculty, $1; } } else { if ( $line =~ /$drive\s+\.*\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+\S+/ ) { push @faculty, $1; } } } foreach my $facs (@faculty) { $faculty_hash{$facs} = 1; } my @faculty_unique = keys(%faculty_hash); my $faculty_len = @faculty_unique; printf("length is $faculty_len"); my $index = 0; my $string; if ( $faculty_len > 1 ) { while ( $index != $faculty_len ) { $string = $string . '/' . $faculty_unique[$index]; printf("$faculty_unique[$index] \n"); $index++; } } else { $string = $faculty_unique[$index]; } return $string; } # Function gen_log generate log files for single or all drives sub gen_log { my ( $que_path, $filer, $log_serial ) = @_; # my $FILER_C = $Node->name(); my $logfile = "$LOGDIR/Disk_Qual_BDP_$filer" . "\.log"; logcomment("GEN LOG : Log file to read : $logfile"); open( CONS_LOG, "$logfile" ) || die "Can not open file $logfile "; # my $que_path = shift; my $log_name; if ( $que_path <= 9 ) { $log_name = $que_path; } if ( $que_path == 10 ) { $log_name = 'a'; } elsif ( $que_path == 11 ) { $log_name = 'b'; } elsif ( $que_path == 12 ) { $log_name = 'c'; } elsif ( $que_path == 13 ) { $log_name = 'd'; } elsif ( $que_path == 14 ) { $log_name = 'e'; } elsif ( $que_path == 15 ) { $log_name = 'f'; } elsif ( $que_path == 16 ) { $log_name = 'g'; } elsif ( $que_path == 17 ) { $log_name = 'h'; } my $logtimestamp; my $time = time(); my $gmtime = gmtime($time); if ( $gmtime =~ /\S+\s*\S+\s*(\d+)\s*(\S+)/ ) { my $x = $1; my $y = $2; $y =~ s/://g; $logtimestamp = "$x" . "_" . "$y"; } my $script_log = "$LOGDIR/../../../../$logtimestamp" . "_" . "Disk_Qual_BDP_$filer" . "_" . "$log_serial" . "." . "$logname" . "$log_name"; logcomment("GEN LOG : Script log : $script_log"); open( SCRIPTS_LOG, ">$script_log" ) || die "write:Failed opening $script_log \n"; while () { if ( /Test Script # $que_path execution is Started/ .. /Test Script # $que_path Completed/ ) { print( SCRIPTS_LOG "$_" ); } if ( $_ =~ /Test Script # $que_path Completed/ ) { close CONS_LOG; close SCRIPTS_LOG; conver_macro_format($script_log); last; } } } sub conver_macro_format($file_name) { my ($log_file) = @_; open( H_LOGFILE, "< $log_file " ) or die ">>>>> read: Failed opening $log_file <<<<<"; my (@console_log_arr); foreach my $line () { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#' or new line. } $line =~ /(.*)\[(.*)\|(.*)/; $line = $3; if ( $line =~ /^\\r\\r\\n(.*)/ ) { $line = $1 . $2; } elsif ( $line =~ /^\\t\\t(.*)/ ) { $line = $1; } elsif ( $line =~ /(.*)\\r\\r\\n(.*)/ ) { $line = $1 . $2; push( @console_log_arr, $line ); } elsif ( $line =~ /(.*)\\r\\n(.*)/ ) { $line = $1 . $2; push( @console_log_arr, $line ); } elsif ( $line =~ /(.*)\\r(.*)/ ) { $line = $1 . $2; push( @console_log_arr, $line ); } elsif ( $line =~ /^\\t\\t(.*)/ ) { $line = $1; push( @console_log_arr, $line ); } elsif ( $line =~ /^\\t(.*)/ ) { $line = $1; push( @console_log_arr, $line ); } elsif ( $line =~ /(.*)\\t(.*)/ ) { $line = $1 . $2; push( @console_log_arr, $line ); } elsif ( $line =~ /^(\\r)/ ) { } elsif ( $line =~ /^(-------)/ ) { } elsif ( $line =~ /^(\*\*\*\*)/ ) { } elsif ( $line =~ /.*(RESULTS SUMMARY|results reported)/ ) { } else { push( @console_log_arr, $line ); } } #Record to the result file my $write_console_log = $log_file . " "; my $identical_line = "NONE"; open( H_LOGFILE, ">$write_console_log" ) or die "write:Failed opening $write_console_log \n"; foreach my $line (@console_log_arr) { if ( ( $line =~ /^\s+$/ ) ) { next; } else { print( H_LOGFILE "$line \n" ) if ( $line ne $identical_line ); $identical_line = $line; } } close H_LOGFILE; }