From 40135e9811efe2fb4cbdff302d5a2c461e4147d4 Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Mon, 5 Sep 2016 21:51:19 +0530 Subject: cluster/tier: add tiering events Add events for: * tier attach and detach * tier pause and resume * tier rising and dropping hi and lo watermarks Update eventskeygen.py with tiering events. Update cli help with: * attach: add optional force argument * detach: make force available as non-optional argument on its own > Reviewed-on: http://review.gluster.org/15232 > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Dan Lambright > Tested-by: Dan Lambright (cherry picked from commit cd23242b8953040b231f402c334f16520ac8029f) Change-Id: I43990d3a8742151a4a7889bafa19cb572fe661bd BUG: 1374324 Signed-off-by: Milind Changire Reviewed-on: http://review.gluster.org/15431 Tested-by: Atin Mukherjee Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- cli/src/cli-cmd-volume.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index eb3b2c50fa3..e87669cd75d 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1115,6 +1115,7 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, rpc_clnt_procedure_t *proc = NULL; cli_local_t *local = NULL; int i = 0; + eventtypes_t event = EVENT_LAST; if (wordcount < 4) { cli_usage_out (word->pattern); @@ -1133,6 +1134,15 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, ret = do_cli_cmd_volume_detach_tier (state, word, words, wordcount-1); + if (!strcmp (words[wordcount-2], "commit")) { + event = EVENT_TIER_DETACH_COMMIT; + } else if (!strcmp (words[wordcount-2], "start")) { + event = EVENT_TIER_DETACH_START; + } else if (!strcmp (words[wordcount-2], "stop")) { + event = EVENT_TIER_DETACH_STOP; + } else if (!strcmp (words[wordcount-2], "force")) { + event = EVENT_TIER_DETACH_FORCE; + } goto out; } else if (!strcmp(words[1], "attach-tier")) { @@ -1145,6 +1155,11 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, ret = do_cli_cmd_volume_attach_tier (state, word, words, wordcount-1); + if (!strcmp (words[wordcount-2], "force")) { + event = EVENT_TIER_ATTACH_FORCE; + } else { + event = EVENT_TIER_ATTACH; + } goto out; } @@ -1169,6 +1184,10 @@ cli_cmd_volume_tier_cbk (struct cli_state *state, out: if (ret) { cli_out ("Tier command failed"); + } else { + if (event != EVENT_LAST) { + gf_event (event, "vol=%s", words[2]); + } } if (options) dict_unref (options); @@ -2939,8 +2958,8 @@ struct cli_cmd volume_cmds[] = { #if !defined(__NetBSD__) { "volume tier status\n" "volume tier start [force]\n" - "volume tier attach [] ...\n" - "volume tier detach \n", + "volume tier attach [] ... [force]\n" + "volume tier detach \n", cli_cmd_volume_tier_cbk, "Tier translator specific operations."}, -- cgit