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]"];
|
running -> shutdown_poweroff [label="poweroff [--hard]"];
|
||||||
shutdown_poweroff -> poweroff [style="dashed", color="blue"];
|
shutdown_poweroff -> poweroff [style="dashed", color="blue"];
|
||||||
|
|
||||||
|
shutdown_poweroff -> shutdown_poweroff [label="poweroff [--hard]"];
|
||||||
|
|
||||||
shutdown_poweroff -> running [style="dotted", color="red"];
|
shutdown_poweroff -> running [style="dotted", color="red"];
|
||||||
|
|
||||||
# livemigrate
|
# livemigrate
|
||||||
@ -111,6 +113,8 @@ digraph OpenNebula {
|
|||||||
shutdown_undeploy -> running [style="dotted", color="red"];
|
shutdown_undeploy -> running [style="dotted", color="red"];
|
||||||
epilog_undeploy -> undeployed [style="dashed", color="blue"];
|
epilog_undeploy -> undeployed [style="dashed", color="blue"];
|
||||||
|
|
||||||
|
shutdown_undeploy -> shutdown_undeploy [label="undeploy [--hard]"];
|
||||||
|
|
||||||
poweroff -> epilog_undeploy [label="undeploy [--hard]"];
|
poweroff -> epilog_undeploy [label="undeploy [--hard]"];
|
||||||
|
|
||||||
# suspend
|
# suspend
|
||||||
|
@ -371,7 +371,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|||||||
|
|
||||||
With --hard it unplugs the VM.
|
With --hard it unplugs the VM.
|
||||||
|
|
||||||
States: RUNNING
|
States: RUNNING, UNKNOWN, SHUTDOWN_UNDEPLOY
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
command :undeploy, undeploy_desc, [:range,:vmid_list],
|
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
|
Powers off the given VM. The VM will remain in the poweroff state, and
|
||||||
can be powered on with the 'onevm resume' command.
|
can be powered on with the 'onevm resume' command.
|
||||||
|
|
||||||
States: RUNNING
|
States: RUNNING, UNKNOWN, SHUTDOWN_POWEROFF
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
command :poweroff, poweroff_desc, [:range,:vmid_list],
|
command :poweroff, poweroff_desc, [:range,:vmid_list],
|
||||||
|
@ -292,7 +292,8 @@ int DispatchManager::undeploy(
|
|||||||
if ( vm->get_state() == VirtualMachine::POWEROFF ||
|
if ( vm->get_state() == VirtualMachine::POWEROFF ||
|
||||||
(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_UNDEPLOY)))
|
||||||
{
|
{
|
||||||
Nebula& nd = Nebula::instance();
|
Nebula& nd = Nebula::instance();
|
||||||
LifeCycleManager * lcm = nd.get_lcm();
|
LifeCycleManager * lcm = nd.get_lcm();
|
||||||
@ -351,7 +352,8 @@ int DispatchManager::poweroff (
|
|||||||
|
|
||||||
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_POWEROFF))
|
||||||
{
|
{
|
||||||
Nebula& nd = Nebula::instance();
|
Nebula& nd = Nebula::instance();
|
||||||
LifeCycleManager * lcm = nd.get_lcm();
|
LifeCycleManager * lcm = nd.get_lcm();
|
||||||
|
@ -509,7 +509,8 @@ void LifeCycleManager::undeploy_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_UNDEPLOY))
|
||||||
{
|
{
|
||||||
Nebula& nd = Nebula::instance();
|
Nebula& nd = Nebula::instance();
|
||||||
VirtualMachineManager * vmm = nd.get_vmm();
|
VirtualMachineManager * vmm = nd.get_vmm();
|
||||||
@ -518,11 +519,18 @@ void LifeCycleManager::undeploy_action(int vid, bool hard)
|
|||||||
// SHUTDOWN_UNDEPLOY STATE
|
// 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 &&
|
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_POWEROFF))
|
||||||
{
|
{
|
||||||
Nebula& nd = Nebula::instance();
|
Nebula& nd = Nebula::instance();
|
||||||
VirtualMachineManager * vmm = nd.get_vmm();
|
VirtualMachineManager * vmm = nd.get_vmm();
|
||||||
@ -617,11 +626,18 @@ void LifeCycleManager::poweroff_action(int vid, bool hard)
|
|||||||
// SHUTDOWN_POWEROFF STATE
|
// 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:
|
17: //OpenNebula.VM.lcm_state.HOTPLUG:
|
||||||
[],
|
[],
|
||||||
18: //OpenNebula.VM.lcm_state.SHUTDOWN_POWEROFF:
|
18: //OpenNebula.VM.lcm_state.SHUTDOWN_POWEROFF:
|
||||||
[],
|
["VM.poweroff", "VM.poweroff_hard"],
|
||||||
19: //OpenNebula.VM.lcm_state.BOOT_UNKNOWN:
|
19: //OpenNebula.VM.lcm_state.BOOT_UNKNOWN:
|
||||||
["VM.boot"],
|
["VM.boot"],
|
||||||
20: //OpenNebula.VM.lcm_state.BOOT_POWEROFF:
|
20: //OpenNebula.VM.lcm_state.BOOT_POWEROFF:
|
||||||
@ -137,7 +137,7 @@ var lcm_state_actions = {
|
|||||||
28: //OpenNebula.VM.lcm_state.HOTPLUG_SAVEAS_SUSPENDED:
|
28: //OpenNebula.VM.lcm_state.HOTPLUG_SAVEAS_SUSPENDED:
|
||||||
[],
|
[],
|
||||||
29: //OpenNebula.VM.lcm_state.SHUTDOWN_UNDEPLOY:
|
29: //OpenNebula.VM.lcm_state.SHUTDOWN_UNDEPLOY:
|
||||||
[],
|
["VM.undeploy", "VM.undeploy_hard"],
|
||||||
30: //OpenNebula.VM.lcm_state.EPILOG_UNDEPLOY:
|
30: //OpenNebula.VM.lcm_state.EPILOG_UNDEPLOY:
|
||||||
[],
|
[],
|
||||||
31: //OpenNebula.VM.lcm_state.PROLOG_UNDEPLOY:
|
31: //OpenNebula.VM.lcm_state.PROLOG_UNDEPLOY:
|
||||||
|
Loading…
Reference in New Issue
Block a user