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

Feature #3654: Allow to run a shutdown again from shutdown state

This commit is contained in:
Carlos Martín 2015-04-24 15:33:35 +02:00
parent ae7fab2ff8
commit 36afa9c864
5 changed files with 19 additions and 7 deletions

View File

@ -57,6 +57,8 @@ digraph OpenNebula {
shutdown -> running [style="dotted", color="red"];
shutdown -> shutdown [label="shutdown [--hard]"];
suspended -> epilog [label="shutdown [--hard]"];
poweroff -> epilog [label="shutdown [--hard]"];

View File

@ -348,7 +348,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
With --hard it unplugs the VM.
States: RUNNING, UNKNOWN (with --hard)
States: RUNNING, UNKNOWN (with --hard), SHUTDOWN
EOT
command :shutdown, shutdown_desc, [:range,:vmid_list],

View File

@ -240,7 +240,8 @@ int DispatchManager::shutdown (
vm->get_state() == VirtualMachine::SUSPENDED ||
(vm->get_state() == VirtualMachine::ACTIVE &&
(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();
LifeCycleManager * lcm = nd.get_lcm();

View File

@ -427,7 +427,8 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
if (vm->get_state() == VirtualMachine::ACTIVE &&
(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();
VirtualMachineManager * vmm = nd.get_vmm();
@ -436,6 +437,17 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
// 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);
if (hard)
@ -455,9 +467,6 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
vmm->trigger(VirtualMachineManager::SHUTDOWN,vid);
}
vm->set_resched(false);
vmpool->update(vm);
vmpool->update_history(vm);
}
else if (vm->get_state() == VirtualMachine::SUSPENDED ||

View File

@ -103,7 +103,7 @@ var lcm_state_actions = {
11: //OpenNebula.VM.lcm_state.EPILOG:
[],
12: //OpenNebula.VM.lcm_state.SHUTDOWN:
[],
["VM.shutdown", "VM.shutdown_hard"],
13: //OpenNebula.VM.lcm_state.CANCEL:
[],
14: //OpenNebula.VM.lcm_state.FAILURE: