Revision ba6ad346 snf-cyclades-app/synnefo/logic/servers.py
b/snf-cyclades-app/synnefo/logic/servers.py | ||
---|---|---|
39 | 39 |
from django.conf import settings |
40 | 40 |
from synnefo import quotas |
41 | 41 |
from synnefo.api import util |
42 |
from synnefo.logic import backend, ips |
|
42 |
from synnefo.logic import backend, ips, utils
|
|
43 | 43 |
from synnefo.logic.backend_allocator import BackendAllocator |
44 | 44 |
from synnefo.db.models import (NetworkInterface, VirtualMachine, |
45 | 45 |
VirtualMachineMetadata, IPAddressLog, Network) |
... | ... | |
170 | 170 |
# Allocate server to a Ganeti backend |
171 | 171 |
use_backend = allocate_new_server(userid, flavor) |
172 | 172 |
|
173 |
utils.check_name_length(name, VirtualMachine.VIRTUAL_MACHINE_NAME_LENGTH, |
|
174 |
"Server name is too long") |
|
175 |
|
|
173 | 176 |
# Create the ports for the server |
174 | 177 |
ports = create_instance_ports(userid, networks) |
175 | 178 |
|
... | ... | |
453 | 456 |
raise faults.Conflict("Cannot create port while network %s is in" |
454 | 457 |
" 'SNF:DRAINED' status" % network.id) |
455 | 458 |
|
459 |
utils.check_name_length(name, NetworkInterface.NETWORK_IFACE_NAME_LENGTH, |
|
460 |
"Port name is too long") |
|
461 |
|
|
456 | 462 |
ipaddress = None |
457 | 463 |
if use_ipaddress is not None: |
458 | 464 |
# Use an existing IPAddress object. |
Also available in: Unified diff