mirror of https://github.com/k3s-io/k3s
Merge pull request #62220 from vmware/detach_bug_fix
Automatic merge from submit-queue (batch tested with PRs 62568, 62220, 62743, 62751, 62753). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. [vSphere Cloud Provider] Fix detach disk when VM is not found **What this PR does / why we need it**: When VM is deleted from VC inventory and detach request is issued detach returns error since VM cannot be found. In this scenario, detach should return no error if VM is not found. This PR fixes this. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #61707. **Special notes for your reviewer**: **Release note**: ```release-note None ``` @kubernetes/vmwarepull/8/head
commit
93d89609cb
|
@ -775,6 +775,11 @@ func (vs *VSphere) DetachDisk(volPath string, nodeName k8stypes.NodeName) error
|
|||
defer cancel()
|
||||
vsi, err := vs.getVSphereInstance(nodeName)
|
||||
if err != nil {
|
||||
// If node doesn't exist, disk is already detached from node.
|
||||
if err == vclib.ErrNoVMFound {
|
||||
glog.Infof("Node %q does not exist, disk %s is already detached from node.", convertToString(nodeName), volPath)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
// Ensure client is logged in and session is valid
|
||||
|
|
Loading…
Reference in New Issue