summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
diff options
context:
space:
mode:
authorM. Mohan Kumar <mohan@in.ibm.com>2012-11-29 21:46:07 +0530
committerVijay Bellur <vbellur@redhat.com>2012-11-29 09:40:14 -0800
commit983d290f7b36fea580ed9337bdc15e8f0f6f5bb3 (patch)
tree7437660f9427ca9fb1bbf5432b38dc35f7351389 /xlators/mgmt/glusterd/src/glusterd-volume-ops.c
parent3c72850e8d00f0cf35ae054136be076a394e08e9 (diff)
BD Backend: CLI to create a full/linked clone of a image
A new CLI command added to support cloning/snapshotting of a LV device Syntax is: $ gluster bd clone <volname>:<vg>/<lv> <newlv> $ gluster bd snapshot <volname>:<vg>/<lv> <snap_lv> <size> BUG: 805138 Change-Id: Idc2ac14525a3998329c742bf85a06326cac8cd54 Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Reviewed-on: http://review.gluster.org/3719 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index b74bbec7c59..db143d5f07a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1295,6 +1295,24 @@ glusterd_op_stage_bd (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
+ } else if (bd_op == GF_BD_OP_SNAPSHOT_BD) {
+ ret = dict_get_str (dict, "size", &size);
+ if (ret) {
+ snprintf (msg, sizeof(msg), "Failed to get size");
+ gf_log ("", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+ goto out;
+ }
+
+ if (gf_string2bytesize (size, &bytes) < 0) {
+ ret = -1;
+ snprintf (msg, sizeof(msg),
+ "Invalid size %s, suffix with KB, MB etc",
+ size);
+ gf_log ("", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+ goto out;
+ }
}
ret = glusterd_volinfo_find (volname, &volinfo);
@@ -1324,7 +1342,6 @@ out:
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}
-
#endif
int