Revision fe870648
b/lib/cmdlib.py | ||
---|---|---|
1528 | 1528 |
for inst in all_inst_info.values() |
1529 | 1529 |
if inst.primary_node in node_names] |
1530 | 1530 |
|
1531 |
# In Exec(), we warn about mirrored instances that have primary and |
|
1532 |
# secondary living in separate node groups. To fully verify that |
|
1533 |
# volumes for these instances are healthy, we will need to do an |
|
1534 |
# extra call to their secondaries. We ensure here those nodes will |
|
1535 |
# be locked. |
|
1536 |
for inst in inst_names: |
|
1537 |
if all_inst_info[inst].disk_template in constants.DTS_INT_MIRROR: |
|
1538 |
node_names.update(all_inst_info[inst].secondary_nodes) |
|
1539 |
|
|
1531 | 1540 |
self.needed_locks = { |
1532 | 1541 |
locking.LEVEL_NODEGROUP: [self.group_uuid], |
1533 | 1542 |
locking.LEVEL_NODE: list(node_names), |
... | ... | |
1571 | 1580 |
self.my_inst_info = dict((name, self.all_inst_info[name]) |
1572 | 1581 |
for name in self.my_inst_names) |
1573 | 1582 |
|
1583 |
# We detect here the nodes that will need the extra RPC calls for verifying |
|
1584 |
# split LV volumes; they should be locked. |
|
1585 |
extra_lv_nodes = set() |
|
1586 |
|
|
1587 |
for inst in self.my_inst_info.values(): |
|
1588 |
if inst.disk_template in constants.DTS_INT_MIRROR: |
|
1589 |
group = self.my_node_info[inst.primary_node].group |
|
1590 |
for nname in inst.secondary_nodes: |
|
1591 |
if self.all_node_info[nname].group != group: |
|
1592 |
extra_lv_nodes.add(nname) |
|
1593 |
|
|
1594 |
unlocked_lv_nodes = \ |
|
1595 |
extra_lv_nodes.difference(self.glm.list_owned(locking.LEVEL_NODE)) |
|
1596 |
|
|
1597 |
if unlocked_lv_nodes: |
|
1598 |
raise errors.OpPrereqError("these nodes could be locked: %s" % |
|
1599 |
utils.CommaJoin(unlocked_lv_nodes)) |
|
1600 |
self.extra_lv_nodes = list(extra_lv_nodes) |
|
1601 |
|
|
1574 | 1602 |
def _VerifyNode(self, ninfo, nresult): |
1575 | 1603 |
"""Perform some basic validation on data returned from a node. |
1576 | 1604 |
|
... | ... | |
2468 | 2496 |
|
2469 | 2497 |
for nname in inst_config.all_nodes: |
2470 | 2498 |
if nname not in node_image: |
2471 |
# ghost node |
|
2472 | 2499 |
gnode = self.NodeImage(name=nname) |
2473 |
gnode.ghost = True
|
|
2500 |
gnode.ghost = (nname not in self.all_node_info)
|
|
2474 | 2501 |
node_image[nname] = gnode |
2475 | 2502 |
|
2476 | 2503 |
inst_config.MapLVsByNode(node_vol_should) |
... | ... | |
2496 | 2523 |
all_nvinfo = self.rpc.call_node_verify(self.my_node_names, |
2497 | 2524 |
node_verify_param, |
2498 | 2525 |
self.cfg.GetClusterName()) |
2526 |
if self.extra_lv_nodes and vg_name is not None: |
|
2527 |
extra_lv_nvinfo = \ |
|
2528 |
self.rpc.call_node_verify(self.extra_lv_nodes, |
|
2529 |
{constants.NV_LVLIST: vg_name}, |
|
2530 |
self.cfg.GetClusterName()) |
|
2531 |
else: |
|
2532 |
extra_lv_nvinfo = {} |
|
2499 | 2533 |
nvinfo_endtime = time.time() |
2500 | 2534 |
|
2501 | 2535 |
all_drbd_map = self.cfg.ComputeDRBDMap() |
... | ... | |
2601 | 2635 |
_ErrorIf(not test, self.ENODEORPHANINSTANCE, node_i.name, |
2602 | 2636 |
"node is running unknown instance %s", inst) |
2603 | 2637 |
|
2638 |
for node, result in extra_lv_nvinfo.items(): |
|
2639 |
self._UpdateNodeVolumes(self.all_node_info[node], result.payload, |
|
2640 |
node_image[node], vg_name) |
|
2641 |
|
|
2604 | 2642 |
feedback_fn("* Verifying instance status") |
2605 | 2643 |
for instance in self.my_inst_names: |
2606 | 2644 |
if verbose: |
... | ... | |
2679 | 2717 |
|
2680 | 2718 |
feedback_fn("* Verifying orphan volumes") |
2681 | 2719 |
reserved = utils.FieldSet(*cluster.reserved_lvs) |
2720 |
|
|
2721 |
# We will get spurious "unknown volume" warnings if any node of this group |
|
2722 |
# is secondary for an instance whose primary is in another group. To avoid |
|
2723 |
# them, we find these instances and add their volumes to node_vol_should. |
|
2724 |
for inst in self.all_inst_info.values(): |
|
2725 |
for secondary in inst.secondary_nodes: |
|
2726 |
if (secondary in self.my_node_info |
|
2727 |
and inst.name not in self.my_inst_info): |
|
2728 |
inst.MapLVsByNode(node_vol_should) |
|
2729 |
break |
|
2730 |
|
|
2682 | 2731 |
self._VerifyOrphanVolumes(node_vol_should, node_image, reserved) |
2683 | 2732 |
|
2684 | 2733 |
if constants.VERIFY_NPLUSONE_MEM not in self.op.skip_checks: |
Also available in: Unified diff