diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h
index c47e22e882..bc0928dc4b 100644
--- a/include/VirtualMachine.h
+++ b/include/VirtualMachine.h
@@ -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
};
// -------------------------------------------------------------------------
diff --git a/share/doc/states/states-complete.dot b/share/doc/states/states-complete.dot
index c1e01b4be2..1bbf5c456b 100644
--- a/share/doc/states/states-complete.dot
+++ b/share/doc/states/states-complete.dot
@@ -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"];
}
diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd
index e8ff06e4c9..c5fa3f6919 100644
--- a/share/doc/xsd/acct.xsd
+++ b/share/doc/xsd/acct.xsd
@@ -82,24 +82,27 @@
diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd
index 81155bd02b..a30ecfe3c3 100644
--- a/share/doc/xsd/vm.xsd
+++ b/share/doc/xsd/vm.xsd
@@ -44,24 +44,27 @@
diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc
index 2c9d9a818b..c652b10cf2 100644
--- a/src/dm/DispatchManagerActions.cc
+++ b/src/dm/DispatchManagerActions.cc
@@ -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();
diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc
index cb617b6cb1..c71d3afdc8 100644
--- a/src/lcm/LifeCycleActions.cc
+++ b/src/lcm/LifeCycleActions.cc
@@ -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:
diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc
index d46dbb7c76..bd37bdae0a 100644
--- a/src/lcm/LifeCycleStates.cc
+++ b/src/lcm/LifeCycleStates.cc
@@ -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();
}
diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
index d9e8bd2add..fe8d3756aa 100644
--- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
+++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
@@ -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()
diff --git a/src/oca/ruby/OpenNebula/VirtualMachine.rb b/src/oca/ruby/OpenNebula/VirtualMachine.rb
index a9cb2c50d2..ccab73f4e2 100644
--- a/src/oca/ruby/OpenNebula/VirtualMachine.rb
+++ b/src/oca/ruby/OpenNebula/VirtualMachine.rb
@@ -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}
diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js
index e41a7206eb..c72410e95f 100644
--- a/src/ozones/Server/public/js/ozones.js
+++ b/src/ozones/Server/public/js/ozones.js
@@ -97,7 +97,9 @@ var oZones = {
"CLEANUP",
"UNKNOWN",
"HOTPLUG",
- "SHUTDOWN_POWEROFF"][value]);
+ "SHUTDOWN_POWEROFF",
+ "BOOT_UNKNOWN",
+ "BOOT_POWEROFF"][value]);
break;
case "IMAGE":
case "image":
diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js
index e5feba7291..0c99d429b1 100644
--- a/src/sunstone/public/js/opennebula.js
+++ b/src/sunstone/public/js/opennebula.js
@@ -97,7 +97,9 @@ var OpenNebula = {
"CLEANUP",
"UNKNOWN",
"HOTPLUG",
- "SHUTDOWN_POWEROFF"][value]);
+ "SHUTDOWN_POWEROFF",
+ "BOOT_UNKNOWN",
+ "BOOT_POWEROFF"][value]);
break;
case "IMAGE":
case "image":