Merge pull request #31979 from dagnello/vsphere-cleanup-controller-nil-check

Automatic merge from submit-queue

vSphere Cloud provider null pointer exception

This PR addresses issue #31823.

SelectByType function in govmomi will panic if deviceType is not Array,
Chan, Map, Ptr, or Slice.  Also checking if vmDevices or vm are nil,
there is nothing to cleanup.
pull/6/head
Kubernetes Submit Queue 2016-09-07 23:30:48 -07:00 committed by GitHub
commit 93c9b05bc9
1 changed files with 3 additions and 0 deletions

View File

@ -596,6 +596,9 @@ func getVirtualMachineDevices(cfg *VSphereConfig, ctx context.Context, c *govmom
// Removes SCSI controller which is latest attached to VM.
func cleanUpController(newSCSIController types.BaseVirtualDevice, vmDevices object.VirtualDeviceList, vm *object.VirtualMachine, ctx context.Context) error {
if newSCSIController == nil || vmDevices == nil || vm == nil {
return nil
}
ctls := vmDevices.SelectByType(newSCSIController)
if len(ctls) < 1 {
return ErrNoDevicesFound