minor fixes
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
83556d02fd
commit
2d3851282a
|
|
@ -372,9 +372,10 @@ if (args.serverSocket) {
|
|||
}
|
||||
|
||||
logger.info(
|
||||
"starting csi server - node version: %s, package version: %s, csi-name: %s, csi-driver: %s, csi-mode: %s, csi-version: %s, address: %s, socket: %s",
|
||||
"starting csi server - node version: %s, package version: %s, config file: %s, csi-name: %s, csi-driver: %s, csi-mode: %s, csi-version: %s, address: %s, socket: %s",
|
||||
process.version,
|
||||
args.version,
|
||||
fs.realpathSync(args.driverConfigFile),
|
||||
args.csiName,
|
||||
options.driver,
|
||||
args.csiMode.join(","),
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export PATH="/usr/local/lib/nodejs/bin:${PATH}"
|
|||
# install deps
|
||||
#npm i
|
||||
# install from artifacts
|
||||
if [[ -f "node_modules-linux-amd64.tar.gz" ]];then
|
||||
if [[ -f "node_modules-linux-amd64.tar.gz" && ! -d "node_modules" ]];then
|
||||
tar -zxf node_modules-linux-amd64.tar.gz
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1476,7 +1476,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
break;
|
||||
case "iscsi":
|
||||
// Delete target
|
||||
// NOTE: deletting a target inherently deletes associated targetgroup(s) and targettoextent(s)
|
||||
// NOTE: deleting a target inherently deletes associated targetgroup(s) and targettoextent(s)
|
||||
|
||||
// Delete extent
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1258,16 +1258,7 @@ class CsiBaseDriver {
|
|||
*
|
||||
* if path exists but is NOT symlink delete it
|
||||
*/
|
||||
try {
|
||||
fs.statSync(win_staging_target_path);
|
||||
result = true;
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
result = false;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
result = await filesystem.pathExists(win_staging_target_path);
|
||||
|
||||
if (result) {
|
||||
result = fs.lstatSync(win_staging_target_path);
|
||||
|
|
@ -1593,22 +1584,10 @@ class CsiBaseDriver {
|
|||
}
|
||||
break;
|
||||
case "hostpath":
|
||||
try {
|
||||
fs.statSync(win_staging_target_path);
|
||||
result = true;
|
||||
} catch (err) {
|
||||
if (err.code === "ENOENT") {
|
||||
result = false;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// if exists already delete if folder, return if symlink
|
||||
if (result) {
|
||||
result = fs.lstatSync(win_staging_target_path);
|
||||
if (await filesystem.pathExists(win_staging_target_path)) {
|
||||
// remove pre-created dir by CO
|
||||
if (!result.isSymbolicLink()) {
|
||||
if (!(await filesystem.isSymbolicLink(win_staging_target_path))) {
|
||||
fs.rmdirSync(win_staging_target_path);
|
||||
} else {
|
||||
// assume symlink points to the correct location
|
||||
|
|
@ -2627,7 +2606,7 @@ class CsiBaseDriver {
|
|||
);
|
||||
|
||||
// source path
|
||||
result = await wutils.GetItem(normalized_staging_path);
|
||||
result = await filesystem.pathExists(normalized_staging_path);
|
||||
if (!result) {
|
||||
throw new GrpcError(
|
||||
grpc.status.FAILED_PRECONDITION,
|
||||
|
|
@ -2982,7 +2961,7 @@ class CsiBaseDriver {
|
|||
let win_volume_path =
|
||||
filesystem.covertUnixSeparatorToWindowsSeparator(volume_path);
|
||||
// ensure path is mounted
|
||||
result = await wutils.GetItem(win_volume_path);
|
||||
result = await filesystem.pathExists(win_volume_path);
|
||||
if (!result) {
|
||||
throw new GrpcError(
|
||||
grpc.status.NOT_FOUND,
|
||||
|
|
@ -2992,7 +2971,7 @@ class CsiBaseDriver {
|
|||
|
||||
let node_attach_driver;
|
||||
|
||||
let target = await wutils.GetRealTarget(win_volume_path) || "";
|
||||
let target = (await wutils.GetRealTarget(win_volume_path)) || "";
|
||||
if (target.startsWith("\\\\")) {
|
||||
node_attach_driver = "smb";
|
||||
}
|
||||
|
|
@ -3236,7 +3215,7 @@ class CsiBaseDriver {
|
|||
filesystem.covertUnixSeparatorToWindowsSeparator(volume_path);
|
||||
|
||||
// ensure path is mounted
|
||||
result = await wutils.GetItem(win_volume_path);
|
||||
result = filesystem.pathExists(win_volume_path);
|
||||
if (!result) {
|
||||
throw new GrpcError(
|
||||
grpc.status.NOT_FOUND,
|
||||
|
|
|
|||
|
|
@ -228,8 +228,12 @@ class Filesystem {
|
|||
}
|
||||
}
|
||||
|
||||
async isSymboliclink(path) {
|
||||
return fs.lstatSync(path).isSymbolicLink();
|
||||
}
|
||||
|
||||
/**
|
||||
* create symlink
|
||||
* remove file
|
||||
*
|
||||
* @param {*} device
|
||||
*/
|
||||
|
|
@ -829,16 +833,17 @@ class Filesystem {
|
|||
* @param {*} path
|
||||
*/
|
||||
async pathExists(path) {
|
||||
const filesystem = this;
|
||||
let args = [];
|
||||
args.push(path);
|
||||
|
||||
let result = false;
|
||||
try {
|
||||
await filesystem.exec("stat", args);
|
||||
fs.statSync(path);
|
||||
result = true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
exec(command, args, options = {}) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class Windows {
|
|||
}
|
||||
} while (path);
|
||||
}
|
||||
|
||||
async GetItem(localPath) {
|
||||
let command;
|
||||
let result;
|
||||
|
|
@ -201,7 +202,12 @@ class Windows {
|
|||
chapSecret,
|
||||
multipath = false
|
||||
) {
|
||||
let is_connected = await this.IscsiTargetIsConnectedByPortalAddressPortalPort(address, port, iqn);
|
||||
let is_connected =
|
||||
await this.IscsiTargetIsConnectedByPortalAddressPortalPort(
|
||||
address,
|
||||
port,
|
||||
iqn
|
||||
);
|
||||
if (is_connected) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue