better unstage logic

This commit is contained in:
Travis Glenn Hansen 2019-11-23 02:41:56 -07:00
parent 1f7fa20992
commit 380caec9ed
1 changed files with 10 additions and 10 deletions

View File

@ -455,6 +455,11 @@ class CsiBaseDriver {
} }
} }
result = await mount.pathIsMounted(normalized_staging_path);
if (result) {
result = await mount.umount(normalized_staging_path, ["--force"]);
}
if (is_block) { if (is_block) {
if (block_device_info.tran == "iscsi") { if (block_device_info.tran == "iscsi") {
// figure out which iscsi session this belongs to and logout // figure out which iscsi session this belongs to and logout
@ -499,11 +504,11 @@ class CsiBaseDriver {
let current_time = Math.round(new Date().getTime() / 1000); let current_time = Math.round(new Date().getTime() / 1000);
if (current_time - timer_start > timer_max) { if (current_time - timer_start > timer_max) {
// not throwing error for now as future invocations would not enter code path anyhow // not throwing error for now as future invocations would not enter code path anyhow
//loggedOut = true; loggedOut = true;
throw new GrpcError( //throw new GrpcError(
grpc.status.UNKNOWN, // grpc.status.UNKNOWN,
`hit timeout trying to logout of iscsi target: ${session.persistent_portal}` // `hit timeout trying to logout of iscsi target: ${session.persistent_portal}`
); //);
} }
} }
} }
@ -536,11 +541,6 @@ class CsiBaseDriver {
} }
} }
result = await mount.pathIsMounted(normalized_staging_path);
if (result) {
result = await mount.umount(normalized_staging_path, ["--force"]);
}
if (access_type == "block") { if (access_type == "block") {
// remove touched file // remove touched file
result = await filesystem.pathExists(block_path); result = await filesystem.pathExists(block_path);