diff options
author | vmallika <vmallika@redhat.com> | 2014-10-28 12:25:43 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2014-11-12 04:36:11 -0800 |
commit | 4fa4b7f2c2b57d1055adb76e8258b0db176bc356 (patch) | |
tree | e4beb4567c57370b8622f19746721e2a0b0f96f1 /cli/src/cli-xml-output.c | |
parent | 55aa4b185561edd7b3d1ab77a4f29a4facfdd7ff (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: 1157991
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>
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r-- | cli/src/cli-xml-output.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 66bec7ee96f..aacce140946 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -5156,7 +5156,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; } @@ -5164,6 +5164,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); @@ -5267,6 +5278,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); @@ -5277,12 +5289,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; } @@ -5325,6 +5338,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); |