mirror of https://github.com/k3s-io/k3s
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
commit
93c9b05bc9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue