Revision 20d317d4 lib/cmdlib.py
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: |
Also available in: Unified diff