summaryrefslogtreecommitdiff
path: root/pytests
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2019-08-13 16:02:18 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2019-08-13 16:02:18 -0400
commit5a70e4129ae8b8808d43ed41ded4b68ede816d9f (patch)
tree78e8de247e4c0062977c328f2abbe990c05e1157 /pytests
parentf80dced9437cb745b6f251eb351d2c3fa4de31a0 (diff)
downloadmongo-5a70e4129ae8b8808d43ed41ded4b68ede816d9f.tar.gz
SERVER-42615 Run chkdsk command on Windows after each powercycle loop.
(cherry picked from commit e6ef0ca20e99b2b3a6682952c2588e6e2d1ba8a9)
Diffstat (limited to 'pytests')
-rwxr-xr-xpytests/powertest.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/pytests/powertest.py b/pytests/powertest.py
index f330a645a3b..32c6cbe551a 100755
--- a/pytests/powertest.py
+++ b/pytests/powertest.py
@@ -1317,6 +1317,30 @@ def remote_handler(options, operations): # pylint: disable=too-many-branches,to
err)
ret = err.code
+ elif operation == "check_disk":
+ if _IS_WINDOWS:
+ partitions = psutil.disk_partitions()
+ for part in partitions:
+ if part.fstype != "NTFS" or part.mountpoint == "C:\\":
+ # Powercycle testing in Evergreen only writes to the D: and E: drives on the
+ # remote machine. We skip running the chkdsk command on the C: drive because
+ # it sometimes fails with a "Snapshot was deleted" error. We assume the
+ # system drive is functioning properly because the remote machine rebooted
+ # fine anyway.
+ continue
+
+ # The chkdsk command won't accept the drive if it has a trailing backslash.
+ # We use os.path.splitdrive()[0] to transform 'C:\\' into 'C:'.
+ drive_letter = os.path.splitdrive(part.mountpoint)[0]
+ LOGGER.info("Running chkdsk command for %s drive", drive_letter)
+ cmds = f"chkdsk '{drive_letter}'"
+ ret, output = execute_cmd(cmds, use_file=True)
+ LOGGER.warning("chkdsk command for %s drive exited with code %d:\n%s",
+ drive_letter, ret, output)
+
+ if ret != 0:
+ return ret
+
else:
LOGGER.error("Unsupported remote option specified '%s'", operation)
ret = 1
@@ -2569,6 +2593,11 @@ Examples:
if loop_num == options.num_loops or test_time >= options.test_time:
break
+ ret, output = call_remote_operation(local_ops, options.remote_python, script_name,
+ client_args, "--remoteOperation check_disk")
+ if ret != 0:
+ LOGGER.error("****check_disk: %d %s****", ret, output)
+
REPORT_JSON_SUCCESS = True
local_exit(0)