Revision 999b183c lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
1654 | 1654 |
_ErrorIf(test, self.EINSTANCEWRONGNODE, instance, |
1655 | 1655 |
"instance should not run on node %s", node) |
1656 | 1656 |
|
1657 |
def _VerifyOrphanVolumes(self, node_vol_should, node_image): |
|
1657 |
def _VerifyOrphanVolumes(self, node_vol_should, node_image, reserved):
|
|
1658 | 1658 |
"""Verify if there are any unknown volumes in the cluster. |
1659 | 1659 |
|
1660 | 1660 |
The .os, .swap and backup volumes are ignored. All other volumes are |
1661 | 1661 |
reported as unknown. |
1662 | 1662 |
|
1663 |
@type reserved: L{ganeti.utils.FieldSet} |
|
1664 |
@param reserved: a FieldSet of reserved volume names |
|
1665 |
|
|
1663 | 1666 |
""" |
1664 | 1667 |
for node, n_img in node_image.items(): |
1665 | 1668 |
if n_img.offline or n_img.rpc_fail or n_img.lvm_fail: |
1666 | 1669 |
# skip non-healthy nodes |
1667 | 1670 |
continue |
1668 | 1671 |
for volume in n_img.volumes: |
1669 |
test = (node not in node_vol_should or |
|
1670 |
volume not in node_vol_should[node]) |
|
1672 |
test = ((node not in node_vol_should or |
|
1673 |
volume not in node_vol_should[node]) and |
|
1674 |
not reserved.Matches(volume)) |
|
1671 | 1675 |
self._ErrorIf(test, self.ENODEORPHANLV, node, |
1672 | 1676 |
"volume %s is unknown", volume) |
1673 | 1677 |
|
... | ... | |
2232 | 2236 |
"instance lives on ghost node %s", node) |
2233 | 2237 |
|
2234 | 2238 |
feedback_fn("* Verifying orphan volumes") |
2235 |
self._VerifyOrphanVolumes(node_vol_should, node_image) |
|
2239 |
reserved = utils.FieldSet(*cluster.reserved_lvs) |
|
2240 |
self._VerifyOrphanVolumes(node_vol_should, node_image, reserved) |
|
2236 | 2241 |
|
2237 | 2242 |
feedback_fn("* Verifying orphan instances") |
2238 | 2243 |
self._VerifyOrphanInstances(instancelist, node_image) |
Also available in: Unified diff