mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-24 21:34:01 +03:00
Merge branch 'bug-1557'
This commit is contained in:
commit
562a958f19
@ -65,25 +65,27 @@ public:
|
||||
*/
|
||||
enum LcmState
|
||||
{
|
||||
LCM_INIT = 0,
|
||||
PROLOG = 1,
|
||||
BOOT = 2,
|
||||
RUNNING = 3,
|
||||
MIGRATE = 4,
|
||||
SAVE_STOP = 5,
|
||||
SAVE_SUSPEND = 6,
|
||||
SAVE_MIGRATE = 7,
|
||||
PROLOG_MIGRATE = 8,
|
||||
PROLOG_RESUME = 9,
|
||||
EPILOG_STOP = 10,
|
||||
EPILOG = 11,
|
||||
SHUTDOWN = 12,
|
||||
CANCEL = 13,
|
||||
FAILURE = 14,
|
||||
CLEANUP = 15,
|
||||
UNKNOWN = 16,
|
||||
HOTPLUG = 17,
|
||||
SHUTDOWN_POWEROFF = 18
|
||||
LCM_INIT = 0,
|
||||
PROLOG = 1,
|
||||
BOOT = 2,
|
||||
RUNNING = 3,
|
||||
MIGRATE = 4,
|
||||
SAVE_STOP = 5,
|
||||
SAVE_SUSPEND = 6,
|
||||
SAVE_MIGRATE = 7,
|
||||
PROLOG_MIGRATE = 8,
|
||||
PROLOG_RESUME = 9,
|
||||
EPILOG_STOP = 10,
|
||||
EPILOG = 11,
|
||||
SHUTDOWN = 12,
|
||||
CANCEL = 13,
|
||||
FAILURE = 14,
|
||||
CLEANUP = 15,
|
||||
UNKNOWN = 16,
|
||||
HOTPLUG = 17,
|
||||
SHUTDOWN_POWEROFF = 18,
|
||||
BOOT_UNKNOWN = 19,
|
||||
BOOT_POWEROFF = 20
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
digraph OpenNebula {
|
||||
graph [
|
||||
nodesep= 0.5,
|
||||
ratio=0.7,
|
||||
pad=1,
|
||||
nodesep=0.5,
|
||||
ratio=0.8,
|
||||
pad=0.5,
|
||||
];
|
||||
|
||||
node [fontname="Helvetica"];
|
||||
@ -19,6 +19,7 @@ digraph OpenNebula {
|
||||
"ANY \\ {suspended,done}" [ shape="box" ];
|
||||
|
||||
subgraph { rank = min; user}
|
||||
subgraph { rank = same; boot; boot_unknown; boot_poweroff; unknown; color="white"}
|
||||
subgraph { rank = same; pending; hold; color="white"}
|
||||
subgraph { rank = same; prolog; prolog_resume; prolog_migrate;
|
||||
color="white" }
|
||||
@ -82,9 +83,17 @@ digraph OpenNebula {
|
||||
ANY -> done [label="delete"];
|
||||
|
||||
# restart
|
||||
unknown -> boot [label="restart"];
|
||||
boot -> boot [label="restart"];
|
||||
poweroff -> boot [label="restart"];
|
||||
|
||||
poweroff -> boot_poweroff [label="restart"];
|
||||
boot_poweroff -> boot_poweroff [label="restart"];
|
||||
boot_poweroff -> running [style="dashed"];
|
||||
boot_poweroff -> poweroff [style="dotted"];
|
||||
|
||||
unknown -> boot_unknown [label="restart"];
|
||||
boot_unknown -> boot_unknown [label="restart"];
|
||||
boot_unknown -> running [style="dashed"];
|
||||
boot_unknown -> unknown [style="dotted"];
|
||||
|
||||
# reboot, reset
|
||||
running -> running [label="reboot / reset"];
|
||||
@ -105,6 +114,6 @@ digraph OpenNebula {
|
||||
boot -> failure [style="dotted"];
|
||||
|
||||
|
||||
running -> unknown [style="dashed"];
|
||||
running -> unknown [style="dotted"];
|
||||
unknown -> running [style="dashed"];
|
||||
}
|
||||
|
@ -82,24 +82,27 @@
|
||||
<!-- LCM_STATE values, this sub-state is relevant only when STATE is
|
||||
ACTIVE (4)
|
||||
|
||||
LCM_INIT = 0
|
||||
PROLOG = 1
|
||||
BOOT = 2
|
||||
RUNNING = 3
|
||||
MIGRATE = 4
|
||||
SAVE_STOP = 5
|
||||
SAVE_SUSPEND = 6
|
||||
SAVE_MIGRATE = 7
|
||||
PROLOG_MIGRATE = 8
|
||||
PROLOG_RESUME = 9
|
||||
EPILOG_STOP = 10
|
||||
EPILOG = 11
|
||||
SHUTDOWN = 12
|
||||
CANCEL = 13
|
||||
FAILURE = 14
|
||||
CLEANUP = 15
|
||||
UNKNOWN = 16
|
||||
HOTPLUG = 17
|
||||
LCM_INIT = 0
|
||||
PROLOG = 1
|
||||
BOOT = 2
|
||||
RUNNING = 3
|
||||
MIGRATE = 4
|
||||
SAVE_STOP = 5
|
||||
SAVE_SUSPEND = 6
|
||||
SAVE_MIGRATE = 7
|
||||
PROLOG_MIGRATE = 8
|
||||
PROLOG_RESUME = 9
|
||||
EPILOG_STOP = 10
|
||||
EPILOG = 11
|
||||
SHUTDOWN = 12
|
||||
CANCEL = 13
|
||||
FAILURE = 14
|
||||
CLEANUP = 15
|
||||
UNKNOWN = 16
|
||||
HOTPLUG = 17
|
||||
SHUTDOWN_POWEROFF = 18
|
||||
BOOT_UNKNOWN = 19
|
||||
BOOT_POWEROFF = 20
|
||||
-->
|
||||
<xs:element name="LCM_STATE" type="xs:integer"/>
|
||||
<xs:element name="RESCHED" type="xs:integer"/>
|
||||
|
@ -44,24 +44,27 @@
|
||||
<!-- LCM_STATE values, this sub-state is relevant only when STATE is
|
||||
ACTIVE (4)
|
||||
|
||||
LCM_INIT = 0
|
||||
PROLOG = 1
|
||||
BOOT = 2
|
||||
RUNNING = 3
|
||||
MIGRATE = 4
|
||||
SAVE_STOP = 5
|
||||
SAVE_SUSPEND = 6
|
||||
SAVE_MIGRATE = 7
|
||||
PROLOG_MIGRATE = 8
|
||||
PROLOG_RESUME = 9
|
||||
EPILOG_STOP = 10
|
||||
EPILOG = 11
|
||||
SHUTDOWN = 12
|
||||
CANCEL = 13
|
||||
FAILURE = 14
|
||||
CLEANUP = 15
|
||||
UNKNOWN = 16
|
||||
HOTPLUG = 17
|
||||
LCM_INIT = 0
|
||||
PROLOG = 1
|
||||
BOOT = 2
|
||||
RUNNING = 3
|
||||
MIGRATE = 4
|
||||
SAVE_STOP = 5
|
||||
SAVE_SUSPEND = 6
|
||||
SAVE_MIGRATE = 7
|
||||
PROLOG_MIGRATE = 8
|
||||
PROLOG_RESUME = 9
|
||||
EPILOG_STOP = 10
|
||||
EPILOG = 11
|
||||
SHUTDOWN = 12
|
||||
CANCEL = 13
|
||||
FAILURE = 14
|
||||
CLEANUP = 15
|
||||
UNKNOWN = 16
|
||||
HOTPLUG = 17
|
||||
SHUTDOWN_POWEROFF = 18
|
||||
BOOT_UNKNOWN = 19
|
||||
BOOT_POWEROFF = 20
|
||||
-->
|
||||
<xs:element name="LCM_STATE" type="xs:integer"/>
|
||||
<xs:element name="RESCHED" type="xs:integer"/>
|
||||
|
@ -554,7 +554,9 @@ int DispatchManager::restart(int vid)
|
||||
|
||||
if ((vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT))
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF))
|
||||
|| vm->get_state() == VirtualMachine::POWEROFF )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
@ -498,7 +498,9 @@ void LifeCycleManager::restart_action(int vid)
|
||||
|
||||
if ((vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
(vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT ))
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF))
|
||||
||vm->get_state() == VirtualMachine::POWEROFF)
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
@ -509,18 +511,29 @@ void LifeCycleManager::restart_action(int vid)
|
||||
//----------------------------------------------------
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT)
|
||||
(vm->get_lcm_state() == VirtualMachine::BOOT ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
|
||||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF))
|
||||
{
|
||||
vm->log("LCM", Log::INFO, "Sending BOOT command to VM again");
|
||||
}
|
||||
else
|
||||
else if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN)
|
||||
{
|
||||
vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff
|
||||
vm->set_state(VirtualMachine::BOOT);
|
||||
vm->set_state(VirtualMachine::BOOT_UNKNOWN);
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->log("LCM", Log::INFO, "New VM state is BOOT");
|
||||
vm->log("LCM", Log::INFO, "New VM state is BOOT_UNKNOWN");
|
||||
}
|
||||
else // if ( vm->get_state() == VirtualMachine::POWEROFF )
|
||||
{
|
||||
vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff
|
||||
vm->set_state(VirtualMachine::BOOT_POWEROFF);
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->log("LCM", Log::INFO, "New VM state is BOOT_POWEROFF");
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
@ -644,6 +657,8 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
||||
break;
|
||||
|
||||
case VirtualMachine::BOOT:
|
||||
case VirtualMachine::BOOT_UNKNOWN:
|
||||
case VirtualMachine::BOOT_POWEROFF:
|
||||
case VirtualMachine::RUNNING:
|
||||
case VirtualMachine::UNKNOWN:
|
||||
case VirtualMachine::SHUTDOWN:
|
||||
|
@ -356,6 +356,23 @@ void LifeCycleManager::deploy_failure_action(int vid)
|
||||
|
||||
failure_action(vm);
|
||||
}
|
||||
else if (vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN)
|
||||
{
|
||||
vm->set_state(VirtualMachine::UNKNOWN);
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is UNKNOWN");
|
||||
}
|
||||
else if (vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF)
|
||||
{
|
||||
vm->set_state(VirtualMachine::POWEROFF);
|
||||
vm->set_state(VirtualMachine::LCM_INIT);
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is POWEROFF");
|
||||
}
|
||||
|
||||
vm->unlock();
|
||||
}
|
||||
|
@ -84,7 +84,9 @@ public class VirtualMachine extends PoolElement{
|
||||
"CLEANUP",
|
||||
"UNKNOWN",
|
||||
"HOTPLUG",
|
||||
"SHUTDOWN_POWEROFF" };
|
||||
"SHUTDOWN_POWEROFF",
|
||||
"BOOT_UNKNOWN",
|
||||
"BOOT_POWEROFF" };
|
||||
|
||||
private static final String[] SHORT_LCM_STATES =
|
||||
{
|
||||
@ -106,7 +108,9 @@ public class VirtualMachine extends PoolElement{
|
||||
"clea",
|
||||
"unkn",
|
||||
"hotp",
|
||||
"poff" };
|
||||
"poff",
|
||||
"boot",
|
||||
"boot" };
|
||||
|
||||
/**
|
||||
* Creates a new VM representation.
|
||||
@ -585,7 +589,7 @@ public class VirtualMachine extends PoolElement{
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces a re-deployment of a VM in UNKNOWN or BOOT state.
|
||||
* Forces a re-deployment of a VM in UNKNOWN or BOOT states.
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse restart()
|
||||
|
@ -43,7 +43,8 @@ module OpenNebula
|
||||
|
||||
LCM_STATE=%w{LCM_INIT PROLOG BOOT RUNNING MIGRATE SAVE_STOP SAVE_SUSPEND
|
||||
SAVE_MIGRATE PROLOG_MIGRATE PROLOG_RESUME EPILOG_STOP EPILOG
|
||||
SHUTDOWN CANCEL FAILURE CLEANUP UNKNOWN HOTPLUG SHUTDOWN_POWEROFF}
|
||||
SHUTDOWN CANCEL FAILURE CLEANUP UNKNOWN HOTPLUG SHUTDOWN_POWEROFF
|
||||
BOOT_UNKNOWN BOOT_POWEROFF}
|
||||
|
||||
SHORT_VM_STATES={
|
||||
"INIT" => "init",
|
||||
@ -75,7 +76,9 @@ module OpenNebula
|
||||
"CLEANUP" => "clea",
|
||||
"UNKNOWN" => "unkn",
|
||||
"HOTPLUG" => "hotp",
|
||||
"SHUTDOWN_POWEROFF" => "shut"
|
||||
"SHUTDOWN_POWEROFF" => "shut",
|
||||
"BOOT_UNKNOWN" => "boot",
|
||||
"BOOT_POWEROFF" => "boot"
|
||||
}
|
||||
|
||||
MIGRATE_REASON=%w{NONE ERROR STOP_RESUME USER CANCEL}
|
||||
|
@ -97,7 +97,9 @@ var oZones = {
|
||||
"CLEANUP",
|
||||
"UNKNOWN",
|
||||
"HOTPLUG",
|
||||
"SHUTDOWN_POWEROFF"][value]);
|
||||
"SHUTDOWN_POWEROFF",
|
||||
"BOOT_UNKNOWN",
|
||||
"BOOT_POWEROFF"][value]);
|
||||
break;
|
||||
case "IMAGE":
|
||||
case "image":
|
||||
|
@ -97,7 +97,9 @@ var OpenNebula = {
|
||||
"CLEANUP",
|
||||
"UNKNOWN",
|
||||
"HOTPLUG",
|
||||
"SHUTDOWN_POWEROFF"][value]);
|
||||
"SHUTDOWN_POWEROFF",
|
||||
"BOOT_UNKNOWN",
|
||||
"BOOT_POWEROFF"][value]);
|
||||
break;
|
||||
case "IMAGE":
|
||||
case "image":
|
||||
|
Loading…
Reference in New Issue
Block a user