Commit 14dcecce authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Do not allow any action on 'ERROR' vms

Do not allow any action, other than 'DESTROY' in servers that are in
'ERROR' state. If the server is in 'ERROR' state then the corresponding
Ganeti instance may not exist, so all actions will fail.
parent 3dab7faa
......@@ -40,7 +40,10 @@ def validate_server_action(vm, action):
# Check if action can be performed to VM's operstate
operstate = vm.operstate
if operstate == "BUILD" and action != "BUILD":
if operstate == "ERROR":
raise faults.BadRequest("Can not perform '%s' action while server is"
" in 'ERROR' state." % action)
elif operstate == "BUILD" and action != "BUILD":
raise faults.BuildInProgress("Server '%s' is being build." % vm.id)
elif (action == "START" and operstate != "STOPPED") or\
(action == "STOP" and operstate != "STARTED") or\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment