1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-27 10:50:10 +03:00

feature #3383: Fix insert import key inserts

This commit is contained in:
Ruben S. Montero 2015-02-06 00:22:09 +01:00
parent cf33e0552c
commit 6d02c874a7

View File

@ -327,7 +327,7 @@ int VirtualMachinePool::allocate (
vm->user_obj_template->get("IMPORT_VM_ID", deploy_id);
if ( _submit_on_hold == true || on_hold || !deploy_id.empty())
if ( _submit_on_hold == true || on_hold )
{
vm->state = VirtualMachine::HOLD;
}
@ -336,11 +336,17 @@ int VirtualMachinePool::allocate (
vm->state = VirtualMachine::PENDING;
}
if (insert_index(deploy_id, -1, false) == -1) //Mark import as in progress
if (!deploy_id.empty())
{
error_str = "Virtual Machine " + deploy_id + " already imported.";
return -1;
vm->state = VirtualMachine::HOLD;
if (insert_index(deploy_id, -1, false) == -1) //Set import in progress
{
error_str = "Virtual Machine " + deploy_id + " already imported.";
return -1;
}
}
// ------------------------------------------------------------------------
// Insert the Object in the pool
// ------------------------------------------------------------------------