ipv6 iscsi improvements, fs detection improvements
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
36a4e59c15
commit
516701bd29
|
|
@ -1,3 +1,10 @@
|
||||||
|
# v1.7.5
|
||||||
|
|
||||||
|
Released 2022-08-02
|
||||||
|
|
||||||
|
- improved ipv6 iscsi support
|
||||||
|
- allow using `blkid` for filesystem detection on block devices
|
||||||
|
|
||||||
# v1.7.4
|
# v1.7.4
|
||||||
|
|
||||||
Released 2022-07-29
|
Released 2022-07-29
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "democratic-csi",
|
"name": "democratic-csi",
|
||||||
"version": "1.7.4",
|
"version": "1.7.5",
|
||||||
"description": "kubernetes csi driver framework",
|
"description": "kubernetes csi driver framework",
|
||||||
"main": "bin/democratic-csi",
|
"main": "bin/democratic-csi",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -792,7 +792,7 @@ class CsiBaseDriver {
|
||||||
await iscsi.iscsiadm.rescanSession(session);
|
await iscsi.iscsiadm.rescanSession(session);
|
||||||
|
|
||||||
// find device name
|
// find device name
|
||||||
device = `/dev/disk/by-path/ip-${iscsiConnection.portal}-iscsi-${iscsiConnection.iqn}-lun-${iscsiConnection.lun}`;
|
device = iscsi.devicePathByPortalIQNLUN(iscsiConnection.portal, iscsiConnection.iqn, iscsiConnection.lun)
|
||||||
let deviceByPath = device;
|
let deviceByPath = device;
|
||||||
|
|
||||||
// can take some time for device to show up, loop for some period
|
// can take some time for device to show up, loop for some period
|
||||||
|
|
|
||||||
|
|
@ -500,8 +500,34 @@ class Filesystem {
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = await filesystem.getBlockDevice(device);
|
/**
|
||||||
return result.fstype ? true : false;
|
* lsblk
|
||||||
|
* blkid
|
||||||
|
*/
|
||||||
|
const strategy = process.env.FILESYSTEM_TYPE_DETECTION_STRATEGY || "lsblk";
|
||||||
|
|
||||||
|
switch (strategy) {
|
||||||
|
// requires udev data to be present otherwise fstype property is always null but otherwise succeeds
|
||||||
|
case "lsblk":
|
||||||
|
result = await filesystem.getBlockDevice(device);
|
||||||
|
return result.fstype ? true : false;
|
||||||
|
// no requirement on udev data to be present
|
||||||
|
case "blkid":
|
||||||
|
try {
|
||||||
|
result = await filesystem.getDeviceFilesystemInfo(device);
|
||||||
|
} catch (err) {
|
||||||
|
// if not formatted nor partitioned exits with 2
|
||||||
|
if (err.code == 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.type ? true : false;
|
||||||
|
// file -s <device> could also be an option
|
||||||
|
default:
|
||||||
|
throw new Error(`unknown filesystem detection strategy: ${strategy}`);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,7 @@ async function retry(retries, retriesDelay, code, options = {}) {
|
||||||
let retry = retryCondition(err);
|
let retry = retryCondition(err);
|
||||||
if (!retry) {
|
if (!retry) {
|
||||||
console.log(`retry - failed condition, not trying again`);
|
console.log(`retry - failed condition, not trying again`);
|
||||||
|
//console.log(code.toString(), retryCondition.toString());
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -560,6 +560,14 @@ class ISCSI {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
devicePathByPortalIQNLUN(portal, iqn, lun) {
|
||||||
|
const parsedPortal = this.parsePortal(portal);
|
||||||
|
const portalHost = parsedPortal.host
|
||||||
|
.replaceAll("[", "")
|
||||||
|
.replaceAll("]", "");
|
||||||
|
return `/dev/disk/by-path/ip-${portalHost}:${parsedPortal.port}-iscsi-${iqn}-lun-${lun}`;
|
||||||
|
}
|
||||||
|
|
||||||
exec(command, args, options = {}) {
|
exec(command, args, options = {}) {
|
||||||
if (!options.hasOwnProperty("timeout")) {
|
if (!options.hasOwnProperty("timeout")) {
|
||||||
options.timeout = DEFAULT_TIMEOUT;
|
options.timeout = DEFAULT_TIMEOUT;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue