def _get_bus_number_for_scsi_controller(devices):
    # Every SCSI controller will take a unique bus number
    taken = [dev.busNumber for dev in devices if _is_scsi_controller(dev)]
    # The max bus number for SCSI controllers is 3
    for i in range(constants.SCSI_MAX_CONTROLLER_NUMBER):
        if i not in taken:
            return i
    msg = _('Only %d SCSI controllers are allowed to be '
            'created on this instance.') % constants.SCSI_MAX_CONTROLLER_NUMBER
    raise vexc.VMwareDriverException(msg)
Return usable bus number when create new SCSI controller.
dataset/ETHPy150Open openstack/nova/nova/virt/vmwareapi/vm_util.py/_get_bus_number_for_scsi_controller