code: func (l VirtualDeviceList) newUnitNumber(c types.BaseVirtualController) int32 {
  	units := make([]bool, 30)
  
  	switch sc := c.(type) {
  	case types.BaseVirtualSCSIController:
  		//  The SCSI controller sits on its own bus
  		units[sc.GetVirtualSCSIController().ScsiCtlrUnitNumber] = true
  	}
  
  	key := c.GetVirtualController().Key
  
  	for _, device := range l {
  		d := device.GetVirtualDevice()
  
  		if d.ControllerKey == key && d.UnitNumber != nil {
  			units[int(*d.UnitNumber)] = true
  		}
  	}
  
  	for unit, used := range units {
  		if !used {
  			return int32(unit)
  		}
  	}
  
  	return -1
  }
docs: // newUnitNumber returns the unit number to use for attaching a new device to the given controller.