Merge pull request #68000 from zetaab/removerun

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

backport https://github.com/kubernetes/cloud-provider-openstack/pull/43

Backporting https://github.com/kubernetes/cloud-provider-openstack/pull/43

@dims @FengyunPan2 

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-08-29 10:58:43 -07:00 committed by GitHub
commit 6ea8e3d693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,7 +106,7 @@ func (i *Instances) NodeAddressesByProviderID(ctx context.Context, providerID st
return addresses, nil return addresses, nil
} }
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. // InstanceExistsByProviderID returns true if the instance with the given provider id still exist.
// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. // If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) { func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) {
instanceID, err := instanceIDFromProviderID(providerID) instanceID, err := instanceIDFromProviderID(providerID)
@ -114,7 +114,7 @@ func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID s
return false, err return false, err
} }
server, err := servers.Get(i.compute, instanceID).Extract() _, err = servers.Get(i.compute, instanceID).Extract()
if err != nil { if err != nil {
if isNotFound(err) { if isNotFound(err) {
return false, nil return false, nil
@ -122,11 +122,6 @@ func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID s
return false, err return false, err
} }
if server.Status != "ACTIVE" {
glog.Warningf("the instance %s is not active", instanceID)
return false, nil
}
return true, nil return true, nil
} }