Commit 999b183c authored by Iustin Pop's avatar Iustin Pop
Browse files

Introuce a new cluster parameter - reserved_lvs



This parameter, which is a list of regular expression patterns, will
make cluster verify ignore any such LVs. It will not prevent creation or
removal of such volumes by the backend code.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 91492e57
......@@ -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)
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment