diff --git a/app/cmd/start.go b/app/cmd/start.go index 94dfe0127..bdf49ff42 100644 --- a/app/cmd/start.go +++ b/app/cmd/start.go @@ -3,7 +3,6 @@ package cmd import ( "context" "crypto/tls" - "fmt" "net" "net/http" _ "net/http/pprof" // for runtime profiling @@ -189,7 +188,7 @@ func start(c *cli.Context) (err error) { debugHandler := http.DefaultServeMux logrus.Infof("Debug pprof server listening on %s", debugAddress) if err := http.ListenAndServe(debugAddress, debugHandler); err != nil && err != http.ErrServerClosed { - logrus.Errorf(fmt.Sprintf("ListenAndServe: %s", err)) + logrus.Errorf("ListenAndServe: %s", err) } }() diff --git a/pkg/proxy/backup.go b/pkg/proxy/backup.go index aadbc8077..91f4b8a7d 100644 --- a/pkg/proxy/backup.go +++ b/pkg/proxy/backup.go @@ -28,7 +28,7 @@ import ( func (p *Proxy) CleanupBackupMountPoints(ctx context.Context, req *emptypb.Empty) (resp *emptypb.Empty, err error) { if err := backupstore.CleanUpAllMounts(); err != nil { - return &emptypb.Empty{}, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to unmount all mount points").Error()) + return &emptypb.Empty{}, grpcstatus.Errorf(grpccodes.Internal, "failed to unmount all mount points: %v", err) } return &emptypb.Empty{}, nil } @@ -48,7 +48,7 @@ func (p *Proxy) SnapshotBackup(ctx context.Context, req *rpc.EngineSnapshotBacku credential, err := butil.GetBackupCredential(req.BackupTarget) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.InvalidArgument, errors.Wrapf(err, "failed to get backup credential").Error()) + return nil, grpcstatus.Errorf(grpccodes.InvalidArgument, "failed to get backup credential: %v", err) } labels := getLabels(req.Labels) @@ -93,7 +93,7 @@ func (ops V1DataEngineProxyOps) SnapshotBackup(ctx context.Context, req *rpc.Eng func (ops V2DataEngineProxyOps) SnapshotBackup(ctx context.Context, req *rpc.EngineSnapshotBackupRequest, credential map[string]string, labels []string) (resp *rpc.EngineSnapshotBackupProxyResponse, err error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() @@ -223,7 +223,7 @@ func (ops V1DataEngineProxyOps) SnapshotBackupStatus(ctx context.Context, req *r func (ops V2DataEngineProxyOps) SnapshotBackupStatus(ctx context.Context, req *rpc.EngineSnapshotBackupStatusRequest) (resp *rpc.EngineSnapshotBackupStatusProxyResponse, err error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() @@ -257,7 +257,7 @@ func (p *Proxy) BackupRestore(ctx context.Context, req *rpc.EngineBackupRestoreR credential, err := butil.GetBackupCredential(req.Target) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.InvalidArgument, errors.Wrapf(err, "failed to get backup credential").Error()) + return nil, grpcstatus.Errorf(grpccodes.InvalidArgument, "failed to get backup credential: %v", err) } resp = &rpc.EngineBackupRestoreProxyResponse{ @@ -297,7 +297,7 @@ func (ops V1DataEngineProxyOps) BackupRestore(ctx context.Context, req *rpc.Engi func (ops V2DataEngineProxyOps) BackupRestore(ctx context.Context, req *rpc.EngineBackupRestoreRequest, credential map[string]string) error { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() diff --git a/pkg/proxy/replica.go b/pkg/proxy/replica.go index f7d50b129..6a19c8ebe 100644 --- a/pkg/proxy/replica.go +++ b/pkg/proxy/replica.go @@ -73,7 +73,7 @@ func (ops V1DataEngineProxyOps) ReplicaAdd(ctx context.Context, req *rpc.EngineR func (ops V2DataEngineProxyOps) ReplicaAdd(ctx context.Context, req *rpc.EngineReplicaAddRequest) (resp *emptypb.Empty, err error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() @@ -335,7 +335,7 @@ func (ops V1DataEngineProxyOps) ReplicaRemove(ctx context.Context, req *rpc.Engi func (ops V2DataEngineProxyOps) ReplicaRemove(ctx context.Context, req *rpc.EngineReplicaRemoveRequest) (*emptypb.Empty, error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() diff --git a/pkg/proxy/snapshot.go b/pkg/proxy/snapshot.go index e8f7f5791..343792950 100644 --- a/pkg/proxy/snapshot.go +++ b/pkg/proxy/snapshot.go @@ -56,7 +56,7 @@ func (ops V1DataEngineProxyOps) VolumeSnapshot(ctx context.Context, req *rpc.Eng func (ops V2DataEngineProxyOps) VolumeSnapshot(ctx context.Context, req *rpc.EngineVolumeSnapshotRequest) (resp *rpc.EngineVolumeSnapshotProxyResponse, err error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() @@ -299,7 +299,7 @@ func (ops V1DataEngineProxyOps) SnapshotRevert(ctx context.Context, req *rpc.Eng func (ops V2DataEngineProxyOps) SnapshotRevert(ctx context.Context, req *rpc.EngineSnapshotRevertRequest) (resp *emptypb.Empty, err error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close() @@ -344,7 +344,7 @@ func (ops V1DataEngineProxyOps) SnapshotPurge(ctx context.Context, req *rpc.Engi func (ops V2DataEngineProxyOps) SnapshotPurge(ctx context.Context, req *rpc.EngineSnapshotPurgeRequest) (resp *emptypb.Empty, err error) { c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) + return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get SPDK client from engine address %v: %v", req.ProxyEngineRequest.Address, err) } defer c.Close()