Commit 35e994e9 authored by Iustin Pop's avatar Iustin Pop
Browse files

Export tags to cluster verify hooks

This patch export the cluster and node tags to the cluster verify hook
scripts. The tags are exported as a space-separated list, which allows
easy parsing from the shell (e.g. “for tag in $GANETI_CLUSTER_TAGS; do
...”) and therefore requires the previous “Don't allow spaces in tag
names” patch.

The patch also fixes a minor line length style problem.

Reviewed-by: ultrotter
parent 28ab6fed
...@@ -304,7 +304,7 @@ post-execution hooks, in order to allow administrators to enhance the ...@@ -304,7 +304,7 @@ post-execution hooks, in order to allow administrators to enhance the
cluster verification procedure. cluster verification procedure.
:directory: cluster-verify :directory: cluster-verify
:env. vars: CLUSTER, MASTER :env. vars: CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_<name>
:pre-execution: none :pre-execution: none
:post-execution: all nodes :post-execution: all nodes
...@@ -478,6 +478,12 @@ EXPORT_DO_SHUTDOWN ...@@ -478,6 +478,12 @@ EXPORT_DO_SHUTDOWN
the filesystem would need a check (journal replay or full fsck) in the filesystem would need a check (journal replay or full fsck) in
order to guarantee consistency. order to guarantee consistency.
CLUSTER_TAGS
The list of cluster tags, space separated.
NODE_TAGS_<name>
The list of tags for node *<name>*, space separated.
Examples Examples
-------- --------
......
...@@ -782,12 +782,13 @@ class LUVerifyCluster(LogicalUnit): ...@@ -782,12 +782,13 @@ class LUVerifyCluster(LogicalUnit):
else: else:
for minor, (iname, must_exist) in drbd_map.items(): for minor, (iname, must_exist) in drbd_map.items():
if minor not in used_minors and must_exist: if minor not in used_minors and must_exist:
feedback_fn(" - ERROR: drbd minor %d of instance %s is not active" % feedback_fn(" - ERROR: drbd minor %d of instance %s is"
(minor, iname)) " not active" % (minor, iname))
bad = True bad = True
for minor in used_minors: for minor in used_minors:
if minor not in drbd_map: if minor not in drbd_map:
feedback_fn(" - ERROR: unallocated drbd minor %d is in use" % minor) feedback_fn(" - ERROR: unallocated drbd minor %d is in use" %
minor)
bad = True bad = True
return bad return bad
...@@ -915,8 +916,12 @@ class LUVerifyCluster(LogicalUnit): ...@@ -915,8 +916,12 @@ class LUVerifyCluster(LogicalUnit):
""" """
all_nodes = self.cfg.GetNodeList() all_nodes = self.cfg.GetNodeList()
# TODO: populate the environment with useful information for verify hooks env = {
env = {} "CLUSTER_TAGS": " ".join(self.cfg.GetClusterInfo().GetTags())
}
for node in self.cfg.GetAllNodesInfo().values():
env["NODE_TAGS_%s" % node.name] = " ".join(node.GetTags())
return env, [], all_nodes return env, [], all_nodes
def Exec(self, feedback_fn): def Exec(self, feedback_fn):
......
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