• Vangelis Koukis's avatar
    Fix bugs in api/server.py:create_server() · 36cf941d
    Vangelis Koukis authored
    Fix bugs in server creation, in api/server.py:create_server().
    More specifically:
     * Make sure to save() the vm object before calling vm.backend_id
     * Delete the vm instance if the RAPI call fails for any reason
     * Use different variable names for the server name at the API level
       and at the Ganeti backend level
     * Compute a random password *before* the CreateInstance() call to Ganeti
       [not currently used though]
    
    Also patch the VirtualMachine model to safeguard against getting the
    backend_id of a yet-unsaved instance of VirtualMachine.
    36cf941d
models.py 11.7 KB