Revision 20d317d4

b/lib/backend.py
644 644
  if constants.NV_OSLIST in what and vm_capable:
645 645
    result[constants.NV_OSLIST] = DiagnoseOS()
646 646

  
647
  if constants.NV_BRIDGES in what and vm_capable:
648
    result[constants.NV_BRIDGES] = [bridge
649
                                    for bridge in what[constants.NV_BRIDGES]
650
                                    if not utils.BridgeExists(bridge)]
647 651
  return result
648 652

  
649 653

  
b/lib/cmdlib.py
1480 1480
        _ErrorIf(test, self.ENODELVM, node, "Invalid character ':' in PV"
1481 1481
                 " '%s' of VG '%s'", pvname, owner_vg)
1482 1482

  
1483
  def _VerifyNodeBridges(self, ninfo, nresult, bridges):
1484
    """Check the node bridges.
1485

  
1486
    @type ninfo: L{objects.Node}
1487
    @param ninfo: the node to check
1488
    @param nresult: the remote results for the node
1489
    @param vg_name: the expected list of bridges
1490

  
1491
    """
1492
    if not bridges:
1493
      return
1494

  
1495
    node = ninfo.name
1496
    _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103
1497

  
1498
    missing = nresult.get(constants.NV_BRIDGES, None)
1499
    test = not isinstance(missing, list)
1500
    _ErrorIf(test, self.ENODENET, node,
1501
             "did not return valid bridge information")
1502
    if not test:
1503
      _ErrorIf(bool(missing), self.ENODENET, node, "missing bridges: %s" %
1504
               utils.CommaJoin(sorted(missing)))
1505

  
1483 1506
  def _VerifyNodeNetwork(self, ninfo, nresult):
1484 1507
    """Check the node time.
1485 1508

  
......
2177 2200
    if drbd_helper:
2178 2201
      node_verify_param[constants.NV_DRBDHELPER] = drbd_helper
2179 2202

  
2203
    # bridge checks
2204
    # FIXME: this needs to be changed per node-group, not cluster-wide
2205
    bridges = set()
2206
    default_nicpp = cluster.nicparams[constants.PP_DEFAULT]
2207
    if default_nicpp[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
2208
      bridges.add(default_nicpp[constants.NIC_LINK])
2209
    for instance in instanceinfo.values():
2210
      for nic in instance.nics:
2211
        full_nic = cluster.SimpleFillNIC(nic.nicparams)
2212
        if full_nic[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
2213
          bridges.add(full_nic[constants.NIC_LINK])
2214

  
2215
    if bridges:
2216
      node_verify_param[constants.NV_BRIDGES] = list(bridges)
2217

  
2180 2218
    # Build our expected cluster state
2181 2219
    node_image = dict((node.name, self.NodeImage(offline=node.offline,
2182 2220
                                                 name=node.name,
......
2287 2325
          if refos_img is None:
2288 2326
            refos_img = nimg
2289 2327
          self._VerifyNodeOS(node_i, nimg, refos_img)
2328
        self._VerifyNodeBridges(node_i, nresult, bridges)
2290 2329

  
2291 2330
    feedback_fn("* Verifying instance status")
2292 2331
    for instance in instancelist:
b/lib/constants.py
870 870
NV_VGLIST = "vglist"
871 871
NV_VMNODES = "vmnodes"
872 872
NV_OOB_PATHS = "oob-paths"
873
NV_BRIDGES = "bridges"
873 874

  
874 875
# SSL certificate check constants (in days)
875 876
SSL_CERT_EXPIRATION_WARN = 30

Also available in: Unified diff