fix: archive dir error

This commit is contained in:
andyzhangx 2024-08-07 15:13:02 +00:00
parent 6d84f18d99
commit 433df76e70

View File

@ -25,6 +25,7 @@ import (
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
"golang.org/x/net/context" "golang.org/x/net/context"
@ -235,6 +236,8 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
return nil, status.Errorf(codes.Internal, "failed to mount nfs server: %v", err.Error()) return nil, status.Errorf(codes.Internal, "failed to mount nfs server: %v", err.Error())
} }
defer func() { defer func() {
// make sure archiving is completed before unmounting
time.Sleep(time.Second * 2)
if err = cs.internalUnmount(ctx, nfsVol); err != nil { if err = cs.internalUnmount(ctx, nfsVol); err != nil {
klog.Warningf("failed to unmount nfs server: %v", err.Error()) klog.Warningf("failed to unmount nfs server: %v", err.Error())
} }