Commit 885a0fc4 authored by Iustin Pop's avatar Iustin Pop
Browse files

Implement no_remember at CLI level


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 9b64e486
......@@ -126,6 +126,7 @@ __all__ = [
"NOSTART_OPT",
"NOSSH_KEYCHECK_OPT",
"NOVOTING_OPT",
"NO_REMEMBER_OPT",
"NWSYNC_OPT",
"ON_PRIMARY_OPT",
"ON_SECONDARY_OPT",
......@@ -1149,6 +1150,12 @@ NODE_POWERED_OPT = cli_option("--node-powered", default=None,
dest="node_powered",
help="Specify if the SoR for node is powered")
NO_REMEMBER_OPT = cli_option("--no-remember",
dest="no_remember",
action="store_true", default=False,
help="Perform but do not record the change"
" in the configuration")
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT]
......
......@@ -692,7 +692,8 @@ def _StartupInstance(name, opts):
"""
op = opcodes.OpInstanceStartup(instance_name=name,
force=opts.force,
ignore_offline_nodes=opts.ignore_offline)
ignore_offline_nodes=opts.ignore_offline,
no_remember=opts.no_remember)
# do not add these parameters to the opcode unless they're defined
if opts.hvparams:
op.hvparams = opts.hvparams
......@@ -731,7 +732,8 @@ def _ShutdownInstance(name, opts):
"""
return opcodes.OpInstanceShutdown(instance_name=name,
timeout=opts.timeout,
ignore_offline_nodes=opts.ignore_offline)
ignore_offline_nodes=opts.ignore_offline,
no_remember=opts.no_remember)
def ReplaceDisks(opts, args):
......@@ -1457,14 +1459,15 @@ commands = {
[m_node_opt, m_pri_node_opt, m_sec_node_opt, m_clust_opt,
m_node_tags_opt, m_pri_node_tags_opt, m_sec_node_tags_opt,
m_inst_tags_opt, m_inst_opt, m_force_multi, TIMEOUT_OPT, SUBMIT_OPT,
DRY_RUN_OPT, PRIORITY_OPT, IGNORE_OFFLINE_OPT],
DRY_RUN_OPT, PRIORITY_OPT, IGNORE_OFFLINE_OPT, NO_REMEMBER_OPT],
"<instance>", "Stops an instance"),
'startup': (
GenericManyOps("startup", _StartupInstance), [ArgInstance()],
[FORCE_OPT, m_force_multi, m_node_opt, m_pri_node_opt, m_sec_node_opt,
m_node_tags_opt, m_pri_node_tags_opt, m_sec_node_tags_opt,
m_inst_tags_opt, m_clust_opt, m_inst_opt, SUBMIT_OPT, HVOPTS_OPT,
BACKEND_OPT, DRY_RUN_OPT, PRIORITY_OPT, IGNORE_OFFLINE_OPT],
BACKEND_OPT, DRY_RUN_OPT, PRIORITY_OPT, IGNORE_OFFLINE_OPT,
NO_REMEMBER_OPT],
"<instance>", "Starts an instance"),
'reboot': (
GenericManyOps("reboot", _RebootInstance), [ArgInstance()],
......
......@@ -989,7 +989,7 @@ STARTUP
| **startup**
| [--force] [--ignore-offline]
| [--force-multiple]
| [--force-multiple] [--no-remember]
| [--instance \| --node \| --primary \| --secondary \| --all \|
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
| [{-H|--hypervisor-parameters} ``key=value...``]
......@@ -1047,6 +1047,12 @@ mark the instance as started even if the primary is not available.
The ``--force-multiple`` will skip the interactive confirmation in the
case the more than one instance will be affected.
The ``--no-remember`` option will perform the startup but not change
the state of the instance in the configuration file (if it was stopped
before, Ganeti will still thinks it needs to be stopped). This can be
used for testing, or for a one shot-start where you don't want the
watcher to restart the instance if it crashes.
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
options specify temporary hypervisor and backend parameters that can
be used to start an instance with modified parameters. They can be
......@@ -1079,7 +1085,7 @@ SHUTDOWN
| **shutdown**
| [--timeout=*N*]
| [--force-multiple] [--ignore-offline]
| [--force-multiple] [--ignore-offline] [--no-remember]
| [--instance \| --node \| --primary \| --secondary \| --all \|
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
| [--submit]
......@@ -1108,6 +1114,15 @@ can be examined via **gnt-job info**.
force the instance to be marked as stopped. This option should be used
with care as it can lead to an inconsistent cluster state.
The ``--no-remember`` option will perform the shutdown but not change
the state of the instance in the configuration file (if it was running
before, Ganeti will still thinks it needs to be running). This can be
useful for a cluster-wide shutdown, where some instances are marked as
up and some as down, and you don't want to change the running state:
you just need to disable the watcher, shutdown all instances with
``--no-remember``, and when the watcher is activated again it will
restore the correct runtime state for all instances.
Example::
# gnt-instance shutdown instance1.example.com
......
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