Commit 9b64e486 authored by Iustin Pop's avatar Iustin Pop
Browse files

Introduce instance start/stop no_remember attribute



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
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent ccce780c
......@@ -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
......
......@@ -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),
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment