1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

feature #3654: Recover PROLOG_MIGRATE_FAILURE with retries and recover (boot) action

This commit is contained in:
Ruben S. Montero 2015-04-09 16:05:39 +02:00
parent a7394113e1
commit 83f0805430
5 changed files with 29 additions and 74 deletions

View File

@ -805,15 +805,6 @@ public:
previous_history->running_etime=_etime; previous_history->running_etime=_etime;
}; };
/**
* Sets end time of VM prolog state in the previous host.
* @param _etime time when the running state finished
*/
void set_previous_prolog_etime(time_t _etime)
{
previous_history->prolog_etime=_etime;
};
/** /**
* Sets start time of VM epilog. * Sets start time of VM epilog.
* @param _stime time when the epilog started * @param _stime time when the epilog started

View File

@ -167,7 +167,7 @@ digraph OpenNebula {
prolog -> failure [style="dotted"]; prolog -> failure [style="dotted"];
prolog_migrate -> prolog_migrate_failure [style="dotted"]; prolog_migrate -> prolog_migrate_failure [style="dotted"];
prolog_migrate_failure -> prolog_migrate [label="migrate"]; prolog_migrate_failure -> prolog_migrate [label="boot"];
prolog_resume -> stopped [style="dotted"]; prolog_resume -> stopped [style="dotted"];
prolog_undeploy -> undeployed [style="dotted"]; prolog_undeploy -> undeployed [style="dotted"];

View File

@ -107,7 +107,7 @@ int DispatchManager::import (
vmpool->update(vm); vmpool->update(vm);
vm->set_stime(the_time); vm->set_stime(the_time);
vm->set_prolog_stime(the_time); vm->set_prolog_stime(the_time);
vm->set_prolog_etime(the_time); vm->set_prolog_etime(the_time);
@ -145,8 +145,7 @@ int DispatchManager::migrate(
if (vm->get_state() == VirtualMachine::ACTIVE && if (vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::RUNNING || (vm->get_lcm_state() == VirtualMachine::RUNNING ||
vm->get_lcm_state() == VirtualMachine::UNKNOWN || vm->get_lcm_state() == VirtualMachine::UNKNOWN ) )
vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE) )
{ {
Nebula& nd = Nebula::instance(); Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm(); LifeCycleManager * lcm = nd.get_lcm();
@ -691,7 +690,8 @@ int DispatchManager::restart(int vid)
vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY || vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE || vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE || vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE ||
vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE )) vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE))
{ {
Nebula& nd = Nebula::instance(); Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm(); LifeCycleManager * lcm = nd.get_lcm();

View File

@ -267,59 +267,6 @@ void LifeCycleManager::migrate_action(int vid)
vmm->trigger(VirtualMachineManager::SAVE,vid); vmm->trigger(VirtualMachineManager::SAVE,vid);
} }
else if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE)
{
//----------------------------------------------------
// Bypass SAVE_MIGRATE
//----------------------------------------------------
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
int cpu, mem, disk;
time_t the_time = time(0);
vm->set_resched(false);
vm->set_state(VirtualMachine::PROLOG_MIGRATE);
vm->delete_snapshots();
map<string, string> empty;
vm->update_info(0, 0, -1, -1, empty);
vmpool->update(vm);
vm->set_stime(the_time);
vm->set_previous_action(History::MIGRATE_ACTION);
vm->set_previous_prolog_etime(the_time);
vm->set_previous_etime(the_time);
vm->set_previous_vm_info();
vm->set_previous_reason(History::USER);
vmpool->update_previous_history(vm);
vmpool->update_history(vm);
vm->get_requirements(cpu,mem,disk);
hpool->add_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk);
hpool->del_capacity(vm->get_previous_hid(), vm->get_oid(), cpu, mem, disk);
vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE");
//----------------------------------------------------
tm->trigger(TransferManager::PROLOG_MIGR,vid);
}
else if (vm->get_state() == VirtualMachine::ACTIVE && else if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::UNKNOWN) vm->get_lcm_state() == VirtualMachine::UNKNOWN)
{ {
@ -762,10 +709,12 @@ void LifeCycleManager::restart_action(int vid)
vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY || vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE || vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE || vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE)) vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE ||
vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE))
||vm->get_state() == VirtualMachine::POWEROFF) ||vm->get_state() == VirtualMachine::POWEROFF)
{ {
Nebula& nd = Nebula::instance(); Nebula& nd = Nebula::instance();
VirtualMachineManager * vmm = nd.get_vmm(); VirtualMachineManager * vmm = nd.get_vmm();
VirtualMachineManager::Actions action; VirtualMachineManager::Actions action;
@ -832,12 +781,15 @@ void LifeCycleManager::restart_action(int vid)
default: default:
break; break;
} }
vmm->trigger(action,vid);
} }
else // if ( vm->get_state() == VirtualMachine::POWEROFF ) else if ( vm->get_state() == VirtualMachine::POWEROFF )
{ {
time_t the_time = time(0); time_t the_time = time(0);
vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff
vm->set_state(VirtualMachine::BOOT_POWEROFF); vm->set_state(VirtualMachine::BOOT_POWEROFF);
vm->cp_history(); vm->cp_history();
@ -853,9 +805,21 @@ void LifeCycleManager::restart_action(int vid)
vmpool->update_history(vm); vmpool->update_history(vm);
vm->log("LCM", Log::INFO, "New VM state is BOOT_POWEROFF"); vm->log("LCM", Log::INFO, "New VM state is BOOT_POWEROFF");
}
vmm->trigger(action,vid); vmm->trigger(VirtualMachineManager::DEPLOY, vid);
}
else if ( vm->get_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE )
{
TransferManager * tm = nd.get_tm();
vm->set_state(VirtualMachine::PROLOG_MIGRATE);
vmpool->update(vm);
vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE");
tm->trigger(TransferManager::PROLOG_MIGR, vid);
}
} }
else else
{ {

View File

@ -731,8 +731,7 @@ void LifeCycleManager::prolog_success_action(int vid)
{ {
vm->set_state(VirtualMachine::BOOT_UNDEPLOY); vm->set_state(VirtualMachine::BOOT_UNDEPLOY);
} }
else if ( lcm_state == VirtualMachine::PROLOG_MIGRATE || else if ( lcm_state == VirtualMachine::PROLOG_MIGRATE )
lcm_state == VirtualMachine::PROLOG_MIGRATE_FAILURE )
{ {
vm->set_state(VirtualMachine::BOOT_MIGRATE); vm->set_state(VirtualMachine::BOOT_MIGRATE);
} }
@ -790,6 +789,7 @@ void LifeCycleManager::prolog_failure_action(int vid)
else if ( state == VirtualMachine::PROLOG_MIGRATE ) else if ( state == VirtualMachine::PROLOG_MIGRATE )
{ {
vm->set_state(VirtualMachine::PROLOG_MIGRATE_FAILURE); vm->set_state(VirtualMachine::PROLOG_MIGRATE_FAILURE);
vmpool->update(vm); vmpool->update(vm);
vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE_FAILURE"); vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE_FAILURE");