better logging in failure scenarios

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2022-04-06 15:38:44 -06:00
parent ed4a065b6b
commit ae96215177
2 changed files with 8 additions and 5 deletions

View File

@ -194,6 +194,9 @@ async function requestHandlerProxy(call, callback, serviceMethodName) {
let message; let message;
if (e instanceof Error) { if (e instanceof Error) {
message = e.toString(); message = e.toString();
if (e.stack) {
message += ` ${e.stack}`;
}
} else { } else {
message = JSON.stringify(e); message = JSON.stringify(e);
} }

View File

@ -26,7 +26,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
const options = {}; const options = {};
options.executor = new ZfsSshProcessManager(execClient); options.executor = new ZfsSshProcessManager(execClient);
options.idempotent = true; options.idempotent = true;
if ( if (
this.options.zfs.hasOwnProperty("cli") && this.options.zfs.hasOwnProperty("cli") &&
this.options.zfs.cli && this.options.zfs.cli &&
@ -34,13 +34,13 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
) { ) {
options.paths = this.options.zfs.cli.paths; options.paths = this.options.zfs.cli.paths;
} }
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false); options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
if (typeof this.setZetabyteCustomOptions === "function") { if (typeof this.setZetabyteCustomOptions === "function") {
await this.setZetabyteCustomOptions(options); await this.setZetabyteCustomOptions(options);
} }
return new Zetabyte(options); return new Zetabyte(options);
}); });
} }
@ -406,7 +406,7 @@ delete ${iscsiName}
options options
); );
if (response.code != 0) { if (response.code != 0) {
throw new Error(response.stderr); throw new Error(JSON.stringify(response));
} }
driver.ctx.logger.verbose( driver.ctx.logger.verbose(
"TargetCLI response: " + JSON.stringify(response) "TargetCLI response: " + JSON.stringify(response)