From 5dd0e5195a6d293ff0ab906b54d77664e70b3be6 Mon Sep 17 00:00:00 2001 From: Sachin Pandit Date: Thu, 30 Jan 2014 07:30:12 +0530 Subject: CLI/snapshot : Support to delete a snap forcefully using "force" option Change-Id: I6315d5b96ac72f6520037d4e96e29e5862aec346 Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/6867 Reviewed-by: Raghavendra Bhat Reviewed-by: Avra Sengupta Reviewed-by: Rajesh Joseph Tested-by: Rajesh Joseph --- cli/src/cli-cmd-parser.c | 19 +++++++++++-------- cli/src/cli-cmd-snapshot.c | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 6abd97ce7..c70c5a752 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -3311,8 +3311,9 @@ out: /* remove command takes either the snapname or the cg name. If snap has to be remvoed for a volume, then the volume name also should be given in the command. If cg should be removed, - then volume name is not necessary. - "gluster snapshot delete ( -s | -c )" + then volume name is not necessary. Giving "force" will delete + the snapshot without giving notification. + "gluster snapshot delete ( -s | -c ) [force]" return value: -1 on failure 1 if user cancels the operation 0 on success @@ -3404,12 +3405,14 @@ cli_snap_remove_parse (dict_t *dict, const char **words, int wordcount, } } - answer = cli_cmd_get_confirmation (state, question); - if (GF_ANSWER_NO == answer) { - ret = 1; - gf_log ("", GF_LOG_DEBUG, "User cancelled " - "snapshot delete operation"); - goto out; + if ((strcmp (words[wordcount - 1], "force"))) { + answer = cli_cmd_get_confirmation (state, question); + if (GF_ANSWER_NO == answer) { + ret = 1; + gf_log ("", GF_LOG_DEBUG, "User cancelled " + "snapshot delete operation"); + goto out; + } } out: diff --git a/cli/src/cli-cmd-snapshot.c b/cli/src/cli-cmd-snapshot.c index f16e68dd6..1a5a2feef 100644 --- a/cli/src/cli-cmd-snapshot.c +++ b/cli/src/cli-cmd-snapshot.c @@ -100,7 +100,7 @@ struct cli_cmd snapshot_cmds[] = { cli_cmd_snapshot_cbk, "Snapshot Config." }, - {"snapshot delete ( -s | -c )", + {"snapshot delete ( -s | -c ) [force]", cli_cmd_snapshot_cbk, "Snapshot Delete." }, -- cgit