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
cluster verification procedure.
:directory: cluster-verify
:env. vars: CLUSTER, MASTER
:pre-execution: none
:post-execution: all nodes
......@@ -478,6 +478,12 @@ EXPORT_DO_SHUTDOWN
the filesystem would need a check (journal replay or full fsck) in
order to guarantee consistency.
The list of cluster tags, space separated.
The list of tags for node *<name>*, space separated.
......@@ -782,12 +782,13 @@ class LUVerifyCluster(LogicalUnit):
for minor, (iname, must_exist) in drbd_map.items():
if minor not in used_minors and must_exist:
feedback_fn(" - ERROR: drbd minor %d of instance %s is not active" %
(minor, iname))
feedback_fn(" - ERROR: drbd minor %d of instance %s is"
" not active" % (minor, iname))
bad = True
for minor in used_minors:
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" %
bad = True
return bad
......@@ -915,8 +916,12 @@ class LUVerifyCluster(LogicalUnit):
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" %] = " ".join(node.GetTags())
return env, [], all_nodes
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