Unverified Commit 93d89609 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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/vmware
parents edee03ed 23b6b46c
...@@ -775,6 +775,11 @@ func (vs *VSphere) DetachDisk(volPath string, nodeName k8stypes.NodeName) error ...@@ -775,6 +775,11 @@ func (vs *VSphere) DetachDisk(volPath string, nodeName k8stypes.NodeName) error
defer cancel() defer cancel()
vsi, err := vs.getVSphereInstance(nodeName) vsi, err := vs.getVSphereInstance(nodeName)
if err != nil { 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 return err
} }
// Ensure client is logged in and session is valid // Ensure client is logged in and session is valid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment