Revision b2272468 snf-cyclades-app/synnefo/api/servers.py
b/snf-cyclades-app/synnefo/api/servers.py | ||
---|---|---|
351 | 351 |
if network is None: |
352 | 352 |
# Allocate IP from public network |
353 | 353 |
(network, address) = util.get_public_ip(backend) |
354 |
nic = {'ip': address, 'network': network.backend_id} |
|
355 | 354 |
else: |
356 | 355 |
address = util.get_network_free_address(network) |
357 | 356 |
|
... | ... | |
370 | 369 |
# Create VM's public NIC. Do not wait notification form ganeti hooks to |
371 | 370 |
# create this NIC, because if the hooks never run (e.g. building error) |
372 | 371 |
# the VM's public IP address will never be released! |
373 |
NetworkInterface.objects.create(machine=vm, network=network, index=0, |
|
374 |
ipv4=address, state="BUILDING") |
|
372 |
nic = NetworkInterface.objects.create(machine=vm, network=network, |
|
373 |
index=0, ipv4=address, |
|
374 |
state="BUILDING") |
|
375 | 375 |
|
376 | 376 |
# Also we must create the VM metadata in the same transaction. |
377 | 377 |
for key, val in metadata.items(): |
Also available in: Unified diff