From 1f7fa2099240f383dd17b9424097d18c8f9a19be Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Sat, 23 Nov 2019 02:08:17 -0700 Subject: [PATCH] another attempt at better disconnect logic --- bin/democratic-csi | 2 -- src/utils/iscsi.js | 31 ++++++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/bin/democratic-csi b/bin/democratic-csi index 8702ae1..752db58 100755 --- a/bin/democratic-csi +++ b/bin/democratic-csi @@ -69,8 +69,6 @@ if (!args.serverSocket && !args.serverAddress && !args.serverPort) { const package = require("../package.json"); args.version = package.version; -console.log(args, options); - //const grpc = require("grpc"); const grpc = require("grpc-uds"); const protoLoader = require("@grpc/proto-loader"); diff --git a/src/utils/iscsi.js b/src/utils/iscsi.js index 722cf28..dbca409 100644 --- a/src/utils/iscsi.js +++ b/src/utils/iscsi.js @@ -415,23 +415,24 @@ class ISCSI { if (!Array.isArray(portals)) { portals = [portals]; } - portals.forEach(p => { - iscsi - .exec(options.paths.iscsiadm, args.concat(["-p", p, "-u"])) - .then(() => {}) - .catch(err => { - if (err.code == 21) { - // no matching sessions - } else { - throw err; - } - }); - }); + for (let i = 0; i < portals.length; i++) { + let p = portals[i]; + try { + await iscsi.exec( + options.paths.iscsiadm, + args.concat(["-p", p, "-u"]) + ); + } catch (err) { + if (err.code == 21) { + // no matching sessions + } else { + throw err; + } + } + } return true; - }, - - async deleteDBEntry(tgtIQN) {} + } }; }