This will allow stopping or starting an instance without changing the
remembered state. While this seems counter-intuitive at first (it will
create cluster verify errors), it can help in a few corner cases:
- shutting down an entire cluster for maintenance but without having
to remember state
- doing testing of Ganeti itself
---
lib/cmdlib.py | 6 ++++--
lib/opcodes.py | 5 +++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 8b2374c..c95cdfd 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -5191,7 +5191,8 @@ class LUInstanceStartup(LogicalUnit):
instance = self.instance
force = self.op.force
- self.cfg.MarkInstanceUp(instance.name)
+ if not self.op.no_remember:
+ self.cfg.MarkInstanceUp(instance.name)
if self.primary_offline:
assert self.op.ignore_offline_nodes
@@ -5332,7 +5333,8 @@ class LUInstanceShutdown(LogicalUnit):
node_current = instance.primary_node
timeout = self.op.timeout
- self.cfg.MarkInstanceDown(instance.name)
+ if not self.op.no_remember:
+ self.cfg.MarkInstanceDown(instance.name)
if self.primary_offline:
assert self.op.ignore_offline_nodes
diff --git a/lib/opcodes.py b/lib/opcodes.py
index d04c969..b89444d 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -81,6 +81,9 @@ _PTags = ("tags", ht.NoDefault,
ht.TListOf(ht.TNonEmptyString))
#: Ignore consistency
_PIgnoreConsistency = ("ignore_consistency", False, ht.TBool)
+#: Do not remember instance state changes
+_PNoRemember = ("no_remember", False, ht.TBool)
+
#: OP_ID conversion regular expression
_OPID_RE = re.compile("([a-z])([A-Z])")
@@ -837,6 +840,7 @@ class OpInstanceStartup(OpCode):
_PInstanceName,
_PForce,
_PIgnoreOfflineNodes,
+ _PNoRemember,
("hvparams", ht.EmptyDict, ht.TDict),
("beparams", ht.EmptyDict, ht.TDict),
]
@@ -848,6 +852,7 @@ class OpInstanceShutdown(OpCode):
OP_PARAMS = [
_PInstanceName,
_PIgnoreOfflineNodes,
+ _PNoRemember,
("timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT, ht.TPositiveInt),
]
--
1.7.3.1