vsphere/internal/virtualdevice/virtual_machine_device_subresource.go
func ReadSCSIBusSharing(l object.VirtualDeviceList, count int) string {
	ctlrs := make([]types.BaseVirtualSCSIController, count)
	for _, dev := range l {
		if sc, ok := dev.(types.BaseVirtualSCSIController); ok && sc.GetVirtualSCSIController().BusNumber < int32(count) {
			ctlrs[sc.GetVirtualSCSIController().BusNumber] = sc
		}
	}
	log.Printf("[DEBUG] ReadSCSIBusSharing: SCSI controller layout for first %d controllers: %s", count, scsiControllerListString(ctlrs))
	if ctlrs[0] == nil {
		return subresourceControllerSharingUnknown
	}
	last := ctlrs[0].(types.BaseVirtualSCSIController).GetVirtualSCSIController().SharedBus
	for _, ctlr := range ctlrs[1:] {
		if ctlr == nil || ctlr.(types.BaseVirtualSCSIController).GetVirtualSCSIController().SharedBus != last {
			return subresourceControllerSharingMixed
		}
	}
	return string(last)
}
func ReadSCSIBusSharing(l object.VirtualDeviceList, count int) string {
	ctlrs := make([]types.BaseVirtualSCSIController, count)
	for _, dev := range l {
		if sc, ok := dev.(types.BaseVirtualSCSIController); ok && sc.GetVirtualSCSIController().BusNumber < int32(count) {
			ctlrs[sc.GetVirtualSCSIController().BusNumber] = sc
		}
	}
	log.Printf("[DEBUG] ReadSCSIBusSharing: SCSI controller layout for first %d controllers: %s", count, scsiControllerListString(ctlrs))
	if ctlrs[0] == nil {
		return subresourceControllerSharingUnknown
	}
	last := ctlrs[0].(types.BaseVirtualSCSIController).GetVirtualSCSIController().SharedBus
	for _, ctlr := range ctlrs[1:] {
		if ctlr == nil || ctlr.(types.BaseVirtualSCSIController).GetVirtualSCSIController().SharedBus != last {
			return subresourceControllerSharingMixed
		}
	}
	return string(last)
}
// ReadSCSIBusSharing checks the SCSI bus sharing and returns a sharing type
// depending on if all controllers are one specific kind or not. Only the first
// number of controllers specified by count are checked.