Skip to content

Driver uses sg_utils host commands; breaks under debian trixie #824

Description

@bh-tt

We recently upgraded a cluster to debian trixie, which resulted in this CSI driver failing to mount any volumes, with a cryptic 'volume ID not found' message. We managed to trace the problem to the use of the sg_inq command (installed on the host) in the csi-node daemonset, whose default output changed with the trixie upgrade.

We applied the following patch to the driver to get it to work again (at least, mounting and unmounting worked again):

diff --git a/Dockerfile-csi-node b/Dockerfile-csi-node
index 0f3504d1..bf829c7b 100644
--- a/Dockerfile-csi-node
+++ b/Dockerfile-csi-node
@@ -69,6 +69,7 @@ RUN    ln -s /chroot/chroot-host-wrapper.sh /chroot/blkid \
     && ln -s /chroot/chroot-host-wrapper.sh /chroot/nvme \
     && ln -s /chroot/chroot-host-wrapper.sh /chroot/resize2fs \
     && ln -s /chroot/chroot-host-wrapper.sh /chroot/sg_inq \
+    && ln -s /chroot/chroot-host-wrapper.sh /chroot/sg_vpd \
     && ln -s /chroot/chroot-host-wrapper.sh /chroot/sg_map \
     && ln -s /chroot/chroot-host-wrapper.sh /chroot/umount \
     && ln -s /chroot/chroot-host-wrapper.sh /chroot/xfs_growfs
diff --git a/node/pkg/driver/device_connectivity/device_connectivity_helper_scsigeneric.go b/node/pkg/driver/device_connectivity/device_connectivity_helper_scsigeneric.go
index f41fe5cc..484b3697 100644
--- a/node/pkg/driver/device_connectivity/device_connectivity_helper_scsigeneric.go
+++ b/node/pkg/driver/device_connectivity/device_connectivity_helper_scsigeneric.go
@@ -581,13 +581,13 @@ func (o OsDeviceConnectivityHelperGeneric) GetWwnByScsiInq(dev string) (string,
                        associated with the target port
                          Relative target port: 0xd22
        */
-       sgInqCmd := "sg_inq"
+       sgInqCmd := "sg_vpd"
 
        if err := o.Executer.IsExecutable(sgInqCmd); err != nil {
                return "", err
        }
 
-       args := []string{"-p", "0x83", dev}
+       args := []string{"--long", "-p", "0x83", dev}
        // add timeout in case the call never comes back.
        logger.Debugf("Calling [%s] with timeout", sgInqCmd)
        outputBytes, err := o.Executer.ExecuteWithTimeout(TimeOutSgInqCmd, sgInqCmd, args)

Versions:
old:

sg_inq --version
Version string: 2.10 20210328
$ sg_vpd --version
version: 1.63 20210328

new:

$ sg_inq --version
Version string: 2.48 20230606
$ sg_vpd --version
version: 1.96 20230622

However, we probably cannot apply this patch to the driver as a whole, since this is dependent on which version of sg_utils is installed on the kubernetes node.

I see a few paths forward:

  • detect the version of sg_utils on the host, and switch the command based on that -> how to detect the version robustly?
  • consider installing sg_utils and the other host commands used into the image, so this driver can function and upgrade these packages independent of the host

I think most CSI drivers choose the second option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions