Revision 14970c32 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
1672 | 1672 |
"instance not running on its primary node %s", |
1673 | 1673 |
node_current) |
1674 | 1674 |
|
1675 |
for node, n_img in node_image.items(): |
|
1676 |
if node != node_current: |
|
1677 |
test = instance in n_img.instances |
|
1678 |
_ErrorIf(test, self.EINSTANCEWRONGNODE, instance, |
|
1679 |
"instance should not run on node %s", node) |
|
1680 |
|
|
1681 | 1675 |
diskdata = [(nname, success, status, idx) |
1682 | 1676 |
for (nname, disks) in diskstatus.items() |
1683 | 1677 |
for idx, (success, status) in enumerate(disks)] |
... | ... | |
1717 | 1711 |
self._ErrorIf(test, self.ENODEORPHANLV, node, |
1718 | 1712 |
"volume %s is unknown", volume) |
1719 | 1713 |
|
1720 |
def _VerifyOrphanInstances(self, instancelist, node_image): |
|
1721 |
"""Verify the list of running instances. |
|
1722 |
|
|
1723 |
This checks what instances are running but unknown to the cluster. |
|
1724 |
|
|
1725 |
""" |
|
1726 |
for node, n_img in node_image.items(): |
|
1727 |
for o_inst in n_img.instances: |
|
1728 |
test = o_inst not in instancelist |
|
1729 |
self._ErrorIf(test, self.ENODEORPHANINSTANCE, node, |
|
1730 |
"instance %s on node %s should not exist", o_inst, node) |
|
1731 |
|
|
1732 | 1714 |
def _VerifyNPlusOneMemory(self, node_image, instance_cfg): |
1733 | 1715 |
"""Verify N+1 Memory Resilience. |
1734 | 1716 |
|
... | ... | |
2490 | 2472 |
self._UpdateNodeInstances(node_i, nresult, nimg) |
2491 | 2473 |
self._UpdateNodeInfo(node_i, nresult, nimg, vg_name) |
2492 | 2474 |
self._UpdateNodeOS(node_i, nresult, nimg) |
2475 |
|
|
2493 | 2476 |
if not nimg.os_fail: |
2494 | 2477 |
if refos_img is None: |
2495 | 2478 |
refos_img = nimg |
2496 | 2479 |
self._VerifyNodeOS(node_i, nimg, refos_img) |
2497 | 2480 |
self._VerifyNodeBridges(node_i, nresult, bridges) |
2498 | 2481 |
|
2482 |
# Check whether all running instancies are primary for the node. (This |
|
2483 |
# can no longer be done from _VerifyInstance below, since some of the |
|
2484 |
# wrong instances could be from other node groups.) |
|
2485 |
non_primary_inst = set(nimg.instances).difference(nimg.pinst) |
|
2486 |
|
|
2487 |
for inst in non_primary_inst: |
|
2488 |
test = inst in self.all_inst_info |
|
2489 |
_ErrorIf(test, self.EINSTANCEWRONGNODE, inst, |
|
2490 |
"instance should not run on node %s", node_i.name) |
|
2491 |
_ErrorIf(not test, self.ENODEORPHANINSTANCE, node_i.name, |
|
2492 |
"node is running unknown instance %s", inst) |
|
2493 |
|
|
2499 | 2494 |
feedback_fn("* Verifying instance status") |
2500 | 2495 |
for instance in self.my_inst_names: |
2501 | 2496 |
if verbose: |
... | ... | |
2576 | 2571 |
reserved = utils.FieldSet(*cluster.reserved_lvs) |
2577 | 2572 |
self._VerifyOrphanVolumes(node_vol_should, node_image, reserved) |
2578 | 2573 |
|
2579 |
feedback_fn("* Verifying orphan instances") |
|
2580 |
self._VerifyOrphanInstances(set(self.all_inst_info.keys()), node_image) |
|
2581 |
|
|
2582 | 2574 |
if constants.VERIFY_NPLUSONE_MEM not in self.op.skip_checks: |
2583 | 2575 |
feedback_fn("* Verifying N+1 Memory redundancy") |
2584 | 2576 |
self._VerifyNPlusOneMemory(node_image, self.my_inst_info) |
Also available in: Unified diff