Skip to content

Commit acefebf

Browse files
committed
fix: blobfuse mount silent failure issue
mock mount in NodeStageVolume
1 parent b91156a commit acefebf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/blob/nodeserver.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
274274

275275
// set different tmp-path with time info
276276
tmpPath := fmt.Sprintf("%s/%s#%d", "/mnt", volumeID, time.Now().Unix())
277-
args := fmt.Sprintf("%s --tmp-path=%s --container-name=%s", targetPath, tmpPath, containerName)
277+
args := fmt.Sprintf("%s --pre-mount-validate=true --tmp-path=%s --container-name=%s", targetPath, tmpPath, containerName)
278278
for _, opt := range mountOptions {
279279
args = args + " " + opt
280280
}
@@ -283,14 +283,23 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
283283
targetPath, protocol, volumeID, attrib, mountFlags, mountOptions, args, serverAddress)
284284

285285
authEnv = append(authEnv, "AZURE_STORAGE_ACCOUNT="+accountName, "AZURE_STORAGE_BLOB_ENDPOINT="+serverAddress)
286+
if d.enableBlobMockMount {
287+
klog.Warningf("NodeStageVolume: mock mount on volumeID(%s), this is only for TESTING!!!", volumeID)
288+
if err := volumehelper.MakeDir(targetPath); err != nil {
289+
klog.Errorf("MakeDir failed on target: %s (%v)", targetPath, err)
290+
return nil, err
291+
}
292+
return &csi.NodeStageVolumeResponse{}, nil
293+
}
294+
286295
var output string
287296
if d.enableBlobfuseProxy {
288297
output, err = d.mountBlobfuseWithProxy(args, authEnv)
289298
} else {
290299
output, err = d.mountBlobfuseInsideDriver(args, authEnv)
291300
}
292301

293-
if err != nil || strings.Contains(string(output), "Unable to start blobfuse") {
302+
if err != nil {
294303
err = fmt.Errorf("Mount failed with error: %v, output: %v", err, output)
295304
klog.Errorf("%v", err)
296305
notMnt, mntErr := d.mounter.IsLikelyNotMountPoint(targetPath)

0 commit comments

Comments
 (0)