vsphere/internal/virtualdevice/virtual_machine_device_subresource.go
func findVirtualDeviceInListControllerSelectFunc(ct string, cb int) func(types.BaseVirtualDevice) bool {
	return func(device types.BaseVirtualDevice) bool {
		switch ct {
		case SubresourceControllerTypeIDE:
			if _, ok := device.(*types.VirtualIDEController); !ok {
				return false
			}
		case SubresourceControllerTypeSATA:
			if _, ok := device.(*types.VirtualAHCIController); !ok {
				return false
			}
		case SubresourceControllerTypeSCSI:
			if _, ok := device.(types.BaseVirtualSCSIController); !ok {
				return false
			}
		case SubresourceControllerTypePCI:
			if _, ok := device.(*types.VirtualPCIController); !ok {
				return false
			}
		}
		vc := device.(types.BaseVirtualController).GetVirtualController()
		if vc.BusNumber == int32(cb) {
			return true
		}
		return false
	}
}
func findVirtualDeviceInListControllerSelectFunc(ct string, cb int) func(types.BaseVirtualDevice) bool {
	return func(device types.BaseVirtualDevice) bool {
		switch ct {
		case SubresourceControllerTypeIDE:
			if _, ok := device.(*types.VirtualIDEController); !ok {
				return false
			}
		case SubresourceControllerTypeSATA:
			if _, ok := device.(*types.VirtualAHCIController); !ok {
				return false
			}
		case SubresourceControllerTypeSCSI:
			if _, ok := device.(types.BaseVirtualSCSIController); !ok {
				return false
			}
		case SubresourceControllerTypePCI:
			if _, ok := device.(*types.VirtualPCIController); !ok {
				return false
			}
		}
		vc := device.(types.BaseVirtualController).GetVirtualController()
		if vc.BusNumber == int32(cb) {
			return true
		}
		return false
	}
}
// findVirtualDeviceInListControllerSelectFunc returns a function that can be
// used with VirtualDeviceList.Select to locate a controller device based on
// the criteria that we have laid out.