Revision 129b94d5

b/snf-cyclades-app/conf/20-snf-cyclades-app-backend.conf
41 41
#BACKEND_ALLOCATOR_MODULE = "synnefo.logic.allocators.default_allocator"
42 42
## Refresh backend statistics timeout, in minutes, used in backend allocation
43 43
#BACKEND_REFRESH_MIN = 15
44
#
45
## Maximum number of NICs per Ganeti instance. This value must be less or equal
46
## than 'max:nic-count' option of Ganeti's ipolicy.
47
#GANETI_MAX_NICS_PER_INSTANCE = 8
b/snf-cyclades-app/synnefo/app_settings/default/backend.py
41 41
BACKEND_ALLOCATOR_MODULE = "synnefo.logic.allocators.default_allocator"
42 42
# Refresh backend statistics timeout, in minutes, used in backend allocation
43 43
BACKEND_REFRESH_MIN = 15
44

  
45
# Maximum number of NICs per Ganeti instance. This value must be less or equal
46
# than 'max:nic-count' option of Ganeti's ipolicy.
47
GANETI_MAX_NICS_PER_INSTANCE = 8
b/snf-cyclades-app/synnefo/logic/servers.py
422 422

  
423 423
@transaction.commit_on_success
424 424
def create_port(*args, **kwargs):
425
    vm = kwargs.get("machine", None)
426
    if vm is None and len(args) >= 3:
427
        vm = args[2]
428
    if vm is not None:
429
        if vm.nics.count() == settings.GANETI_MAX_NICS_PER_INSTANCE:
430
            raise faults.BadRequest("Maximum ports per server limit reached")
425 431
    return _create_port(*args, **kwargs)
426 432

  
427 433

  
......
551 557
    else:
552 558
        # Else just connect to the networks that the user defined
553 559
        ports = create_ports_for_request(user_id, networks)
554
    return forced_ports + ports
560
    total_ports = forced_ports + ports
561
    if len(total_ports) > settings.GANETI_MAX_NICS_PER_INSTANCE:
562
        raise faults.BadRequest("Maximum ports per server limit reached")
563
    return total_ports
555 564

  
556 565

  
557 566
def create_ports_for_setting(user_id, category):

Also available in: Unified diff