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): ...@@ -1654,20 +1654,24 @@ class LUVerifyCluster(LogicalUnit):
_ErrorIf(test, self.EINSTANCEWRONGNODE, instance, _ErrorIf(test, self.EINSTANCEWRONGNODE, instance,
"instance should not run on node %s", node) "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. """Verify if there are any unknown volumes in the cluster.
The .os, .swap and backup volumes are ignored. All other volumes are The .os, .swap and backup volumes are ignored. All other volumes are
reported as unknown. 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(): for node, n_img in node_image.items():
if n_img.offline or n_img.rpc_fail or n_img.lvm_fail: if n_img.offline or n_img.rpc_fail or n_img.lvm_fail:
# skip non-healthy nodes # skip non-healthy nodes
continue continue
for volume in n_img.volumes: for volume in n_img.volumes:
test = (node not in node_vol_should or test = ((node not in node_vol_should or
volume not in node_vol_should[node]) volume not in node_vol_should[node]) and
not reserved.Matches(volume))
self._ErrorIf(test, self.ENODEORPHANLV, node, self._ErrorIf(test, self.ENODEORPHANLV, node,
"volume %s is unknown", volume) "volume %s is unknown", volume)
...@@ -2232,7 +2236,8 @@ class LUVerifyCluster(LogicalUnit): ...@@ -2232,7 +2236,8 @@ class LUVerifyCluster(LogicalUnit):
"instance lives on ghost node %s", node) "instance lives on ghost node %s", node)
feedback_fn("* Verifying orphan volumes") 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") feedback_fn("* Verifying orphan instances")
self._VerifyOrphanInstances(instancelist, node_image) self._VerifyOrphanInstances(instancelist, node_image)
......
...@@ -898,6 +898,7 @@ class Cluster(TaggableObject): ...@@ -898,6 +898,7 @@ class Cluster(TaggableObject):
"tcpudp_port_pool", "tcpudp_port_pool",
"mac_prefix", "mac_prefix",
"volume_group_name", "volume_group_name",
"reserved_lvs",
"drbd_usermode_helper", "drbd_usermode_helper",
"default_bridge", "default_bridge",
"default_hypervisor", "default_hypervisor",
...@@ -979,6 +980,10 @@ class Cluster(TaggableObject): ...@@ -979,6 +980,10 @@ class Cluster(TaggableObject):
if self.default_iallocator is None: if self.default_iallocator is None:
self.default_iallocator = "" self.default_iallocator = ""
# reserved_lvs added before 2.2
if self.reserved_lvs is None:
self.reserved_lvs = []
def ToDict(self): def ToDict(self):
"""Custom function for cluster. """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