sudo support for reloading iscsi daemon, error handling for failed chown/chmod/setacl
This commit is contained in:
parent
4f48cfc640
commit
3924f08ae8
|
|
@ -699,6 +699,14 @@ class ControllerZfsSshBaseDriver extends CsiBaseDriver {
|
|||
|
||||
driver.ctx.logger.verbose("set permission command: %s", command);
|
||||
response = await sshClient.exec(command);
|
||||
if (response.code != 0) {
|
||||
throw new GrpcError(
|
||||
grpc.status.UNKNOWN,
|
||||
`error setting permissions on dataset: ${JSON.stringify(
|
||||
response
|
||||
)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// set ownership
|
||||
|
|
@ -722,6 +730,12 @@ class ControllerZfsSshBaseDriver extends CsiBaseDriver {
|
|||
|
||||
driver.ctx.logger.verbose("set ownership command: %s", command);
|
||||
response = await sshClient.exec(command);
|
||||
if (response.code != 0) {
|
||||
throw new GrpcError(
|
||||
grpc.status.UNKNOWN,
|
||||
`error setting ownership on dataset: ${JSON.stringify(response)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// set acls
|
||||
|
|
@ -739,6 +753,12 @@ class ControllerZfsSshBaseDriver extends CsiBaseDriver {
|
|||
|
||||
driver.ctx.logger.verbose("set acl command: %s", command);
|
||||
response = await sshClient.exec(command);
|
||||
if (response.code != 0) {
|
||||
throw new GrpcError(
|
||||
grpc.status.UNKNOWN,
|
||||
`error setting acl on dataset: ${JSON.stringify(response)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1393,28 +1393,31 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
|||
switch (driverShareType) {
|
||||
case "iscsi":
|
||||
const isScale = await this.getIsScale();
|
||||
let command;
|
||||
let reload = false;
|
||||
if (isScale) {
|
||||
this.ctx.logger.verbose("FreeNAS reloading scst");
|
||||
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)}`
|
||||
);
|
||||
}
|
||||
command = sshClient.buildCommand("systemctl", ["reload", "scst"]);
|
||||
reload = true;
|
||||
} else {
|
||||
this.ctx.logger.verbose("FreeNAS reloading ctld");
|
||||
response = await sshClient.exec(
|
||||
sshClient.buildCommand("/etc/rc.d/ctld", ["reload"])
|
||||
command = sshClient.buildCommand("/etc/rc.d/ctld", ["reload"]);
|
||||
reload = true;
|
||||
}
|
||||
|
||||
if (reload) {
|
||||
if (this.getSudoEnabled()) {
|
||||
command = (await this.getSudoPath()) + " " + command;
|
||||
}
|
||||
|
||||
this.ctx.logger.verbose(
|
||||
"FreeNAS reloading iscsi daemon: %s",
|
||||
command
|
||||
);
|
||||
|
||||
response = await sshClient.exec(command);
|
||||
if (response.code != 0) {
|
||||
throw new GrpcError(
|
||||
grpc.status.UNKNOWN,
|
||||
`error reloading ctld: ${JSON.stringify(response)}`
|
||||
`error reloading iscsi daemon: ${JSON.stringify(response)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue