diff --git a/lib/cmdlib.py b/lib/cmdlib.py index ea5331dce605b050e4264cf6b14d1ebc2aee02c5..37e0e1647fc785d930c8c2119b653d5f24f17e67 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1654,20 +1654,24 @@ class LUVerifyCluster(LogicalUnit): _ErrorIf(test, self.EINSTANCEWRONGNODE, instance, "instance should not run on node %s", node) - def _VerifyOrphanVolumes(self, node_vol_should, node_image): + def _VerifyOrphanVolumes(self, node_vol_should, node_image, reserved): """Verify if there are any unknown volumes in the cluster. The .os, .swap and backup volumes are ignored. All other volumes are reported as unknown. + @type reserved: L{ganeti.utils.FieldSet} + @param reserved: a FieldSet of reserved volume names + """ for node, n_img in node_image.items(): if n_img.offline or n_img.rpc_fail or n_img.lvm_fail: # skip non-healthy nodes continue for volume in n_img.volumes: - test = (node not in node_vol_should or - volume not in node_vol_should[node]) + test = ((node not in node_vol_should or + volume not in node_vol_should[node]) and + not reserved.Matches(volume)) self._ErrorIf(test, self.ENODEORPHANLV, node, "volume %s is unknown", volume) @@ -2232,7 +2236,8 @@ class LUVerifyCluster(LogicalUnit): "instance lives on ghost node %s", node) feedback_fn("* Verifying orphan volumes") - self._VerifyOrphanVolumes(node_vol_should, node_image) + reserved = utils.FieldSet(*cluster.reserved_lvs) + self._VerifyOrphanVolumes(node_vol_should, node_image, reserved) feedback_fn("* Verifying orphan instances") self._VerifyOrphanInstances(instancelist, node_image) diff --git a/lib/objects.py b/lib/objects.py index be6f2d7148af10efbdd6983aef9fa55a3eb93397..8b5e1e7a9deb6571ffd9d35aff95caa6b0d35d18 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -898,6 +898,7 @@ class Cluster(TaggableObject): "tcpudp_port_pool", "mac_prefix", "volume_group_name", + "reserved_lvs", "drbd_usermode_helper", "default_bridge", "default_hypervisor", @@ -979,6 +980,10 @@ class Cluster(TaggableObject): if self.default_iallocator is None: self.default_iallocator = "" + # reserved_lvs added before 2.2 + if self.reserved_lvs is None: + self.reserved_lvs = [] + def ToDict(self): """Custom function for cluster.