From 50ff9a7acf800a15c2ee7704d4f562ad6148bbc1 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 31 Oct 2007 14:55:01 +0000
Subject: [PATCH] Fix bridge checking in instance failover

The current code checks the bridge on the primary node of the instance,
but we need to check it on the destination node.

This was caught by testing failover with a down primary node.

Reviewed-by: imsnah
---
 lib/cmdlib.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index c071c96a0..697e902b0 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -2480,10 +2480,10 @@ class LUFailoverInstance(LogicalUnit):
 
     # check bridge existance
     brlist = [nic.bridge for nic in instance.nics]
-    if not rpc.call_bridges_exist(instance.primary_node, brlist):
+    if not rpc.call_bridges_exist(target_node, brlist):
       raise errors.OpPrereqError("One or more target bridges %s does not"
                                  " exist on destination node '%s'" %
-                                 (brlist, instance.primary_node))
+                                 (brlist, target_node))
 
     self.instance = instance
 
-- 
GitLab