mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-03 01:17:41 +03:00
Feature #3654: Allow to run a shutdown again from shutdown state
This commit is contained in:
parent
ae7fab2ff8
commit
36afa9c864
@ -57,6 +57,8 @@ digraph OpenNebula {
|
|||||||
|
|
||||||
shutdown -> running [style="dotted", color="red"];
|
shutdown -> running [style="dotted", color="red"];
|
||||||
|
|
||||||
|
shutdown -> shutdown [label="shutdown [--hard]"];
|
||||||
|
|
||||||
suspended -> epilog [label="shutdown [--hard]"];
|
suspended -> epilog [label="shutdown [--hard]"];
|
||||||
poweroff -> epilog [label="shutdown [--hard]"];
|
poweroff -> epilog [label="shutdown [--hard]"];
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|||||||
|
|
||||||
With --hard it unplugs the VM.
|
With --hard it unplugs the VM.
|
||||||
|
|
||||||
States: RUNNING, UNKNOWN (with --hard)
|
States: RUNNING, UNKNOWN (with --hard), SHUTDOWN
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
command :shutdown, shutdown_desc, [:range,:vmid_list],
|
command :shutdown, shutdown_desc, [:range,:vmid_list],
|
||||||
|
@ -240,7 +240,8 @@ int DispatchManager::shutdown (
|
|||||||
vm->get_state() == VirtualMachine::SUSPENDED ||
|
vm->get_state() == VirtualMachine::SUSPENDED ||
|
||||||
(vm->get_state() == VirtualMachine::ACTIVE &&
|
(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::SHUTDOWN)))
|
||||||
{
|
{
|
||||||
Nebula& nd = Nebula::instance();
|
Nebula& nd = Nebula::instance();
|
||||||
LifeCycleManager * lcm = nd.get_lcm();
|
LifeCycleManager * lcm = nd.get_lcm();
|
||||||
|
@ -427,7 +427,8 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
|
|||||||
|
|
||||||
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::SHUTDOWN))
|
||||||
{
|
{
|
||||||
Nebula& nd = Nebula::instance();
|
Nebula& nd = Nebula::instance();
|
||||||
VirtualMachineManager * vmm = nd.get_vmm();
|
VirtualMachineManager * vmm = nd.get_vmm();
|
||||||
@ -436,6 +437,17 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
|
|||||||
// SHUTDOWN STATE
|
// SHUTDOWN STATE
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
if (vm->get_lcm_state() == VirtualMachine::SHUTDOWN_POWEROFF)
|
||||||
|
{
|
||||||
|
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vm->set_resched(false);
|
||||||
|
|
||||||
|
vmpool->update(vm);
|
||||||
|
}
|
||||||
|
|
||||||
vm->set_state(VirtualMachine::SHUTDOWN);
|
vm->set_state(VirtualMachine::SHUTDOWN);
|
||||||
|
|
||||||
if (hard)
|
if (hard)
|
||||||
@ -455,9 +467,6 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
|
|||||||
vmm->trigger(VirtualMachineManager::SHUTDOWN,vid);
|
vmm->trigger(VirtualMachineManager::SHUTDOWN,vid);
|
||||||
}
|
}
|
||||||
|
|
||||||
vm->set_resched(false);
|
|
||||||
|
|
||||||
vmpool->update(vm);
|
|
||||||
vmpool->update_history(vm);
|
vmpool->update_history(vm);
|
||||||
}
|
}
|
||||||
else if (vm->get_state() == VirtualMachine::SUSPENDED ||
|
else if (vm->get_state() == VirtualMachine::SUSPENDED ||
|
||||||
|
@ -103,7 +103,7 @@ var lcm_state_actions = {
|
|||||||
11: //OpenNebula.VM.lcm_state.EPILOG:
|
11: //OpenNebula.VM.lcm_state.EPILOG:
|
||||||
[],
|
[],
|
||||||
12: //OpenNebula.VM.lcm_state.SHUTDOWN:
|
12: //OpenNebula.VM.lcm_state.SHUTDOWN:
|
||||||
[],
|
["VM.shutdown", "VM.shutdown_hard"],
|
||||||
13: //OpenNebula.VM.lcm_state.CANCEL:
|
13: //OpenNebula.VM.lcm_state.CANCEL:
|
||||||
[],
|
[],
|
||||||
14: //OpenNebula.VM.lcm_state.FAILURE:
|
14: //OpenNebula.VM.lcm_state.FAILURE:
|
||||||
|
Loading…
Reference in New Issue
Block a user