From 1d2faf1ac5bc52fcc323e0ccd92d83b2901c117f Mon Sep 17 00:00:00 2001 From: yaqi Date: Tue, 18 Feb 2020 21:01:36 +0800 Subject: [PATCH] Remove old cleanup status before create new pv --- pkg/discovery/discovery.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/discovery/discovery.go b/pkg/discovery/discovery.go index 64d5a2a61..1b90383f9 100644 --- a/pkg/discovery/discovery.go +++ b/pkg/discovery/discovery.go @@ -307,6 +307,13 @@ func (d *Discoverer) discoverVolumesAtPath(class string, config common.MountConf continue } + // remove old cleanup status + _, _, err = d.CleanupTracker.RemoveStatus(pvName, usejob) + if err != nil { + klog.Errorf("expected status exists and fail to remove cleanup status for pv %s", pvName) + continue + } + mountOptions, err := d.getMountOptionsFromStorageClass(class) if err != nil { discoErrors = append(discoErrors, fmt.Errorf("failed to get mount options from storage class %s: %v", class, err))