@@ -1317,6 +1317,30 @@ def remote_handler(options, operations): # pylint: disable=too-many-branches,to
13171317 err )
13181318 ret = err .code
13191319
1320+ elif operation == "check_disk" :
1321+ if _IS_WINDOWS :
1322+ partitions = psutil .disk_partitions ()
1323+ for part in partitions :
1324+ if part .fstype != "NTFS" or part .mountpoint == "C:\\ " :
1325+ # Powercycle testing in Evergreen only writes to the D: and E: drives on the
1326+ # remote machine. We skip running the chkdsk command on the C: drive because
1327+ # it sometimes fails with a "Snapshot was deleted" error. We assume the
1328+ # system drive is functioning properly because the remote machine rebooted
1329+ # fine anyway.
1330+ continue
1331+
1332+ # The chkdsk command won't accept the drive if it has a trailing backslash.
1333+ # We use os.path.splitdrive()[0] to transform 'C:\\' into 'C:'.
1334+ drive_letter = os .path .splitdrive (part .mountpoint )[0 ]
1335+ LOGGER .info ("Running chkdsk command for %s drive" , drive_letter )
1336+ cmds = f"chkdsk '{ drive_letter } '"
1337+ ret , output = execute_cmd (cmds , use_file = True )
1338+ LOGGER .warning ("chkdsk command for %s drive exited with code %d:\n %s" ,
1339+ drive_letter , ret , output )
1340+
1341+ if ret != 0 :
1342+ return ret
1343+
13201344 else :
13211345 LOGGER .error ("Unsupported remote option specified '%s'" , operation )
13221346 ret = 1
@@ -2569,6 +2593,11 @@ def main(): # pylint: disable=too-many-branches,too-many-locals,too-many-statem
25692593 if loop_num == options .num_loops or test_time >= options .test_time :
25702594 break
25712595
2596+ ret , output = call_remote_operation (local_ops , options .remote_python , script_name ,
2597+ client_args , "--remoteOperation check_disk" )
2598+ if ret != 0 :
2599+ LOGGER .error ("****check_disk: %d %s****" , ret , output )
2600+
25722601 REPORT_JSON_SUCCESS = True
25732602 local_exit (0 )
25742603
0 commit comments