• Christos Stavrakakis's avatar
    cyclades: Workaround for race condition in Ganeti · 84fcfa69
    Christos Stavrakakis authored
    Workaround for race where OP_INSTANCE_REMOVE starts executing on Ganeti
    before OP_INSTANCE_CREATE. If this is the case, OP_INSTANCE_REMOVE will
    not wait for locks, instead it will fail because the instance has not
    yet be created. Dispatcher will received the failed OP_INSTANCE_REMOVE
    job and will query Ganeti to see if the instance exists. However, if the
    OP_INSTANCE_CREATE has not yet started, the query will return 404, and
    dispatcher will delete the instance from DB and release its IP
    addresses. Following instance creations will fail because the IPv4
    address will be already used in Ganeti.
    
    This commit is a workaround for this issue until OP_INSTANCE_REMOVE
    supports the 'depends' attribute. Until then, the API will raise 409 if
    the job has not yet completed and the intance has not been added to
    Ganeti.
    84fcfa69
backend.py 27.8 KB