Commit f30d8165 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add --wait-for-sync in gnt-instance



Note that this needs (like for the opcode) a new option, with the
default reverted (False instead of True).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent b69437c5
......@@ -195,6 +195,7 @@ __all__ = [
"USE_REPL_NET_OPT",
"VERBOSE_OPT",
"VG_NAME_OPT",
"WFSYNC_OPT",
"YES_DOIT_OPT",
"DISK_STATE_OPT",
"HV_STATE_OPT",
......@@ -747,6 +748,10 @@ NWSYNC_OPT = cli_option("--no-wait-for-sync", dest="wait_for_sync",
default=True, action="store_false",
help="Don't wait for sync (DANGEROUS!)")
WFSYNC_OPT = cli_option("--wait-for-sync", dest="wait_for_sync",
default=False, action="store_true",
help="Wait for disks to sync")
ONLINE_INST_OPT = cli_option("--online", dest="online_inst",
action="store_true", default=False,
help="Enable offline instance")
......
......@@ -566,7 +566,8 @@ def ActivateDisks(opts, args):
"""
instance_name = args[0]
op = opcodes.OpInstanceActivateDisks(instance_name=instance_name,
ignore_size=opts.ignore_size)
ignore_size=opts.ignore_size,
wait_for_sync=opts.wait_for_sync)
disks_info = SubmitOrSend(op, opts)
for host, iname, nname in disks_info:
ToStdout("%s:%s:%s", host, iname, nname)
......@@ -1620,7 +1621,7 @@ commands = {
"<instance>", "Reboots an instance"),
"activate-disks": (
ActivateDisks, ARGS_ONE_INSTANCE,
[SUBMIT_OPT, IGNORE_SIZE_OPT, PRIORITY_OPT],
[SUBMIT_OPT, IGNORE_SIZE_OPT, PRIORITY_OPT, WFSYNC_OPT],
"<instance>", "Activate an instance's disks"),
"deactivate-disks": (
DeactivateDisks, ARGS_ONE_INSTANCE,
......
......@@ -1301,7 +1301,7 @@ options.
ACTIVATE-DISKS
^^^^^^^^^^^^^^
**activate-disks** [\--submit] [\--ignore-size] {*instance*}
**activate-disks** [\--submit] [\--ignore-size] [\--wait-for-sync] {*instance*}
Activates the block devices of the given instance. If successful, the
command will show the location and name of the block devices::
......@@ -1323,6 +1323,13 @@ where the configuration has gotten out of sync with the real-world
in LVM devices). This should not be used in normal cases, but only
when activate-disks fails without it.
The ``--wait-for-sync`` option will ensure that the command returns only
after the instance's disks are synchronised (mostly for DRBD); this can
be useful to ensure consistency, as otherwise there are no commands that
can wait until synchronisation is done. However when passing this
option, the command will have additional output, making it harder to
parse the disk information.
Note that it is safe to run this command while the instance is already
running.
......
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