bug #4496: Do not allow to change ownership for VMs in DONE

(cherry picked from commit 36d48bfe1f)
This commit is contained in:
Ruben S. Montero committed 2016-06-01 16:11:18 +02:00
1 parent 026498ec26
commit 2730fdd3bc
1 file changed
+12 -1
+12 -1
View File
@@ -51,7 +51,18 @@ PoolObjectSQL * RequestManagerChown::get_and_quota(
if (auth_object == PoolObjectSQL::VM)
{
tmpl = (static_cast<VirtualMachine*>(object))->clone_template();
VirtualMachine * vm = static_cast<VirtualMachine*>(object);
if ( vm->get_state() == VirtualMachine::DONE )
{
vm->unlock();
att.resp_msg = "Could not change VM ownership, wrong state";
failure_response(ACTION, att);
return 0;
}
tmpl = vm->clone_template();
qtype = Quotas::VIRTUALMACHINE;
}
else if (auth_object == PoolObjectSQL::IMAGE)