From a0aaa0d0a36f8e05fd82d96fbab643347985ab6f Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 2 Apr 2008 18:05:54 +0000
Subject: [PATCH] Handle better failing over non-running instances

Right now if you try to failover an instance which is not marked as up the
operation will fail unless you pass the --ignore-consistency flag because the
disks won't be considered to be consistent. Allow them to be if we know the
instance shouldn't be up.

Reviewed-by: imsnah
---
 lib/cmdlib.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 173f87bb8..96e028d43 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -2634,7 +2634,7 @@ class LUFailoverInstance(LogicalUnit):
     for dev in instance.disks:
       # for remote_raid1, these are md over drbd
       if not _CheckDiskConsistency(self.cfg, dev, target_node, False):
-        if not self.op.ignore_consistency:
+        if instance.status == "up" and not self.op.ignore_consistency:
           raise errors.OpExecError("Disk %s is degraded on target node,"
                                    " aborting failover." % dev.iv_name)
 
-- 
GitLab