summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handshake.c
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-05-06 14:32:28 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-05-08 22:23:46 -0700
commit065b91b4993f1ab0abc8b1db4d5745a6b58545b0 (patch)
tree4fc15626547c5be41071c21531534fa7557f64d0 /xlators/mgmt/glusterd/src/glusterd-handshake.c
parent4f8c7cc34dad6a963f70dfcf11e737fd44c31a42 (diff)
glusterd/snapshot: Add brick-count suffix for the LVM snapshot
When there are more than one brick created from the same LVM volume group, there will be a conflict with the LVM snapshot name we use. Solution is to add a brick-count suffix to the LVM snapshot name Change-Id: I7258e69fe0b50e86b81c66ab1db523ab3c7cbae0 BUG: 1091934 Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/7581 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handshake.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 1797778d150..2b89545c80d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -398,8 +398,29 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
/* Fetch the device path */
- device = glusterd_take_lvm_snapshot (snap_vol, snap_opinfo->brick_path);
+ device = glusterd_get_brick_mount_device (snap_opinfo->brick_path);
if (!device) {
+ gf_log (this->name, GF_LOG_ERROR, "Getting device name for the"
+ "brick %s:%s failed", brickinfo->hostname,
+ snap_opinfo->brick_path);
+ ret = -1;
+ goto out;
+ }
+
+ device = glusterd_build_snap_device_path (device, snap_vol->volname,
+ snap_opinfo->brick_num - 1);
+ if (!device) {
+ gf_log (this->name, GF_LOG_ERROR, "cannot copy the snapshot "
+ "device name (volname: %s, snapname: %s)",
+ snap_vol->volname, snap->snapname);
+ ret = -1;
+ goto out;
+ }
+ strncpy (brickinfo->device_path, device,
+ sizeof(brickinfo->device_path));
+
+ ret = glusterd_take_lvm_snapshot (brickinfo, snap_opinfo->brick_path);
+ if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to take snapshot of %s",
snap_opinfo->brick_path);
@@ -407,9 +428,8 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
/* Create and mount the snap brick */
- ret = glusterd_snap_brick_create (device, snap_vol,
- snap_opinfo->brick_num,
- brickinfo->mount_dir);
+ ret = glusterd_snap_brick_create (snap_vol, brickinfo,
+ snap_opinfo->brick_num - 1);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to "
" create and mount the brick(%s) for the snap %s",
@@ -417,11 +437,7 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
snap_vol->snapshot->snapname);
goto out;
}
-
- strncpy (brickinfo->device_path, device,
- sizeof(brickinfo->device_path));
brickinfo->snap_status = 0;
-
ret = glusterd_store_volinfo (snap_vol,
GLUSTERD_VOLINFO_VER_AC_NONE);
if (ret) {
@@ -431,6 +447,7 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
goto out;
}
+
ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "starting the "
@@ -440,6 +457,9 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
goto out;
}
out:
+ if (device)
+ GF_FREE (device);
+
return ret;
}