1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

Bug #1557: Add new VM LCM state in core, BOOT_POWEROFF. A failed boot returns the VM to POWEROFF

This commit is contained in:
Carlos Martín 2012-10-16 15:32:06 +02:00
parent 8d4a1d1d5f
commit 376b8959b7
4 changed files with 21 additions and 7 deletions

View File

@ -84,7 +84,8 @@ public:
UNKNOWN = 16, UNKNOWN = 16,
HOTPLUG = 17, HOTPLUG = 17,
SHUTDOWN_POWEROFF = 18, SHUTDOWN_POWEROFF = 18,
BOOT_UNKNOWN = 19 BOOT_UNKNOWN = 19,
BOOT_POWEROFF = 20
}; };
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------

View File

@ -555,7 +555,8 @@ int DispatchManager::restart(int vid)
if ((vm->get_state() == VirtualMachine::ACTIVE && if ((vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::UNKNOWN || (vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT || vm->get_lcm_state() == VirtualMachine::BOOT ||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN)) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF))
|| vm->get_state() == VirtualMachine::POWEROFF ) || vm->get_state() == VirtualMachine::POWEROFF )
{ {
Nebula& nd = Nebula::instance(); Nebula& nd = Nebula::instance();

View File

@ -499,7 +499,8 @@ void LifeCycleManager::restart_action(int vid)
if ((vm->get_state() == VirtualMachine::ACTIVE && if ((vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::UNKNOWN || (vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT || vm->get_lcm_state() == VirtualMachine::BOOT ||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN)) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF))
||vm->get_state() == VirtualMachine::POWEROFF) ||vm->get_state() == VirtualMachine::POWEROFF)
{ {
Nebula& nd = Nebula::instance(); Nebula& nd = Nebula::instance();
@ -511,7 +512,8 @@ void LifeCycleManager::restart_action(int vid)
if (vm->get_state() == VirtualMachine::ACTIVE && if (vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::BOOT || (vm->get_lcm_state() == VirtualMachine::BOOT ||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN)) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF))
{ {
vm->log("LCM", Log::INFO, "Sending BOOT command to VM again"); vm->log("LCM", Log::INFO, "Sending BOOT command to VM again");
} }
@ -524,14 +526,14 @@ void LifeCycleManager::restart_action(int vid)
vm->log("LCM", Log::INFO, "New VM state is BOOT_UNKNOWN"); vm->log("LCM", Log::INFO, "New VM state is BOOT_UNKNOWN");
} }
else else // if ( vm->get_state() == VirtualMachine::POWEROFF )
{ {
vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff
vm->set_state(VirtualMachine::BOOT); vm->set_state(VirtualMachine::BOOT_POWEROFF);
vmpool->update(vm); vmpool->update(vm);
vm->log("LCM", Log::INFO, "New VM state is BOOT"); vm->log("LCM", Log::INFO, "New VM state is BOOT_POWEROFF");
} }
//---------------------------------------------------- //----------------------------------------------------
@ -656,6 +658,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
case VirtualMachine::BOOT: case VirtualMachine::BOOT:
case VirtualMachine::BOOT_UNKNOWN: case VirtualMachine::BOOT_UNKNOWN:
case VirtualMachine::BOOT_POWEROFF:
case VirtualMachine::RUNNING: case VirtualMachine::RUNNING:
case VirtualMachine::UNKNOWN: case VirtualMachine::UNKNOWN:
case VirtualMachine::SHUTDOWN: case VirtualMachine::SHUTDOWN:

View File

@ -364,6 +364,15 @@ void LifeCycleManager::deploy_failure_action(int vid)
vm->log("LCM", Log::INFO, "New VM state is UNKNOWN"); vm->log("LCM", Log::INFO, "New VM state is UNKNOWN");
} }
else if (vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF)
{
vm->set_state(VirtualMachine::POWEROFF);
vm->set_state(VirtualMachine::LCM_INIT);
vmpool->update(vm);
vm->log("LCM", Log::INFO, "New VM state is POWEROFF");
}
vm->unlock(); vm->unlock();
} }