kubernetes-csi / csi-driver-nfs

This driver allows Kubernetes to access NFS server on Linux node.
Apache License 2.0
765 stars 236 forks source link

fix: remove stale archived volume copy before rename #673

Closed andyzhangx closed 1 month ago

andyzhangx commented 1 month ago

What type of PR is this? /kind bug

What this PR does / why we need it: fix: remove stale archived volume copy before rename

The user might put non-unique spec for subdir:

subDir: ${pvc.metadata.namespace}/${pvc.metadata.name}

Then, os.Rename(internalVolumePath, archivedInternalVolumePath) can fail becaue the destination (archivedInternalVolumePath) already exists. It's safer to remove it before os.Rename().

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix: remove stale archived volume copy before rename
k8s-ci-robot commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/OWNERS)~~ [andyzhangx] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 9040918381

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/nfs/controllerserver.go 1 3 33.33%
<!-- Total: 1 3 33.33% -->
Totals Coverage Status
Change from base Build 9026157020: -0.1%
Covered Lines: 888
Relevant Lines: 1127

💛 - Coveralls