Commit 456798ab authored by Iustin Pop's avatar Iustin Pop
Browse files

Add --no-wait-for-sync when converting to drbd



Currently, when converting an instance from plain to DRBD, the
instance is blocked during the entire resync period. This patch adds
the --no-wait-for-sync so that the operation finishes as soon as the
DRBD sync has started, without waiting for the entire sync. This makes
the instance available much faster.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent c8a96ae7
......@@ -1302,7 +1302,8 @@ def SetInstanceParams(opts, args):
os_name=opts.os,
osparams=opts.osparams,
force_variant=opts.force_variant,
force=opts.force)
force=opts.force,
wait_for_sync=opts.wait_for_sync)
# even if here we process the result, we allow submit only
result = SubmitOrSend(op, opts)
......@@ -1448,7 +1449,7 @@ commands = {
SetInstanceParams, ARGS_ONE_INSTANCE,
[BACKEND_OPT, DISK_OPT, FORCE_OPT, HVOPTS_OPT, NET_OPT, SUBMIT_OPT,
DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT],
OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT],
"<instance>", "Alters the parameters of an instance"),
'shutdown': (
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
......
......@@ -9601,7 +9601,8 @@ class LUInstanceSetParams(LogicalUnit):
self.cfg.Update(instance, feedback_fn)
# disks are created, waiting for sync
disk_abort = not _WaitForSync(self, instance)
disk_abort = not _WaitForSync(self, instance,
oneshot=not self.op.wait_for_sync)
if disk_abort:
raise errors.OpExecError("There are some degraded disks for"
" this instance, please cleanup manually")
......
......@@ -989,6 +989,7 @@ class OpInstanceSetParams(OpCode):
("os_name", None, ht.TMaybeString),
("force_variant", False, ht.TBool),
("osparams", None, ht.TMaybeDict),
("wait_for_sync", True, ht.TBool),
]
......
......@@ -876,7 +876,7 @@ MODIFY
| [--net add*[:options]* \| --net remove \| --net *N:options*]
| [--disk add:size=*SIZE*[,vg=*VG*][,metavg=*VG*] \| --disk remove \|
| --disk *N*:mode=*MODE*]
| [-t plain | -t drbd -n *new_secondary*]
| [-t plain | -t drbd -n *new_secondary*] [--no-wait-for-sync]
| [--os-type=*OS* [--force-variant]]
| [-O, --os-parameters *param*=*value*... ]
| [--submit]
......@@ -895,7 +895,10 @@ The ``-t`` option will change the disk template of the instance.
Currently only conversions between the plain and drbd disk templates
are supported, and the instance must be stopped before attempting the
conversion. When changing from the plain to the drbd disk template, a
new secondary node must be specified via the ``-n`` option.
new secondary node must be specified via the ``-n`` option. The option
``--no-wait-for-sync`` can be used when converting to the ``drbd``
template in order to make the instance available for startup before
DRBD has finished resyncing.
The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
optional ``vg=``*VG* option specifies LVM volume group other than
......
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