summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd-parser.c220
-rw-r--r--cli/src/cli-cmd-snapshot.c2
-rw-r--r--cli/src/cli-rpc-ops.c60
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c256
4 files changed, 138 insertions, 400 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 727206a..adfb85e 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -3201,211 +3201,36 @@ out:
return ret;
}
-/* 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. 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
-*/
-int32_t
-cli_snap_remove_parse (dict_t *dict, const char **words, int wordcount,
- unsigned int cmdi, struct cli_state *state)
-{
- uint32_t name_opt_loc = 0;
- int32_t ret = -1;
- uint32_t i = 0;
- gf_boolean_t is_cg = _gf_false;
- const char *question = NULL;
- gf_answer_t answer = GF_ANSWER_NO;
-
- question = "Deleting snap will erase all information about the snap. "
- "Do you want to continue?";
-
- GF_ASSERT (dict);
- GF_ASSERT (words);
-
- /* Finding the "-s or -c" in the cli */
- for (i = cmdi; i < wordcount; i++) {
- if (!strcmp (words[i], "-s") || !strcmp (words[i], "-c")) {
- name_opt_loc = i;
- if (!strcmp (words[i], "-c"))
- is_cg = _gf_true;
- break;
- }
- }
-
- if (name_opt_loc == 0) {
- gf_log ("", GF_LOG_ERROR, "options -s/-c is not found in the "
- "command");
- goto out;
- }
-
- if (name_opt_loc == (wordcount - 1)) {
- gf_log ("", GF_LOG_ERROR, "%s name is not given",
- is_cg?"cg":"snap");
- goto out;
- }
-
- if (!is_cg) {
- if (!strcmp (words[cmdi], "-s")) {
- gf_log ("", GF_LOG_ERROR, "Volume name is not given "
- "for the snapshot deletion");
- ret = -1;
- goto out;
- }
- } else {
- if (strcmp (words[cmdi], "-c")) {
- gf_log ("", GF_LOG_ERROR, "volume name is not needed "
- "for consistency group deletion");
- ret = -1;
- goto out;
- }
- }
-
- /* Saving snapname/cg-name in dict */
- if (name_opt_loc >= cmdi) {
- /* Decide if it's a cg-name or a snapname */
- if (is_cg) {
- ret = dict_set_str (dict, "cgname",
- (char *)words[name_opt_loc + 1]);
- if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to save cg-name");
- goto out;
- }
- } else {
- ret = dict_set_int64 (dict, "volcount", 1);
- if (ret) {
- gf_log ("", GF_LOG_ERROR, "failed to set "
- "volcount");
- goto out;
- }
- ret = dict_set_str (dict, "volname1",
- (char *)words[name_opt_loc - 1]);
- if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to save volname");
- goto out;
- }
- ret = dict_set_str (dict, "snapname",
- (char *)words[name_opt_loc + 1]);
- if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to save snapname");
- 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:
- return ret;
-}
-
-/* Syntax:
- * snapshot restore (-v <volname> <snapname> | -c <cg-name> )
+/* snapshot restore <snapname>
+ * @arg-0, dict : Request Dictionary to be sent to server side.
+ * @arg-1, words : Contains individual words of CLI command.
+ * @arg-2, wordcount: Contains number of words present in the CLI command.
+ * @arg-3, cmdi : command index, here cmdi is "2"(gluster snapshot restore)
+ *
+ * return value : -1 on failure
+ * 0 on success
*/
int
cli_snap_restore_parse (dict_t *dict, const char **words, int wordcount,
- unsigned int cmdi)
-{
- int ret = -1; /* Failure */
- const char* vol_name = NULL;
- const char* snap_name = NULL;
- const char* cg_name = NULL;
+ unsigned int cmdi) {
+
+ int ret = -1;
- GF_ASSERT (dict);
GF_ASSERT (words);
+ GF_ASSERT (dict);
- /* At least CG_INDEX argument should be there for a valid command */
- if (wordcount <= cmdi) {
- gf_log ("cli", GF_LOG_ERROR, "Invalid command: Not enough "
- "arguments");
+ if (wordcount != 3) {
+ gf_log ("cli", GF_LOG_ERROR, "Invalid Syntax");
goto out;
}
- if (0 == strcmp (words[cmdi], "-v")) {
- /* snapshot restore -v <volname> <snapname>
- *
- * cmdi points to -v, therefore wordcount should be exactly
- * equal to (cmdi + 2) + 1. +1 is added to convert index to
- * count
- */
- if ((cmdi + 3) != wordcount) {
- gf_log ("cli", GF_LOG_ERROR, "Invalid argument count");
- goto out;
- }
-
- vol_name = words[++cmdi];
- snap_name = words[++cmdi];
-
- if ((NULL == vol_name) || (NULL == snap_name)) {
- gf_log ("cli", GF_LOG_ERROR, "Volume or snap "
- "name missing");
- goto out;
- }
-
- /* Single volume should be represented by volcount 1
- * and a volname in dictionary
- */
- ret = dict_set_int64 (dict, "volcount", 1);
- if (ret) {
- gf_log ("cli", GF_LOG_ERROR, "Failed to set "
- "vol count");
- goto out;
- }
-
- /* TODO: Change the index to 0 once Jarvis code is fixed */
- ret = dict_set_str (dict, "volname1", (char *)vol_name);
- if (ret) {
- gf_log ("cli", GF_LOG_ERROR, "Failed to set "
- "volume name");
- goto out;
- }
-
- ret = dict_set_str (dict, "snapname", (char *)snap_name);
- if (ret) {
- gf_log ("cli", GF_LOG_ERROR, "Failed to set "
- "snap name");
- goto out;
- }
- } else if (0 == strcmp (words[cmdi], "-c")) {
- /* If -c option is provided then command should look like
- * snapshot restore -c <cg-name>
- *
- * cmdi points to -c, therefore wordcount should be exactly
- * equal to (cmdi + 1) + 1. +1 is added to convert index to
- * count
- */
- if ((cmdi + 2) != wordcount) {
- gf_log ("cli", GF_LOG_ERROR, "Invalid argument count");
- goto out;
- }
- cg_name = words[++cmdi];
- ret = dict_set_str (dict, "cgname", (char *)cg_name);
- if (ret) {
- gf_log ("cli", GF_LOG_ERROR, "Failed to set "
- "CG name");
- goto out;
- }
- } else {
- gf_log ("cli", GF_LOG_ERROR, "Invalid (%s) option",
- words[cmdi]);
+ ret = dict_set_str (dict, "snapname", (char *)words[cmdi]);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR, "Unable to save snap-name %s",
+ words[cmdi]);
goto out;
}
-
- ret = 0; /* Success */
-out:
+out :
return ret;
}
@@ -3605,13 +3430,8 @@ cli_cmd_snapshot_parse (const char **words, int wordcount, dict_t **options,
case GF_SNAP_OPTION_TYPE_RESTORE:
{
/* Syntax:
- * snapshot restore (-v <volname> <snapname> |
- * -c <cg-name> )
+ * snapshot restore <snapname>
*/
-
- /* Start parsing from the first option after "restore" */
- cmdi = 2;
-
ret = cli_snap_restore_parse (dict, words, wordcount,
cmdi);
if (ret) {
diff --git a/cli/src/cli-cmd-snapshot.c b/cli/src/cli-cmd-snapshot.c
index a7e39e6..2389252 100644
--- a/cli/src/cli-cmd-snapshot.c
+++ b/cli/src/cli-cmd-snapshot.c
@@ -87,7 +87,7 @@ struct cli_cmd snapshot_cmds[] = {
cli_cmd_snapshot_cbk,
"Snapshot Create."
},
- { "snapshot restore (-v <volname> <snapname> | -c <cg-name>)",
+ { "snapshot restore <snapname>",
cli_cmd_snapshot_cbk,
"Snapshot Restore."
},
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index ee26e7d..0447e5b 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -8028,9 +8028,7 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
gf_cli_rsp rsp = {0, };
dict_t *dict = NULL;
char *snap_name = NULL;
- char *cg_name = NULL;
int32_t type = 0;
- int64_t volcount = -1;
call_frame_t *frame = NULL;
gf_boolean_t snap_driven = _gf_false;
@@ -8076,31 +8074,16 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- ret = dict_get_int64 (dict, "volcount", &volcount);
+ ret = dict_get_str (dict, "snapname", &snap_name);
if (ret) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "failed to get volcount");
+ gf_log ("cli", GF_LOG_ERROR,
+ "Failed to get snap name");
goto out;
}
-
- if (volcount > 1) {
- if (dict_get_str (dict, "cg-name",
- &cg_name) != 0)
- cg_name = "???";
-
- cli_out ("snapshot create: %s: consistency "
- "group created successfully",
- cg_name);
- } else {
- if (dict_get_str (dict, "snapname",
- &snap_name) != 0)
- snap_name = "???";
-
- cli_out ("snapshot create: %s: "
- "snap created successfully",
- snap_name);
- }
+ cli_out ("snapshot create: %s: snap created successfully",
+ snap_name);
break;
+
case GF_SNAP_OPTION_TYPE_RESTORE:
/* TODO: Check if rsp.op_ret needs to be checked here. Or is
* it ok to check this in the start of the function where we
@@ -8113,23 +8096,15 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- ret = dict_get_str (dict, "cgname", &cg_name);
+ ret = dict_get_str (dict, "snapname", &snap_name);
if (ret) {
- ret = dict_get_str (dict, "snapname", &snap_name);
- if (ret) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "Failed to get CG name or snap name");
- goto out;
- }
+ gf_log ("cli", GF_LOG_ERROR,
+ "Failed to get snap name");
+ goto out;
}
- if (NULL != snap_name) {
- cli_out ("Snapshot restore: %s: Snap restored "
+ cli_out ("Snapshot restore: %s: Snap restored "
"successfully", snap_name);
- } else {
- cli_out ("Snapshot restore: %s: Consistency group "
- "restored successfully", cg_name);
- }
ret = 0;
break;
@@ -8165,8 +8140,8 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
case GF_SNAP_OPTION_TYPE_CONFIG:
ret = cli_snapshot_config_display (dict, &rsp);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to display snapshot "
- "config output.");
+ gf_log ("cli", GF_LOG_ERROR, "Failed to display "
+ "snapshot config output.");
goto out;
}
break;
@@ -8174,14 +8149,19 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov,
case GF_SNAP_OPTION_TYPE_LIST:
ret = cli_snapshot_list (dict);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to display snapshot"
- " list");
+ gf_log ("cli", GF_LOG_ERROR, "Failed to display "
+ "snapshot list");
goto out;
}
break;
case GF_SNAP_OPTION_TYPE_DELETE:
ret = cli_snapshot_remove_reply (&rsp, dict, frame);
+ if (ret) {
+ gf_log ("cli", GF_LOG_ERROR,
+ "Failed to delete snap");
+ goto out;
+ }
break;
default:
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 2b2cc1a..66fdf41 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -58,14 +58,12 @@ int
glusterd_snapshot_restore (dict_t *dict, char **op_errstr)
{
int ret = -1;
- int64_t i = 0;
- int64_t volcount = 0;
char *volname = NULL;
char *snapname = NULL;
xlator_t *this = NULL;
+ glusterd_volinfo_t *snap_volinfo = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_snap_t *snap = NULL;
- char key[PATH_MAX] = {0,};
this = THIS;
@@ -73,68 +71,48 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr)
GF_ASSERT (dict);
GF_ASSERT (op_errstr);
- ret = dict_get_int64 (dict, "volcount", &volcount);
+ ret = dict_get_str (dict, "snapname", &snapname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get volume count");
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ "snap name");
goto out;
}
- /* If we are performing snapshot restore of a CG then volcount will be
- * greater than 1 else volcount will be 1.
- */
- for (i = 0; i < volcount; ++i) {
- /* TODO: Start the index from 0 when Jarvis code is fixed */
- snprintf (key, sizeof (key), "volname%ld", i+1);
- ret = dict_get_str (dict, key, &volname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "get volume name");
- goto out;
- }
-
- ret = glusterd_volinfo_find (volname, &volinfo);
- if (ret) {
- ret = gf_asprintf (op_errstr, "Volume (%s) not found",
- volname);
- if (ret < 0) {
- goto out;
- }
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
- ret = -1;
+ snap = glusterd_find_snap_by_name (snapname);
+ if (NULL == snap) {
+ ret = gf_asprintf (op_errstr, "Snap (%s) not found",
+ snapname);
+ if (ret < 0) {
goto out;
}
+ gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ ret = -1;
+ goto out;
+ }
- ret = dict_get_str (dict, "snapname", &snapname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
- "snap name");
- goto out;
- }
+ /* TODO : As of now there is only volume in snapshot.
+ * Change this when multiple volume snapshot is introduced
+ */
+ snap_volinfo = list_entry (snap->volumes.next, glusterd_volinfo_t,
+ vol_list);
- snap = glusterd_find_snap_by_name (snapname);
- if (NULL == snap) {
- ret = gf_asprintf (op_errstr, "Snap (%s) not found",
- snapname);
- if (ret < 0) {
- goto out;
- }
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
- ret = -1;
- goto out;
- }
+ ret = glusterd_volinfo_find (snap_volinfo->parent_volname, &volinfo);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Could not get volinfo of "
+ "%s", snap_volinfo->parent_volname);
+ goto out;
+ }
- /* Restore the snap for the entire volume */
- ret = gd_restore_snap_volume (volinfo, snap->snap_volume);
- if (ret) {
- /* No need to update op_errstr because it is assumed
- * that the called function will do that in case of
- * failure.
- */
- gf_log (this->name, GF_LOG_ERROR, "Failed to restore "
- "snap for %s volume", volname);
- goto out;
- }
+ ret = gd_restore_snap_volume (volinfo, snap_volinfo);
+ if (ret) {
+ /* No need to update op_errstr because it is assumed
+ * that the called function will do that in case of
+ * failure.
+ */
+ gf_log (this->name, GF_LOG_ERROR, "Failed to restore "
+ "snap for %s volume", volname);
+ goto out;
}
ret = 0; /* Success */
@@ -162,12 +140,11 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
dict_t *rsp_dict)
{
int ret = -1;
- int64_t i = 0;
- int64_t volcount = 0;
+ int32_t i = 0;
+ int32_t volcount = 0;
gf_boolean_t snap_restored = _gf_false;
char *volname = NULL;
char *snapname = NULL;
- char *cgname = NULL;
glusterd_volinfo_t *volinfo = NULL;
glusterd_snap_t *snap = NULL;
xlator_t *this = NULL;
@@ -180,30 +157,46 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
GF_ASSERT (op_errstr);
GF_ASSERT (rsp_dict);
- ret = dict_get_str (dict, "cgname", &cgname);
+ ret = dict_get_str (dict, "snapname", &snapname);
if (ret) {
- ret = dict_get_str (dict, "snapname", &snapname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
- "neither snapname nor cgname");
- goto out;
- }
- ret = dict_set_str (rsp_dict, "snapname", snapname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
- "snap name");
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ "snap name");
+ goto out;
+ }
+
+ snap = glusterd_find_snap_by_name (snapname);
+ if (NULL == snap) {
+ ret = gf_asprintf (op_errstr, "Snap (%s) not found",
+ snapname);
+ if (ret < 0) {
goto out;
}
- } else {
- ret = dict_set_str (rsp_dict, "cgname", cgname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
- "CG name");
+ gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ ret = -1;
+ goto out;
+ }
+
+ snap_restored = snap->snap_restored;
+
+ if (snap_restored) {
+ ret = gf_asprintf (op_errstr, "Snap (%s) already "
+ "restored", snapname);
+ if (ret < 0) {
goto out;
}
+ gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
+ ret = -1;
+ goto out;
}
- ret = dict_get_int64 (dict, "volcount", &volcount);
+ ret = dict_set_str (rsp_dict, "snapname", snapname);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set "
+ "snap name");
+ goto out;
+ }
+
+ ret = dict_get_int32 (dict, "volcount", &volcount);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get volume count");
@@ -217,7 +210,7 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
*/
for (i = 0; i < volcount; ++i) {
/* TODO: Start the index from 0 when Jarvis code is fixed */
- snprintf (key, sizeof (key), "volname%ld", i+1);
+ snprintf (key, sizeof (key), "volname%d", i+1);
ret = dict_get_str (dict, key, &volname);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to "
@@ -248,37 +241,6 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
- ret = dict_get_str (dict, "snapname", &snapname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
- "snap name");
- goto out;
- }
-
- snap = glusterd_find_snap_by_name (snapname);
- if (NULL == snap) {
- ret = gf_asprintf (op_errstr, "Snap (%s) not found",
- snapname);
- if (ret < 0) {
- goto out;
- }
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
- ret = -1;
- goto out;
- }
-
- snap_restored = snap->snap_restored;
-
- if (snap_restored) {
- ret = gf_asprintf (op_errstr, "Snap (%s) already "
- "restored", snapname);
- if (ret < 0) {
- goto out;
- }
- gf_log (this->name, GF_LOG_ERROR, "%s", *op_errstr);
- ret = -1;
- goto out;
- }
}
ret = 0;
@@ -2338,13 +2300,13 @@ glusterd_handle_snapshot_restore (rpcsvc_request_t *req, glusterd_op_t op,
dict_t *dict, char *err_str, size_t len)
{
int ret = -1;
- int64_t vol_count = 0;
- char *volname = NULL;
char *snapname = NULL;
- char *cgname = NULL;
glusterd_conf_t *conf = NULL;
- glusterd_snap_cg_t *cg = NULL;
xlator_t *this = NULL;
+ glusterd_snap_t *snap = NULL;
+ glusterd_volinfo_t *snap_volinfo = NULL;
+ int32_t i = 0;
+ char key[PATH_MAX] = "";
this = THIS;
GF_ASSERT (this);
@@ -2355,63 +2317,39 @@ glusterd_handle_snapshot_restore (rpcsvc_request_t *req, glusterd_op_t op,
GF_ASSERT (dict);
GF_ASSERT (err_str);
- /* If volume name is provided then volcount will be set */
- ret = dict_get_int64 (dict, "volcount", &vol_count);
+ ret = dict_get_str (dict, "snapname", &snapname);
if (ret) {
- /* If volcount is not provided then cgname must be there */
- ret = dict_get_str (dict, "cgname", &cgname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "get neither volcount nor cgname");
- goto out;
- }
- } else {
- /* TODO: Change the index to 0 when Jarvis code is fixed */
- ret = dict_get_str (dict, "volname1", &volname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "get volname");
- goto out;
- }
- ret = dict_get_str (dict, "snapname", &snapname);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to "
- "get snapname");
- goto out;
- }
+ gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ "get snapname");
+ goto out;
}
- if (NULL != cgname) { /* Snapshot restore of CG */
- cg = glusterd_find_snap_cg_by_name (conf, cgname);
-
- if (NULL == cg) {
- snprintf (err_str, len, "CG %s not found", cgname);
- gf_log (this->name, GF_LOG_WARNING, "%s", err_str);
- ret = -1;
- goto out;
- }
-
- LOCK (&cg->lock);
- {
- /* First get the snap name of the CG */
- ret = glusterd_get_cg_snap_name_lk (dict, cg);
- if (ret) {
- goto unlock;
- }
-
- /* Then get the volumes belong to CG */
- ret = glusterd_get_cg_volume_names_lk (dict, cg);
- }
-unlock:
- UNLOCK (&cg->lock);
+ snap = glusterd_find_snap_by_name (snapname);
+ if (!snap) {
+ snprintf (err_str, len, "Snap (%s) does not exist", snapname);
+ gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
+ ret = -1;
+ goto out;
+ }
+ list_for_each_entry (snap_volinfo, &snap->volumes, vol_list) {
+ i++;
+ snprintf (key, sizeof (key), "volname%d", i);
+ ret = dict_set_str (dict, key, snap_volinfo->parent_volname);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to get "
- "volume names or snap name of %s CG", cgname);
+ gf_log (this->name, GF_LOG_ERROR, "Could not set "
+ "parent volume name");
goto out;
}
}
+ ret = dict_set_int32 (dict, "volcount", i);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Could not save volume count");
+ goto out;
+ }
+
ret = glusterd_mgmt_v3_initiate_snap_phases (req, op, dict);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to initiate snap "