Commit cb96da16 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis Committed by Christos Stavrakakis

cyclades: Reject reassign on pending vm action

Use validate_server_action() to make sure a reassign fails when another VM
action is pending.
parent 8c9894c2
......@@ -43,6 +43,10 @@ def validate_server_action(vm, action):
raise faults.BadRequest("Cannot perform '%s' action while there is a"
" pending '%s'." % (action, pending_action))
# Reassigning is permitted in any state
if action == "REASSIGN":
# Check if action can be performed to VM's operstate
operstate = vm.operstate
if operstate == "ERROR":
......@@ -297,6 +297,7 @@ def _resize(vm, flavor):
def reassign(vm, project):
commands.validate_server_action(vm, "REASSIGN")
action_fields = {"to_project": project, "from_project": vm.project}"Reassigning VM %s from project %s to %s",
vm, vm.project, project)
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