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(
|
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,
|
process.version,
|
||||||
args.version,
|
args.version,
|
||||||
|
fs.realpathSync(args.driverConfigFile),
|
||||||
args.csiName,
|
args.csiName,
|
||||||
options.driver,
|
options.driver,
|
||||||
args.csiMode.join(","),
|
args.csiMode.join(","),
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export PATH="/usr/local/lib/nodejs/bin:${PATH}"
|
||||||
# install deps
|
# install deps
|
||||||
#npm i
|
#npm i
|
||||||
# install from artifacts
|
# 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
|
tar -zxf node_modules-linux-amd64.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1476,7 +1476,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
break;
|
break;
|
||||||
case "iscsi":
|
case "iscsi":
|
||||||
// Delete target
|
// 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
|
// Delete extent
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1258,16 +1258,7 @@ class CsiBaseDriver {
|
||||||
*
|
*
|
||||||
* if path exists but is NOT symlink delete it
|
* if path exists but is NOT symlink delete it
|
||||||
*/
|
*/
|
||||||
try {
|
result = await filesystem.pathExists(win_staging_target_path);
|
||||||
fs.statSync(win_staging_target_path);
|
|
||||||
result = true;
|
|
||||||
} catch (err) {
|
|
||||||
if (err.code === "ENOENT") {
|
|
||||||
result = false;
|
|
||||||
} else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
result = fs.lstatSync(win_staging_target_path);
|
result = fs.lstatSync(win_staging_target_path);
|
||||||
|
|
@ -1593,22 +1584,10 @@ class CsiBaseDriver {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "hostpath":
|
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 exists already delete if folder, return if symlink
|
||||||
if (result) {
|
if (await filesystem.pathExists(win_staging_target_path)) {
|
||||||
result = fs.lstatSync(win_staging_target_path);
|
|
||||||
// remove pre-created dir by CO
|
// remove pre-created dir by CO
|
||||||
if (!result.isSymbolicLink()) {
|
if (!(await filesystem.isSymbolicLink(win_staging_target_path))) {
|
||||||
fs.rmdirSync(win_staging_target_path);
|
fs.rmdirSync(win_staging_target_path);
|
||||||
} else {
|
} else {
|
||||||
// assume symlink points to the correct location
|
// assume symlink points to the correct location
|
||||||
|
|
@ -2627,7 +2606,7 @@ class CsiBaseDriver {
|
||||||
);
|
);
|
||||||
|
|
||||||
// source path
|
// source path
|
||||||
result = await wutils.GetItem(normalized_staging_path);
|
result = await filesystem.pathExists(normalized_staging_path);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
grpc.status.FAILED_PRECONDITION,
|
grpc.status.FAILED_PRECONDITION,
|
||||||
|
|
@ -2982,7 +2961,7 @@ class CsiBaseDriver {
|
||||||
let win_volume_path =
|
let win_volume_path =
|
||||||
filesystem.covertUnixSeparatorToWindowsSeparator(volume_path);
|
filesystem.covertUnixSeparatorToWindowsSeparator(volume_path);
|
||||||
// ensure path is mounted
|
// ensure path is mounted
|
||||||
result = await wutils.GetItem(win_volume_path);
|
result = await filesystem.pathExists(win_volume_path);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
grpc.status.NOT_FOUND,
|
grpc.status.NOT_FOUND,
|
||||||
|
|
@ -2992,7 +2971,7 @@ class CsiBaseDriver {
|
||||||
|
|
||||||
let node_attach_driver;
|
let node_attach_driver;
|
||||||
|
|
||||||
let target = await wutils.GetRealTarget(win_volume_path) || "";
|
let target = (await wutils.GetRealTarget(win_volume_path)) || "";
|
||||||
if (target.startsWith("\\\\")) {
|
if (target.startsWith("\\\\")) {
|
||||||
node_attach_driver = "smb";
|
node_attach_driver = "smb";
|
||||||
}
|
}
|
||||||
|
|
@ -3236,7 +3215,7 @@ class CsiBaseDriver {
|
||||||
filesystem.covertUnixSeparatorToWindowsSeparator(volume_path);
|
filesystem.covertUnixSeparatorToWindowsSeparator(volume_path);
|
||||||
|
|
||||||
// ensure path is mounted
|
// ensure path is mounted
|
||||||
result = await wutils.GetItem(win_volume_path);
|
result = filesystem.pathExists(win_volume_path);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
grpc.status.NOT_FOUND,
|
grpc.status.NOT_FOUND,
|
||||||
|
|
|
||||||
|
|
@ -228,8 +228,12 @@ class Filesystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isSymboliclink(path) {
|
||||||
|
return fs.lstatSync(path).isSymbolicLink();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create symlink
|
* remove file
|
||||||
*
|
*
|
||||||
* @param {*} device
|
* @param {*} device
|
||||||
*/
|
*/
|
||||||
|
|
@ -829,16 +833,17 @@ class Filesystem {
|
||||||
* @param {*} path
|
* @param {*} path
|
||||||
*/
|
*/
|
||||||
async pathExists(path) {
|
async pathExists(path) {
|
||||||
const filesystem = this;
|
let result = false;
|
||||||
let args = [];
|
|
||||||
args.push(path);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await filesystem.exec("stat", args);
|
fs.statSync(path);
|
||||||
|
result = true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return false;
|
if (err.code !== "ENOENT") {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(command, args, options = {}) {
|
exec(command, args, options = {}) {
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ class Windows {
|
||||||
}
|
}
|
||||||
} while (path);
|
} while (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetItem(localPath) {
|
async GetItem(localPath) {
|
||||||
let command;
|
let command;
|
||||||
let result;
|
let result;
|
||||||
|
|
@ -201,7 +202,12 @@ class Windows {
|
||||||
chapSecret,
|
chapSecret,
|
||||||
multipath = false
|
multipath = false
|
||||||
) {
|
) {
|
||||||
let is_connected = await this.IscsiTargetIsConnectedByPortalAddressPortalPort(address, port, iqn);
|
let is_connected =
|
||||||
|
await this.IscsiTargetIsConnectedByPortalAddressPortalPort(
|
||||||
|
address,
|
||||||
|
port,
|
||||||
|
iqn
|
||||||
|
);
|
||||||
if (is_connected) {
|
if (is_connected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue