mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
parent
fa22e988b0
commit
82ab8df8d6
@ -438,6 +438,15 @@ int DispatchManager::terminate(int vid, bool hard, const RequestAttributes& ra,
|
||||
lcm->trigger_delete(vid, ra);
|
||||
break;
|
||||
|
||||
case VirtualMachine::SHUTDOWN:
|
||||
if (hard)
|
||||
{
|
||||
// Override previous (probably freezed) shutdown action
|
||||
lcm->trigger_shutdown(vid, hard, ra);
|
||||
break;
|
||||
}
|
||||
// else fallthrough to default
|
||||
|
||||
default:
|
||||
oss.str("");
|
||||
oss << "Could not terminate VM " << vid
|
||||
@ -487,6 +496,12 @@ int DispatchManager::undeploy(int vid, bool hard, const RequestAttributes& ra,
|
||||
lcm->trigger_undeploy(vid, ra);
|
||||
}
|
||||
}
|
||||
else if ( hard &&
|
||||
vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
vm->get_lcm_state() == VirtualMachine::SHUTDOWN_UNDEPLOY)
|
||||
{
|
||||
lcm->trigger_undeploy_hard(vid, ra);
|
||||
}
|
||||
else
|
||||
{
|
||||
goto error;
|
||||
@ -525,9 +540,11 @@ int DispatchManager::poweroff(int vid, bool hard, const RequestAttributes& ra,
|
||||
oss << "Powering off VM " << vid;
|
||||
NebulaLog::log("DiM",Log::DEBUG,oss);
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN))
|
||||
auto lcm_state = vm->get_lcm_state();
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(lcm_state == VirtualMachine::RUNNING ||
|
||||
lcm_state == VirtualMachine::UNKNOWN))
|
||||
{
|
||||
if (hard)
|
||||
{
|
||||
@ -538,6 +555,12 @@ int DispatchManager::poweroff(int vid, bool hard, const RequestAttributes& ra,
|
||||
lcm->trigger_poweroff(vid, ra);
|
||||
}
|
||||
}
|
||||
else if (hard &&
|
||||
vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
lcm_state == VirtualMachine::SHUTDOWN_POWEROFF )
|
||||
{
|
||||
lcm->trigger_poweroff_hard(vid, ra);
|
||||
}
|
||||
else
|
||||
{
|
||||
goto error;
|
||||
|
@ -434,7 +434,7 @@ void LifeCycleManager::trigger_shutdown(int vid, bool hard,
|
||||
vm->get_template_attribute("MEMORY", memory);
|
||||
vm->get_template_attribute("CPU", cpu);
|
||||
|
||||
if ( (vm->get_state() == VirtualMachine::SUSPENDED) ||
|
||||
if ((vm->get_state() == VirtualMachine::SUSPENDED) ||
|
||||
(vm->get_state() == VirtualMachine::POWEROFF) ||
|
||||
(vm->get_state() == VirtualMachine::STOPPED) ||
|
||||
(vm->get_state() == VirtualMachine::UNDEPLOYED))
|
||||
@ -448,9 +448,20 @@ void LifeCycleManager::trigger_shutdown(int vid, bool hard,
|
||||
quota_tmpl.add("VMS", 0);
|
||||
}
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN))
|
||||
auto lcm_state = vm->get_lcm_state();
|
||||
|
||||
if (hard && (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
lcm_state == VirtualMachine::SHUTDOWN))
|
||||
{
|
||||
// Cancel previous shutdown action
|
||||
vmm->trigger_driver_cancel(vid);
|
||||
|
||||
lcm_state = VirtualMachine::RUNNING; // Force execute of hard shutdown
|
||||
}
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(lcm_state == VirtualMachine::RUNNING ||
|
||||
lcm_state == VirtualMachine::UNKNOWN))
|
||||
{
|
||||
//----------------------------------------------------
|
||||
// SHUTDOWN STATE
|
||||
@ -545,9 +556,20 @@ void LifeCycleManager::trigger_undeploy(int vid, bool hard,
|
||||
return;
|
||||
}
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN))
|
||||
auto lcm_state = vm->get_lcm_state();
|
||||
|
||||
if (hard && (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
lcm_state == VirtualMachine::SHUTDOWN_UNDEPLOY))
|
||||
{
|
||||
// Cancel previous undeploy action
|
||||
vmm->trigger_driver_cancel(vid);
|
||||
|
||||
lcm_state = VirtualMachine::RUNNING; // Force execute of hard shutdown
|
||||
}
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(lcm_state == VirtualMachine::RUNNING ||
|
||||
lcm_state == VirtualMachine::UNKNOWN))
|
||||
{
|
||||
//----------------------------------------------------
|
||||
// SHUTDOWN_UNDEPLOY STATE
|
||||
@ -647,9 +669,20 @@ void LifeCycleManager::trigger_poweroff(int vid, bool hard,
|
||||
return;
|
||||
}
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN))
|
||||
auto lcm_state = vm->get_lcm_state();
|
||||
|
||||
if (hard && (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
lcm_state == VirtualMachine::SHUTDOWN_POWEROFF))
|
||||
{
|
||||
// Cancel previous shutdown action
|
||||
vmm->trigger_driver_cancel(vid);
|
||||
|
||||
lcm_state = VirtualMachine::RUNNING; // Force execute of hard shutdown
|
||||
}
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(lcm_state == VirtualMachine::RUNNING ||
|
||||
lcm_state == VirtualMachine::UNKNOWN))
|
||||
{
|
||||
//----------------------------------------------------
|
||||
// SHUTDOWN_POWEROFF STATE
|
||||
|
Loading…
x
Reference in New Issue
Block a user