mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #85147 from yutedz/devmgr-rm-contents
Continue removing file in ManagerImpl#removeContents
This commit is contained in:
commit
30e6238795
@ -32,6 +32,7 @@ go_library(
|
||||
"//pkg/util/selinux:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
"//staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1:go_default_library",
|
||||
|
@ -31,6 +31,7 @@ import (
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
errorsutil "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
|
||||
@ -189,6 +190,7 @@ func (m *ManagerImpl) removeContents(dir string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var errs []error
|
||||
for _, name := range names {
|
||||
filePath := filepath.Join(dir, name)
|
||||
if filePath == m.checkpointFile() {
|
||||
@ -204,10 +206,12 @@ func (m *ManagerImpl) removeContents(dir string) error {
|
||||
}
|
||||
err = os.RemoveAll(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
errs = append(errs, err)
|
||||
klog.Errorf("Failed to remove file %s: %v", filePath, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return errorsutil.NewAggregate(errs)
|
||||
}
|
||||
|
||||
// checkpointFile returns device plugin checkpoint file path.
|
||||
|
Loading…
Reference in New Issue
Block a user