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

feature #3564: Recover PROLOG FAILED with retry

This commit is contained in:
Ruben S. Montero 2015-04-14 15:36:33 +02:00
parent c9cecaeca1
commit 25d6c2a7f0
4 changed files with 18 additions and 58 deletions

View File

@ -167,7 +167,7 @@ digraph OpenNebula {
epilog_undeploy -> failure [style="dotted"];
prolog -> prolog_failure [style="dotted"];
prolog_failure -> prolog [label="deploy"];
prolog_failure -> prolog [label="recover"];
prolog_migrate -> prolog_migrate_failure [style="dotted"];
prolog_migrate_failure -> prolog_migrate [label="recover"];

View File

@ -38,12 +38,12 @@ int DispatchManager::deploy (
oss << "Deploying VM " << vid;
NebulaLog::log("DiM",Log::DEBUG,oss);
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
if ( vm->get_state() == VirtualMachine::PENDING ||
vm->get_state() == VirtualMachine::HOLD )
{
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
vm->set_state(VirtualMachine::ACTIVE);
vmpool->update(vm);
@ -52,11 +52,6 @@ int DispatchManager::deploy (
lcm->trigger(LifeCycleManager::DEPLOY,vid);
}
else if ( vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::PROLOG_FAILURE)
{
lcm->trigger(LifeCycleManager::DEPLOY,vid);
}
else
{
goto error;

View File

@ -22,9 +22,6 @@ void LifeCycleManager::deploy_action(int vid)
VirtualMachine * vm;
ostringstream os;
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
vm = vmpool->get(vid,true);
if ( vm == 0 )
@ -32,12 +29,14 @@ void LifeCycleManager::deploy_action(int vid)
return;
}
if ( vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() != VirtualMachine::PROLOG_FAILURE )
if ( vm->get_state() == VirtualMachine::ACTIVE )
{
time_t thetime = time(0);
int cpu,mem,disk;
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
VirtualMachine::LcmState vm_state;
TransferManager::Actions tm_action;
@ -112,17 +111,6 @@ void LifeCycleManager::deploy_action(int vid)
tm->trigger(tm_action,vid);
}
else if ( vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::PROLOG_FAILURE )
{
vm->set_state(VirtualMachine::PROLOG);
vmpool->update(vm);
vm->log("LCM", Log::INFO, "New VM state is PROLOG.");
tm->trigger(TransferManager::PROLOG,vid);
}
else
{
vm->log("LCM", Log::ERROR, "deploy_action, VM in a wrong state.");
@ -757,6 +745,16 @@ void LifeCycleManager::retry_action(int vid)
tm->trigger(TransferManager::PROLOG_MIGR, vid);
break;
case VirtualMachine::PROLOG_FAILURE:
vm->set_state(VirtualMachine::PROLOG);
vmpool->update(vm);
vm->log("LCM", Log::INFO, "New VM state is PROLOG.");
tm->trigger(TransferManager::PROLOG,vid);
break;
case VirtualMachine::LCM_INIT:
case VirtualMachine::BOOT:
case VirtualMachine::BOOT_MIGRATE:

View File

@ -706,39 +706,6 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
return;
}
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::PROLOG_FAILURE)
{
int c_hid = -1;
if (vm->hasHistory())
{
c_hid = vm->get_hid();
}
if (c_hid != hid)
{
ostringstream oss;
oss << "VM in state PROLOG_FAILURE can only be deployed to "
<< object_name(PoolObjectSQL::HOST) << " [" << c_hid << "]";
failure_response(ACTION,
request_error(oss.str(),""),
att);
vm->unlock();
return;
}
dm->deploy(vm);
vm->unlock();
success_response(id, att);
return;
}
if (vm->hasHistory() &&
(vm->get_action() == History::STOP_ACTION ||
vm->get_action() == History::UNDEPLOY_ACTION ||