diff --git a/lib/cmdlib.py b/lib/cmdlib.py index e5f0451f780d6fab3e32d6d62d859b699c1f1305..b945cdbb5db4c973225e91201d47151918e6a2c9 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -6336,6 +6336,10 @@ class LUInstanceActivateDisks(NoHooksLU): if not disks_ok: raise errors.OpExecError("Cannot activate block devices") + if self.op.wait_for_sync: + if not _WaitForSync(self, self.instance): + raise errors.OpExecError("Some disks of the instance are degraded!") + return disks_info diff --git a/lib/opcodes.py b/lib/opcodes.py index f9d276048fb321572dcc30cef284ac9cf3030cce..bdbf7638ec7b530a6af5317941bc120b4c85731a 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -93,6 +93,10 @@ _PForceVariant = ("force_variant", False, ht.TBool, _PWaitForSync = ("wait_for_sync", True, ht.TBool, "Whether to wait for the disk to synchronize") +_PWaitForSyncFalse = ("wait_for_sync", False, ht.TBool, + "Whether to wait for the disk to synchronize" + " (defaults to false)") + _PIgnoreConsistency = ("ignore_consistency", False, ht.TBool, "Whether to ignore disk consistency") @@ -1402,6 +1406,7 @@ class OpInstanceActivateDisks(OpCode): OP_PARAMS = [ _PInstanceName, ("ignore_size", False, ht.TBool, "Whether to ignore recorded size"), + _PWaitForSyncFalse, ] OP_RESULT = ht.TListOf(ht.TAnd(ht.TIsLength(3), ht.TItems([ht.TNonEmptyString,