Commit 35c0c8da authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert bridges_exist to new style result

This was a very simple (boolean) RPC, so converting it to actually have
more value with the new style results was more difficult.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent e480923b
......@@ -574,11 +574,15 @@ def BridgesExist(bridges_list):
@return: C{True} if all of them exist, C{False} otherwise
missing = []
for bridge in bridges_list:
if not utils.BridgeExists(bridge):
return False
return True
if missing:
return False, "Missing bridges %s" % (", ".join(missing),)
return True, None
def GetInstanceList(hypervisor_list):
......@@ -610,11 +610,10 @@ def _CheckNicsBridgesExist(lu, target_nics, target_node,
if params[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED]
if brlist:
result = lu.rpc.call_bridges_exist(target_node, brlist)
if not
raise errors.OpPrereqError("One or more target bridges %s does not"
" exist on destination node '%s'" %
(brlist, target_node))
msg = result.RemoteFailMsg()
if msg:
raise errors.OpPrereqError("Error checking bridges on destination node"
" '%s': %s" % (target_node, msg))
def _CheckInstanceBridgesExist(lu, instance, node=None):
......@@ -6166,10 +6165,9 @@ class LUSetInstanceParams(LogicalUnit):
if new_nic_mode == constants.NIC_MODE_BRIDGED:
nic_bridge = new_filled_nic_params[constants.NIC_LINK]
result = self.rpc.call_bridges_exist(pnode, [nic_bridge])
if not
msg = ("Bridge '%s' doesn't exist on one of"
" the instance nodes" % nic_bridge)
msg = result.RemoteFailMsg()
if msg:
msg = "Error checking bridges on node %s: %s" % (pnode, msg)
if self.force:
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