From b69437c597aa0786077d70280e611cb5ca66f435 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 5 Jul 2012 15:19:38 +0200 Subject: [PATCH] 9Add wait_for_sync flag to OpInstanceActivateDisks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This can be used to ensure that after activate-disks has returned, the instance's storage is consistent; currently there's no programmatic way to do this. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/cmdlib.py | 4 ++++ lib/opcodes.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index e5f0451f7..b945cdbb5 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 f9d276048..bdbf7638e 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, -- GitLab