Merge pull request #57994 from karataliu/azure_vm_cache_bug

Automatic merge from submit-queue (batch tested with PRs 57552, 57994). 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>.

Fix vm cache in concurrent case in azure_util.go

**What this PR does / why we need it**:
Fix a bug in azure vm cache. In case two callers call 'getVirtualMachine', if the second caller sees non-empty request.VM, it should return that value, instead of the default 'vm' variable.

**Which issue(s) this PR fixes**
Follow up of #57031

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-01-09 06:09:32 -08:00 committed by GitHub
commit 4264efd36e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,7 +112,7 @@ func (az *Cloud) getVirtualMachine(nodeName types.NodeName) (vm compute.VirtualM
request.vm = &vm
}
return vm, nil
return *request.vm, nil
}
glog.V(6).Infof("getVirtualMachine hits cache for(%s)", vmName)