better iscsi device path logic

This commit is contained in:
Travis Glenn Hansen
2024-03-07 21:27:49 -07:00
parent 536f954e0a
commit f607c2a6d5
3 changed files with 22 additions and 11 deletions
+5 -4
View File
@@ -583,11 +583,12 @@ class ISCSI {
};
}
devicePathByPortalIQNLUN(portal, iqn, lun) {
async devicePathByPortalIQNLUN(portal, iqn, lun, options = {}) {
const parsedPortal = this.parsePortal(portal);
const portalHost = parsedPortal.host
.replaceAll("[", "")
.replaceAll("]", "");
let portalHost = parsedPortal.host.replaceAll("[", "").replaceAll("]", "");
if (options.hostname_lookup && net.isIP(portalHost) == 0) {
portalHost = (await hostname_lookup(portalHost)) || portalHost;
}
return `/dev/disk/by-path/ip-${portalHost}:${parsedPortal.port}-iscsi-${iqn}-lun-${lun}`;
}