vsphere/internal/virtualdevice/virtual_machine_device_subresource.go
func ReadSCSIBusType(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] ReadSCSIBusType: SCSI controller layout for first %d controllers: %s", count, scsiControllerListString(ctlrs))
	if ctlrs[0] == nil {
		return subresourceControllerTypeUnknown
	}
	last := l.Type(ctlrs[0].(types.BaseVirtualDevice))
	for _, ctlr := range ctlrs[1:] {
		if ctlr == nil || l.Type(ctlr.(types.BaseVirtualDevice)) != last {
			return subresourceControllerTypeMixed
		}
	}
	return last
}
func ReadSCSIBusType(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] ReadSCSIBusType: SCSI controller layout for first %d controllers: %s", count, scsiControllerListString(ctlrs))
	if ctlrs[0] == nil {
		return subresourceControllerTypeUnknown
	}
	last := l.Type(ctlrs[0].(types.BaseVirtualDevice))
	for _, ctlr := range ctlrs[1:] {
		if ctlr == nil || l.Type(ctlr.(types.BaseVirtualDevice)) != last {
			return subresourceControllerTypeMixed
		}
	}
	return last
}
func ReadSCSIBusType ( 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 ( " " , count , scsiControllerListString ( ctlrs ) ) if ctlrs [ 0 ] == nil { return subresourceControllerTypeUnknown } last := l . Type ( ctlrs [ 0 ] . ( types . BaseVirtualDevice ) ) for _ , ctlr := range ctlrs [ 1 : ] { if ctlr == nil || l . Type ( ctlr . ( types . BaseVirtualDevice ) ) != last { return subresourceControllerTypeMixed } } return last }
// ReadSCSIBusType checks the SCSI bus state and returns a device type
// depending on if all controllers are one specific kind or not. Only the first
// number of controllers specified by count are checked.
ReadSCSIBusType checks the SCSI bus state and returns a device type depending on if all controllers are one specific kind or not . Only the first number of controllers specified by count are checked .