summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-01-30 07:30:12 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-02-13 22:30:48 -0800
commit5dd0e5195a6d293ff0ab906b54d77664e70b3be6 (patch)
tree910cb42faf2ee7cb32c03e5b91c07cd559dd3143
parent5dcc5d4b8ee554ebf5c1aceeda9b73e321d5abd5 (diff)
CLI/snapshot : Support to delete a snap forcefully using "force" option
Change-Id: I6315d5b96ac72f6520037d4e96e29e5862aec346 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/6867 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
-rw-r--r--cli/src/cli-cmd-parser.c19
-rw-r--r--cli/src/cli-cmd-snapshot.c2
2 files changed, 12 insertions, 9 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 6abd97c..c70c5a7 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 (<volname> -s <snapname> | -c <cgname>)"
+ then volume name is not necessary. Giving "force" will delete
+ the snapshot without giving notification.
+ "gluster snapshot delete (<volname> -s <snapname> | -c <cgname>) [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 f16e68d..1a5a2fe 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 (<volname> -s <snapname> | -c <cgname>)",
+ {"snapshot delete (<volname> -s <snapname> | -c <cgname>) [force]",
cli_cmd_snapshot_cbk,
"Snapshot Delete."
},