Skip to content

Commit

Permalink
Merge pull request #855 from k8s-infra-cherrypick-robot/cherry-pick-8…
Browse files Browse the repository at this point in the history
…54-to-release-1.19

[release-1.19] chore: refine blobfuse mount logs
  • Loading branch information
andyzhangx authored Mar 27, 2023
2 parents b313e4f + 5fc38a1 commit 2b26492
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions pkg/blob/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu
}

func (d *Driver) mountBlobfuseWithProxy(args string, protocol string, authEnv []string) (string, error) {
klog.V(2).Infof("mouting using blobfuse proxy")
var resp *mount_azure_blob.MountAzureBlobResponse
var output string
connectionTimout := time.Duration(d.blobfuseProxyConnTimout) * time.Second
ctx, cancel := context.WithTimeout(context.Background(), connectionTimout)
defer cancel()
klog.V(2).Infof("start connecting to blobfuse proxy, protocol: %s, args: %s", protocol, args)
conn, err := grpc.DialContext(ctx, d.blobfuseProxyEndpoint, grpc.WithInsecure(), grpc.WithBlock())
if err == nil {
mountClient := NewMountClient(conn)
Expand All @@ -155,7 +155,7 @@ func (d *Driver) mountBlobfuseWithProxy(args string, protocol string, authEnv []
Protocol: protocol,
AuthEnv: authEnv,
}
klog.V(2).Infof("calling BlobfuseProxy: MountAzureBlob function")
klog.V(2).Infof("begin to mount with blobfuse proxy, protocol: %s, args: %s", protocol, args)
resp, err = mountClient.service.MountAzureBlob(context.TODO(), &mountreq)
if err != nil {
klog.Error("GRPC call returned with an error:", err)
Expand All @@ -168,15 +168,16 @@ func (d *Driver) mountBlobfuseWithProxy(args string, protocol string, authEnv []
func (d *Driver) mountBlobfuseInsideDriver(args string, protocol string, authEnv []string) (string, error) {
var cmd *exec.Cmd

klog.V(2).Infof("mounting blobfuse inside driver")
mountLog := "mount inside driver with"
if protocol == Fuse2 {
klog.V(2).Infof("using blobfuse V2 to mount")
mountLog += " v2"
args = "mount " + args
cmd = exec.Command("blobfuse2", strings.Split(args, " ")...)
} else {
klog.V(2).Infof("using blobfuse V1 to mount")
mountLog += " v1"
cmd = exec.Command("blobfuse", strings.Split(args, " ")...)
}
klog.V(2).Infof("%s, protocol: %s, args: %s", mountLog, protocol, args)

cmd.Env = append(os.Environ(), authEnv...)
output, err := cmd.CombinedOutput()
Expand Down
6 changes: 3 additions & 3 deletions pkg/blobfuse-proxy/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ func (server *MountServer) MountAzureBlob(ctx context.Context,
args := req.GetMountArgs()
authEnv := req.GetAuthEnv()
protocol := req.GetProtocol()
klog.V(2).Infof("received mount request: Protocol: %s, server default blobfuseVersion: %v, Mounting with args %v \n", protocol, server.blobfuseVersion, args)
klog.V(2).Infof("received mount request: protocol: %s, server default blobfuseVersion: %v, mount args %v \n", protocol, server.blobfuseVersion, args)

var cmd *exec.Cmd
var result mount_azure_blob.MountAzureBlobResponse
if protocol == blob.Fuse2 || server.blobfuseVersion == BlobfuseV2 {
klog.V(2).Infof("using blobfuse V2 to mount")
args = "mount " + args
// add this arg for blobfuse2 to solve the issue:
// https://github.com/Azure/azure-storage-fuse/issues/1015
if !strings.Contains(args, "--ignore-open-flags") {
klog.V(2).Infof("append --ignore-open-flags=true to mount args")
args = args + " " + "--ignore-open-flags=true"
}
klog.V(2).Infof("mount with v2, protocol: %s, args: %s", protocol, args)
cmd = exec.Command("blobfuse2", strings.Split(args, " ")...)
} else {
klog.V(2).Infof("using blobfuse V1 to mount")
klog.V(2).Infof("mount with v1, protocol: %s, args: %s", protocol, args)
cmd = exec.Command("blobfuse", strings.Split(args, " ")...)
}

Expand Down

0 comments on commit 2b26492

Please sign in to comment.