Merge pull request #50280 from FengyunPan/mark-detached-photon

Automatic merge from submit-queue (batch tested with PRs 50280, 52529, 53093, 53108, 53168). 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>.

Mark volume as detached when node does not exist for photon

If node does not exist, node's volumes will be detached
automatically and become available. So mark them detached and
return false without error.
Fix #50266

**Special notes for your reviewer**:
/assign @jingxu97 

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-09-28 14:59:20 -07:00 committed by GitHub
commit 671b488eba

View File

@ -637,6 +637,10 @@ func (pc *PCCloud) DiskIsAttached(pdID string, nodeName k8stypes.NodeName) (bool
}
vmID, err := pc.InstanceID(nodeName)
if err == cloudprovider.InstanceNotFound {
glog.Infof("Instance %q does not exist, disk %s will be detached automatically.", nodeName, pdID)
return false, nil
}
if err != nil {
glog.Errorf("Photon Cloud Provider: pc.InstanceID failed for DiskIsAttached. Error[%v]", err)
return false, err
@ -665,6 +669,11 @@ func (pc *PCCloud) DisksAreAttached(pdIDs []string, nodeName k8stypes.NodeName)
}
vmID, err := pc.InstanceID(nodeName)
if err == cloudprovider.InstanceNotFound {
glog.Infof("Instance %q does not exist, its disks will be detached automatically.", nodeName)
// make all the disks as detached.
return attached, nil
}
if err != nil {
glog.Errorf("Photon Cloud Provider: pc.InstanceID failed for DiskIsAttached. Error[%v]", err)
return attached, err