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

feature #3654: PROLOG_RESUME_FAILURE & PROLOG_UNDEPLOY_FAILURE states

This commit is contained in:
Ruben S. Montero 2015-05-08 13:47:48 +02:00
parent cff1273506
commit 4d50231681
12 changed files with 103 additions and 98 deletions

View File

@ -152,7 +152,9 @@ public:
PROLOG_MIGRATE_SUSPEND = 45,
PROLOG_MIGRATE_SUSPEND_FAILURE = 46,
BOOT_UNDEPLOY_FAILURE = 47,
BOOT_STOPPED_FAILURE = 48
BOOT_STOPPED_FAILURE = 48,
PROLOG_RESUME_FAILURE = 49,
PROLOG_UNDEPLOY_FAILURE = 50
};
static int lcm_state_from_str(string& st, LcmState& state)
@ -206,6 +208,8 @@ public:
else if ( st == "PROLOG_MIGRATE_SUSPEND_FAILURE") { state = PROLOG_MIGRATE_SUSPEND_FAILURE;}
else if ( st == "BOOT_STOPPED_FAILURE") { state = BOOT_STOPPED_FAILURE; }
else if ( st == "BOOT_UNDEPLOY_FAILURE") { state = BOOT_UNDEPLOY_FAILURE; }
else if ( st == "PROLOG_RESUME_FAILURE") { state = PROLOG_RESUME_FAILURE; }
else if ( st == "PROLOG_UNDEPLOY_FAILURE") { state = PROLOG_UNDEPLOY_FAILURE; }
else {return -1;}
return 0;
@ -262,6 +266,8 @@ public:
case PROLOG_MIGRATE_SUSPEND_FAILURE: st = "PROLOG_MIGRATE_SUSPEND_FAILURE"; break;
case BOOT_STOPPED_FAILURE: st = "BOOT_STOPPED_FAILURE"; break;
case BOOT_UNDEPLOY_FAILURE: st = "BOOT_UNDEPLOY_FAILURE"; break;
case PROLOG_RESUME_FAILURE: st = "PROLOG_RESUME_FAILURE"; break;
case PROLOG_UNDEPLOY_FAILURE: st = "PROLOG_UNDEPLOY_FAILURE"; break;
}
return st;

View File

@ -161,7 +161,9 @@
PROLOG_MIGRATE_SUSPEND = 45,
PROLOG_MIGRATE_SUSPEND_FAILURE = 46
BOOT_UNDEPLOY_FAILURE = 47,
BOOT_STOPPED_FAILURE = 48
BOOT_STOPPED_FAILURE = 48,
PROLOG_RESUME_FAILURE = 49,
PROLOG_UNDEPLOY_FAILURE = 50
-->
<xs:element name="LCM_STATE" type="xs:integer"/>
<xs:element name="PREV_STATE" type="xs:integer"/>

View File

@ -94,7 +94,9 @@
PROLOG_MIGRATE_SUSPEND = 45,
PROLOG_MIGRATE_SUSPEND_FAILURE = 46
BOOT_UNDEPLOY_FAILURE = 47,
BOOT_STOPPED_FAILURE = 48
BOOT_STOPPED_FAILURE = 48,
PROLOG_RESUME_FAILURE = 49,
PROLOG_UNDEPLOY_FAILURE = 50
-->
<xs:element name="LCM_STATE" type="xs:integer"/>
<xs:element name="PREV_STATE" type="xs:integer"/>

View File

@ -860,6 +860,8 @@ module OpenNebula
lcm_state_str == 'EPILOG_UNDEPLOY_FAILURE' ||
lcm_state_str == 'PROLOG_MIGRATE_POWEROFF_FAILURE' ||
lcm_state_str == 'PROLOG_MIGRATE_SUSPEND_FAILURE' ||
lcm_state_str == 'PROLOG_UNDEPLOY_FAILURE' ||
lcm_state_str == 'PROLOG_RESUME_FAILURE' ||
lcm_state_str == 'BOOT_UNDEPLOY_FAILURE' ||
lcm_state_str == 'BOOT_STOPPED_FAILURE' ))

View File

@ -288,9 +288,12 @@ protected
lcm_state == '41' || # EPILOG_STOP_FAILURE
lcm_state == '42' || # EPILOG_UNDEPLOY_FAILURE
lcm_state == '44' || # PROLOG_MIGRATE_POWEROFF_FAILURE
lcm_state == '46' ) # PROLOG_MIGRATE_SUSPEND_FAILURE
lcm_state == '46' || # PROLOG_MIGRATE_SUSPEND_FAILURE
lcm_state == '47' || # BOOT_UNDEPLOY_FAILURE
lcm_state == '48' || # BOOT_STOPPED_FAILURE
lcm_state == '49' || # PROLOG_RESUME_FAILURE
lcm_state == '50' ) # PROLOG_UNDEPLOY_FAILURE
)
return true
end
end

View File

@ -880,7 +880,9 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag
{
case VirtualMachine::PROLOG:
case VirtualMachine::PROLOG_RESUME:
case VirtualMachine::PROLOG_RESUME_FAILURE:
case VirtualMachine::PROLOG_UNDEPLOY:
case VirtualMachine::PROLOG_UNDEPLOY_FAILURE:
case VirtualMachine::PROLOG_FAILURE:
vm->set_prolog_etime(the_time);
vmpool->update_history(vm);
@ -1065,7 +1067,9 @@ void LifeCycleManager::recover(VirtualMachine * vm, bool success)
case VirtualMachine::PROLOG_MIGRATE:
case VirtualMachine::PROLOG_MIGRATE_FAILURE:
case VirtualMachine::PROLOG_RESUME:
case VirtualMachine::PROLOG_RESUME_FAILURE:
case VirtualMachine::PROLOG_UNDEPLOY:
case VirtualMachine::PROLOG_UNDEPLOY_FAILURE:
case VirtualMachine::PROLOG_FAILURE:
case VirtualMachine::PROLOG_MIGRATE_POWEROFF:
case VirtualMachine::PROLOG_MIGRATE_POWEROFF_FAILURE:
@ -1297,6 +1301,22 @@ void LifeCycleManager::retry(VirtualMachine * vm)
tm->trigger(TransferManager::PROLOG_MIGR, vid);
break;
case VirtualMachine::PROLOG_RESUME_FAILURE:
vm->set_state(VirtualMachine::PROLOG_RESUME);
vmpool->update(vm);
tm->trigger(TransferManager::PROLOG_RESUME,vid);
break;
case VirtualMachine::PROLOG_UNDEPLOY_FAILURE:
vm->set_state(VirtualMachine::PROLOG_UNDEPLOY);
vmpool->update(vm);
tm->trigger(TransferManager::PROLOG_RESUME,vid);
break;
case VirtualMachine::PROLOG_FAILURE:
vm->set_state(VirtualMachine::PROLOG);

View File

@ -623,7 +623,9 @@ void LifeCycleManager::prolog_success_action(int vid)
// BOOT STATE
//---------------------------------------------------------------------
case VirtualMachine::PROLOG_RESUME:
case VirtualMachine::PROLOG_RESUME_FAILURE: //recover success
case VirtualMachine::PROLOG_UNDEPLOY:
case VirtualMachine::PROLOG_UNDEPLOY_FAILURE: //recover success
case VirtualMachine::PROLOG_MIGRATE:
case VirtualMachine::PROLOG_MIGRATE_FAILURE: //recover success
case VirtualMachine::PROLOG:
@ -631,11 +633,13 @@ void LifeCycleManager::prolog_success_action(int vid)
switch (lcm_state)
{
case VirtualMachine::PROLOG_RESUME:
case VirtualMachine::PROLOG_RESUME_FAILURE:
action = VirtualMachineManager::RESTORE;
vm->set_state(VirtualMachine::BOOT_STOPPED);
break;
case VirtualMachine::PROLOG_UNDEPLOY:
case VirtualMachine::PROLOG_UNDEPLOY_FAILURE:
action = VirtualMachineManager::DEPLOY;
vm->set_state(VirtualMachine::BOOT_UNDEPLOY);
break;
@ -721,108 +725,56 @@ void LifeCycleManager::prolog_success_action(int vid)
void LifeCycleManager::prolog_failure_action(int vid)
{
VirtualMachine::LcmState state;
VirtualMachine * vm;
time_t the_time = time(0);
vm = vmpool->get(vid,true);
VirtualMachine * vm = vmpool->get(vid,true);
if ( vm == 0 )
{
return;
}
state = vm->get_lcm_state();
if ( state == VirtualMachine::PROLOG )
switch(vm->get_lcm_state())
{
vm->set_state(VirtualMachine::PROLOG_FAILURE);
vmpool->update(vm);
}
else if ( state == VirtualMachine::PROLOG_MIGRATE )
{
vm->set_state(VirtualMachine::PROLOG_MIGRATE_FAILURE);
case VirtualMachine::PROLOG:
vm->set_state(VirtualMachine::PROLOG_FAILURE);
vmpool->update(vm);
break;
vmpool->update(vm);
}
else if ( state == VirtualMachine::PROLOG_MIGRATE_POWEROFF )
{
vm->set_state(VirtualMachine::PROLOG_MIGRATE_POWEROFF_FAILURE);
vmpool->update(vm);
}
else if ( state == VirtualMachine::PROLOG_MIGRATE_SUSPEND )
{
vm->set_state(VirtualMachine::PROLOG_MIGRATE_SUSPEND_FAILURE);
vmpool->update(vm);
}
else if ( state == VirtualMachine::PROLOG_RESUME )
{
//----------------------------------------------------
// STOPPED STATE FROM PROLOG_RESUME
//----------------------------------------------------
case VirtualMachine::PROLOG_MIGRATE:
vm->set_state(VirtualMachine::PROLOG_MIGRATE_FAILURE);
vmpool->update(vm);
break;
int cpu,mem,disk;
case VirtualMachine::PROLOG_MIGRATE_POWEROFF:
vm->set_state(VirtualMachine::PROLOG_MIGRATE_POWEROFF_FAILURE);
vmpool->update(vm);
break;
vm->set_prolog_etime(the_time);
case VirtualMachine::PROLOG_MIGRATE_SUSPEND:
vm->set_state(VirtualMachine::PROLOG_MIGRATE_SUSPEND_FAILURE);
vmpool->update(vm);
break;
vm->set_resched(false);
case VirtualMachine::PROLOG_RESUME:
vm->set_state(VirtualMachine::PROLOG_RESUME_FAILURE);
vmpool->update(vm);
break;
vmpool->update(vm);
case VirtualMachine::PROLOG_UNDEPLOY:
vm->set_state(VirtualMachine::PROLOG_UNDEPLOY_FAILURE);
vmpool->update(vm);
break;
vm->set_etime(the_time);
case VirtualMachine::PROLOG_MIGRATE_FAILURE: //recover failure from failure state
case VirtualMachine::PROLOG_MIGRATE_POWEROFF_FAILURE:
case VirtualMachine::PROLOG_MIGRATE_SUSPEND_FAILURE:
case VirtualMachine::PROLOG_RESUME_FAILURE:
case VirtualMachine::PROLOG_UNDEPLOY_FAILURE:
case VirtualMachine::PROLOG_FAILURE:
break;
vm->set_vm_info();
vm->set_reason(History::ERROR);
vmpool->update_history(vm);
vm->get_requirements(cpu,mem,disk);
hpool->del_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk);
//----------------------------------------------------
dm->trigger(DispatchManager::STOP_SUCCESS,vid);
}
else if ( state == VirtualMachine::PROLOG_UNDEPLOY )
{
//----------------------------------------------------
// UNDEPLOY STATE FROM PROLOG_UNDEPLOY
//----------------------------------------------------
int cpu,mem,disk;
vm->set_prolog_etime(the_time);
vm->set_resched(false);
vmpool->update(vm);
vm->set_etime(the_time);
vm->set_vm_info();
vm->set_reason(History::ERROR);
vmpool->update_history(vm);
vm->get_requirements(cpu,mem,disk);
hpool->del_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk);
//----------------------------------------------------
dm->trigger(DispatchManager::UNDEPLOY_SUCCESS,vid);
}
//wrong state + recover failure from failure state
else if ( state != VirtualMachine::PROLOG_MIGRATE_FAILURE &&
state != VirtualMachine::PROLOG_MIGRATE_POWEROFF_FAILURE &&
state != VirtualMachine::PROLOG_MIGRATE_SUSPEND_FAILURE &&
state != VirtualMachine::PROLOG_FAILURE )
{
vm->log("LCM",Log::ERROR,"prolog_failure_action, VM in a wrong state");
default: //wrong state
vm->log("LCM",Log::ERROR,"prolog_failure_action, VM in a wrong state");
break;
}
vm->unlock();

View File

@ -125,7 +125,9 @@ public class VirtualMachine extends PoolElement{
"PROLOG_MIGRATE_SUSPEND",
"PROLOG_MIGRATE_SUSPEND_FAILURE",
"BOOT_UNDEPLOY_FAILURE",
"BOOT_STOPPED_FAILURE"
"BOOT_STOPPED_FAILURE",
"PROLOG_RESUME_FAILURE",
"PROLOG_UNDEPLOY_FAILURE"
};
private static final String[] SHORT_LCM_STATES =
@ -178,7 +180,9 @@ public class VirtualMachine extends PoolElement{
"migr", // PROLOG_MIGRATE_SUSPEND
"fail", // PROLOG_MIGRATE_SUSPEND_FAILURE
"fail", // BOOT_UNDEPLOY_FAILURE
"fail" // BOOT_STOPPED_FAILURE
"fail", // BOOT_STOPPED_FAILURE
"fail", // PROLOG_RESUME_FAILURE
"fail" // PROLOG_UNDEPLOY_FAILURE
};
/**

View File

@ -100,6 +100,8 @@ module OpenNebula
PROLOG_MIGRATE_SUSPEND_FAILURE
BOOT_UNDEPLOY_FAILURE
BOOT_STOPPED_FAILURE
PROLOG_RESUME_FAILURE
PROLOG_UNDEPLOY_FAILURE
}
SHORT_VM_STATES={
@ -163,7 +165,9 @@ module OpenNebula
"PROLOG_MIGRATE_SUSPEND" => "migr",
"PROLOG_MIGRATE_SUSPEND_FAILURE" => "fail",
"BOOT_UNDEPLOY_FAILURE" => "fail",
"BOOT_STOPPED_FAILURE" => "fail"
"BOOT_STOPPED_FAILURE" => "fail",
"PROLOG_RESUME_FAILURE" => "fail",
"PROLOG_UNDEPLOY_FAILURE" => "fail"
}
MIGRATE_REASON=%w{NONE ERROR USER}

View File

@ -81,6 +81,8 @@ VNC_STATES = [
#46, #PROLOG_MIGRATE_SUSPEND_FAILURE
#47, #BOOT_UNDEPLOY_FAILURE
#48, #BOOT_STOPPED_FAILURE
#49, #PROLOG_RESUME_FAILURE
#50, #PROLOG_UNDEPLOY_FAILURE
]
class OpenNebulaVNC

View File

@ -166,7 +166,9 @@ var OpenNebula = {
"MIGRATE", // PROLOG_MIGRATE_SUSPEND
"FAILURE", // PROLOG_MIGRATE_SUSPEND_FAILURE
"FAILURE", // BOOT_UNDEPLOY_FAILURE
"FAILURE" // BOOT_STOPPED_FAILURE
"FAILURE", // BOOT_STOPPED_FAILURE
"FAILURE", // PROLOG_RESUME_FAILURE
"FAILURE" // PROLOG_UNDEPLOY_FAILURE
][value]);
break;
case "VM_LCM":
@ -219,7 +221,9 @@ var OpenNebula = {
"PROLOG_MIGRATE_SUSPEND",
"PROLOG_MIGRATE_SUSPEND_FAILURE",
"BOOT_UNDEPLOY_FAILURE",
"BOOT_STOPPED_FAILURE"
"BOOT_STOPPED_FAILURE",
"PROLOG_RESUME_FAILURE",
"PROLOG_UNDEPLOY_FAILURE"
][value]);
break;
case "IMAGE":

View File

@ -176,6 +176,10 @@ var lcm_state_actions = {
[],
48: //OpenNebula.VM.lcm_state.BOOT_STOPPED_FAILURE:
[],
49: //OpenNebula.VM.lcm_state.PROLOG_RESUME_FAILURE:
[],
50: //OpenNebula.VM.lcm_state.PROLOG_UNDEPLOY_FAILURE:
[]
}
//Permanent storage for last value of aggregated network usage