Skip to content

Commit

Permalink
fix(csi): Add node info to failed mount logging. Make csi-plugin moun…
Browse files Browse the repository at this point in the history
…t of host root conformant to standard and ns utils

Signed-off-by: James Munson <james.munson@suse.com>
  • Loading branch information
james-munson committed Mar 29, 2024
1 parent ae1d991 commit 124c53b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion csi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func NewPluginDeployment(namespace, serviceAccount, nodeDriverRegistrarImage, li
},
{
Name: "host",
MountPath: "/rootfs", // path is required for namespaced mounter
MountPath: "/host",
MountPropagation: &MountPropagationBidirectional,
},
{
Expand Down
12 changes: 12 additions & 0 deletions csi/node_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"github.com/longhorn/longhorn-manager/csi/crypto"
"github.com/longhorn/longhorn-manager/datastore"

lhns "github.com/longhorn/go-common-libs/ns"

longhornclient "github.com/longhorn/longhorn-manager/client"
longhorn "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2"
)
Expand Down Expand Up @@ -280,6 +282,16 @@ func (ns *NodeServer) nodeStageSharedVolume(volumeID, shareEndpoint, targetPath
if err == nil {
return nil
}
// Still failed. Log with mounting node and kernel version for possible troubleshooting. Don't step on actual mount error.
kernelRelease, err1 := lhns.GetKernelRelease()
if err1 != nil {
kernelRelease = err1.Error()
}
osDistro, err2 := lhns.GetOSDistro()
if err2 != nil {
osDistro = err2.Error()
}
log.WithError(err).Warnf("Failed to mount volume %v on node %s with kernel release %s, os distro %s", volumeID, ns.nodeID, kernelRelease, osDistro)
}
return status.Error(codes.Internal, err.Error())
}
Expand Down

0 comments on commit 124c53b

Please sign in to comment.