Skip to content
  • Christos Stavrakakis's avatar
    cyclades: Implement lazy networks · 8aff3951
    Christos Stavrakakis authored
    Implement "lazy networks", which are not created to all Ganeti backends
    upon creation, but only when an instance that resides in a Ganeti is
    connected to that network.
    
    Update 'create_network' to create the Network object in DB without
    creating network in Ganeti, or correspoding BackendNetwork entries. The
    state of the Network becomes 'ACTIVE' upon creation, instead of
    'PENDING' that was until now. Also, update 'delete_network' function to
    delete the network only from the backends that it is not in 'DELETED'
    state. The state of the network will become 'DELETED' only when all
    corresponding backend networks become 'DELETED' (including offline
    backends).
    
    Extend code that connects a VM to a network to check if the network
    already exists and is in 'ACTIVE' state in the Ganeti backend that hosts
    the VM.  If not, it will create the network and then connect the VM
    (using Ganeti chained-jobs to ensure correct ordering of jobs).
    
    Update 'reconcile-networks' management command to work with lazy
    networks. Specifically, do not check if private networks exist in all
    backends.
    
    Update 'network-add' management command to create the network in the
    Ganeti, only if a backend is specified.
    
    Finally, when using Ganeti chained-jobs to impose ordering of jobs, do
    not depend only on 'success' of a job, but also on 'error' and 'cancel'.
    This is needed to cover case that a job fails (e.g. create network)
    because the resource already exists.
    8aff3951