Skip to content
  • Christos Stavrakakis's avatar
    Create public NIC when creating VM · dc1554e4
    Christos Stavrakakis authored
    Until now, a server's public NetworkInterface was not created in the DB
    until the arrival of the message from Ganeti hooks. However, the IPv4
    address of the NIC is reserved before sending the OP_INSTANCE_CREATE
    job to Ganeti.
    
    This drawback of this approach is that if the Ganeti hooks never run
    (building ERROR), Cyclades will never associate the IPv4 address with
    a machine and therefore this address will never be released.
    
    This commit fixes this issue by creating the VM's public NIC in DB when
    creating the server. Also the NetworkInterface model is extended with
    a 'state' field to indicate if the NIC is active or still building.
    Finally, the corresponding API calls are modified in order to return
    only 'ACTIVE' NICs.
    dc1554e4