From 5fc38a14bc6e622da7c3b5068b8058693e3be492 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 24 Mar 2023 09:34:40 +0000 Subject: [PATCH] chore: refine blobfuse mount logs --- pkg/blob/nodeserver.go | 11 ++++++----- pkg/blobfuse-proxy/server/server.go | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/blob/nodeserver.go b/pkg/blob/nodeserver.go index 9f544c696..02d47fb84 100644 --- a/pkg/blob/nodeserver.go +++ b/pkg/blob/nodeserver.go @@ -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) @@ -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) @@ -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() diff --git a/pkg/blobfuse-proxy/server/server.go b/pkg/blobfuse-proxy/server/server.go index 50dfa431e..bf89e3f12 100644 --- a/pkg/blobfuse-proxy/server/server.go +++ b/pkg/blobfuse-proxy/server/server.go @@ -65,12 +65,11 @@ 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 @@ -78,9 +77,10 @@ func (server *MountServer) MountAzureBlob(ctx context.Context, 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, " ")...) }