mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
Feature #3654: Allow to run a poweroff/undeploy again from shutdown_poweroff/undeploy
This commit is contained in:
parent
c5ab2dca49
commit
9be8b151bc
@ -70,6 +70,8 @@ digraph OpenNebula {
|
||||
running -> shutdown_poweroff [label="poweroff [--hard]"];
|
||||
shutdown_poweroff -> poweroff [style="dashed", color="blue"];
|
||||
|
||||
shutdown_poweroff -> shutdown_poweroff [label="poweroff [--hard]"];
|
||||
|
||||
shutdown_poweroff -> running [style="dotted", color="red"];
|
||||
|
||||
# livemigrate
|
||||
@ -111,6 +113,8 @@ digraph OpenNebula {
|
||||
shutdown_undeploy -> running [style="dotted", color="red"];
|
||||
epilog_undeploy -> undeployed [style="dashed", color="blue"];
|
||||
|
||||
shutdown_undeploy -> shutdown_undeploy [label="undeploy [--hard]"];
|
||||
|
||||
poweroff -> epilog_undeploy [label="undeploy [--hard]"];
|
||||
|
||||
# suspend
|
||||
|
@ -371,7 +371,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
With --hard it unplugs the VM.
|
||||
|
||||
States: RUNNING
|
||||
States: RUNNING, UNKNOWN, SHUTDOWN_UNDEPLOY
|
||||
EOT
|
||||
|
||||
command :undeploy, undeploy_desc, [:range,:vmid_list],
|
||||
@ -393,7 +393,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
Powers off the given VM. The VM will remain in the poweroff state, and
|
||||
can be powered on with the 'onevm resume' command.
|
||||
|
||||
States: RUNNING
|
||||
States: RUNNING, UNKNOWN, SHUTDOWN_POWEROFF
|
||||
EOT
|
||||
|
||||
command :poweroff, poweroff_desc, [:range,:vmid_list],
|
||||
|
@ -292,7 +292,8 @@ int DispatchManager::undeploy(
|
||||
if ( vm->get_state() == VirtualMachine::POWEROFF ||
|
||||
(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_UNDEPLOY)))
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
LifeCycleManager * lcm = nd.get_lcm();
|
||||
@ -351,7 +352,8 @@ int DispatchManager::poweroff (
|
||||
|
||||
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_POWEROFF))
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
LifeCycleManager * lcm = nd.get_lcm();
|
||||
|
@ -509,7 +509,8 @@ void LifeCycleManager::undeploy_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_UNDEPLOY))
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
VirtualMachineManager * vmm = nd.get_vmm();
|
||||
@ -518,11 +519,18 @@ void LifeCycleManager::undeploy_action(int vid, bool hard)
|
||||
// SHUTDOWN_UNDEPLOY STATE
|
||||
//----------------------------------------------------
|
||||
|
||||
vm->set_state(VirtualMachine::SHUTDOWN_UNDEPLOY);
|
||||
if (vm->get_lcm_state() == VirtualMachine::SHUTDOWN_UNDEPLOY)
|
||||
{
|
||||
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
||||
}
|
||||
else
|
||||
{
|
||||
vm->set_state(VirtualMachine::SHUTDOWN_UNDEPLOY);
|
||||
|
||||
vm->set_resched(false);
|
||||
vm->set_resched(false);
|
||||
|
||||
vmpool->update(vm);
|
||||
vmpool->update(vm);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
@ -608,7 +616,8 @@ void LifeCycleManager::poweroff_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_POWEROFF))
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
VirtualMachineManager * vmm = nd.get_vmm();
|
||||
@ -617,11 +626,18 @@ void LifeCycleManager::poweroff_action(int vid, bool hard)
|
||||
// SHUTDOWN_POWEROFF STATE
|
||||
//----------------------------------------------------
|
||||
|
||||
vm->set_state(VirtualMachine::SHUTDOWN_POWEROFF);
|
||||
if (vm->get_lcm_state() == VirtualMachine::SHUTDOWN_POWEROFF)
|
||||
{
|
||||
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
||||
}
|
||||
else
|
||||
{
|
||||
vm->set_state(VirtualMachine::SHUTDOWN_POWEROFF);
|
||||
|
||||
vm->set_resched(false);
|
||||
vm->set_resched(false);
|
||||
|
||||
vmpool->update(vm);
|
||||
vmpool->update(vm);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
|
@ -115,7 +115,7 @@ var lcm_state_actions = {
|
||||
17: //OpenNebula.VM.lcm_state.HOTPLUG:
|
||||
[],
|
||||
18: //OpenNebula.VM.lcm_state.SHUTDOWN_POWEROFF:
|
||||
[],
|
||||
["VM.poweroff", "VM.poweroff_hard"],
|
||||
19: //OpenNebula.VM.lcm_state.BOOT_UNKNOWN:
|
||||
["VM.boot"],
|
||||
20: //OpenNebula.VM.lcm_state.BOOT_POWEROFF:
|
||||
@ -137,7 +137,7 @@ var lcm_state_actions = {
|
||||
28: //OpenNebula.VM.lcm_state.HOTPLUG_SAVEAS_SUSPENDED:
|
||||
[],
|
||||
29: //OpenNebula.VM.lcm_state.SHUTDOWN_UNDEPLOY:
|
||||
[],
|
||||
["VM.undeploy", "VM.undeploy_hard"],
|
||||
30: //OpenNebula.VM.lcm_state.EPILOG_UNDEPLOY:
|
||||
[],
|
||||
31: //OpenNebula.VM.lcm_state.PROLOG_UNDEPLOY:
|
||||
|
Loading…
Reference in New Issue
Block a user