summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-xml-output.c
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2014-10-28 12:25:43 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2014-12-18 22:52:22 -0800
commitdf0ff94a64bd597e61f26a2a56297de7abf80a0f (patch)
tree163dfd82065add6b19ab32a1599dfb389d49911a /cli/src/cli-xml-output.c
parentf0a90bf48135c480c41a71ef25f46619001a3116 (diff)
glusterd/snapshot: Snapshot should be deactivated when it is created.
By default snapshot should be deactivated and this should be a configurable option. This behaviour can be configured by the command below: gluster snapshot config activate-on-create <enable|disable> Change-Id: I1911595c32beed43bb2fca4bf99f0d264b422513 BUG: 1170921 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/8985 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/9241 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r--cli/src/cli-xml-output.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index d0a72772085..90b184d9f3f 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -5164,7 +5164,7 @@ cli_xml_snapshot_config_show (xmlTextWriterPtr writer,
ret = dict_get_str (dict, "auto-delete", &str_value);
if (ret) {
- gf_log ("cli", GF_LOG_ERROR, "Could not fetch auto-delet");
+ gf_log ("cli", GF_LOG_ERROR, "Could not fetch auto-delete");
goto out;
}
@@ -5172,6 +5172,17 @@ cli_xml_snapshot_config_show (xmlTextWriterPtr writer,
(xmlChar *) "autoDelete", "%s", str_value);
XML_RET_CHECK_AND_GOTO (ret, out);
+ ret = dict_get_str (dict, "snap-activate-on-create", &str_value);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR,
+ "Could not fetch snap-activate-on-create-delete");
+ goto out;
+ }
+
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "activateOnCreate", "%s", str_value);
+ XML_RET_CHECK_AND_GOTO (ret, out);
+
/* </systemConfig> */
ret = xmlTextWriterEndElement (writer);
XML_RET_CHECK_AND_GOTO (ret, out);
@@ -5275,6 +5286,7 @@ cli_xml_snapshot_config_set (xmlTextWriterPtr writer, xmlDocPtr doc,
uint64_t soft_limit = 0;
char *volname = NULL;
char *auto_delete = NULL;
+ char *snap_activate = NULL;
GF_ASSERT (writer);
GF_ASSERT (doc);
@@ -5285,12 +5297,13 @@ cli_xml_snapshot_config_set (xmlTextWriterPtr writer, xmlDocPtr doc,
/* This is optional parameter therefore ignore the error */
ret = dict_get_uint64 (dict, "snap-max-soft-limit", &soft_limit);
ret = dict_get_str (dict, "auto-delete", &auto_delete);
+ ret = dict_get_str (dict, "snap-activate-on-create", &snap_activate);
- if (!hard_limit && !soft_limit && !auto_delete) {
+ if (!hard_limit && !soft_limit && !auto_delete && !snap_activate) {
ret = -1;
gf_log ("cli", GF_LOG_ERROR, "At least one option from "
- "snap-max-hard-limit, snap-max-soft-limit and "
- "auto-delete should be set");
+ "snap-max-hard-limit, snap-max-soft-limit, auto-delete"
+ " and snap-activate-on-create should be set");
goto out;
}
@@ -5333,6 +5346,12 @@ cli_xml_snapshot_config_set (xmlTextWriterPtr writer, xmlDocPtr doc,
XML_RET_CHECK_AND_GOTO (ret, out);
}
+ if (snap_activate) {
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "activateOnCreate", "%s", snap_activate);
+ XML_RET_CHECK_AND_GOTO (ret, out);
+ }
+
/* </volumeConfig> or </systemConfig> */
ret = xmlTextWriterEndElement (writer);
XML_RET_CHECK_AND_GOTO (ret, out);