From 4f48cfc640228fb2757298e61ad5178d39c4e5b2 Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Mon, 30 Nov 2020 00:32:13 -0700 Subject: [PATCH] fix missing await, errors on failure to reload iscsi service --- src/driver/freenas/index.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/driver/freenas/index.js b/src/driver/freenas/index.js index cbf160b..c9e982f 100644 --- a/src/driver/freenas/index.js +++ b/src/driver/freenas/index.js @@ -1388,20 +1388,35 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver { async expandVolume(call, datasetName) { const driverShareType = this.getDriverShareType(); const sshClient = this.getSshClient(); + let response; switch (driverShareType) { case "iscsi": - const isScale = this.getIsScale(); + const isScale = await this.getIsScale(); if (isScale) { this.ctx.logger.verbose("FreeNAS reloading scst"); - await sshClient.exec( + response = await sshClient.exec( sshClient.buildCommand("systemctl", ["reload", "scst"]) ); + + if (response.code != 0) { + throw new GrpcError( + grpc.status.UNKNOWN, + `error reloading scst: ${JSON.stringify(response)}` + ); + } } else { this.ctx.logger.verbose("FreeNAS reloading ctld"); - await sshClient.exec( + response = await sshClient.exec( sshClient.buildCommand("/etc/rc.d/ctld", ["reload"]) ); + + if (response.code != 0) { + throw new GrpcError( + grpc.status.UNKNOWN, + `error reloading ctld: ${JSON.stringify(response)}` + ); + } } break; }