Skip to content

Commit

Permalink
wrapper script to overcome redirection + sudo behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
  • Loading branch information
travisghansen committed Mar 3, 2024
1 parent 6ada268 commit 57f74ce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ LABEL org.opencontainers.image.url https://github.com/democratic-csi/democratic-
LABEL org.opencontainers.image.licenses MIT

ENV DEBIAN_FRONTEND=noninteractive
ENV DEMOCRATIC_CSI_IS_CONTAINER=true

ARG TARGETPLATFORM
ARG BUILDPLATFORM
Expand Down Expand Up @@ -96,6 +97,9 @@ RUN chmod +x /usr/local/sbin/iscsiadm
ADD docker/multipath /usr/local/sbin
RUN chmod +x /usr/local/sbin/multipath

ADD docker/simple-file-writer /usr/local/bin
RUN chmod +x /usr/local/bin/simple-file-writer

## USE_HOST_MOUNT_TOOLS=1
ADD docker/mount /usr/local/bin/mount
RUN chmod +x /usr/local/bin/mount
Expand Down
3 changes: 3 additions & 0 deletions docker/simple-file-writer
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo ${1} > ${2}
19 changes: 15 additions & 4 deletions src/driver/freenas/ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -2021,11 +2021,22 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
*
* midclt resync_lun_size_for_zvol tank/foo/bar
* works on SCALE only ^
*
*/
command = execClient.buildCommand("sh", [
"-c",
`echo 1 > /sys/kernel/scst_tgt/devices/${kName}/resync_size`,
]);

if (process.env.DEMOCRATIC_CSI_IS_CONTAINER == "true") {
// TODO: syntax fails with sudo
command = execClient.buildCommand("sh", [
"-c",
`echo 1 > /sys/kernel/scst_tgt/devices/${kName}/resync_size`,
]);
} else {
// use the built-in wrapper script that works with sudo
command = execClient.buildCommand("simple-file-writer", [
"1",
`/sys/kernel/scst_tgt/devices/${kName}/resync_size`,
]);
}
reload = true;
} else {
switch (apiVersion) {
Expand Down

0 comments on commit 57f74ce

Please sign in to comment.