Revision 129b94d5 snf-cyclades-app/synnefo/logic/servers.py
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