summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-03-18 03:31:05 +0000
committerRajesh Joseph <rjoseph@redhat.com>2014-04-02 06:01:00 -0700
commit38bfc07c9425687c8a8eed1c92d9ecd016cb00be (patch)
treeefc4b5f81038e6847be7114cae36b52d9cd3a440 /xlators/mgmt
parent4684cc67accdffd3d999d1528f6306e2b98b0654 (diff)
glusterd/snapshot: Using original brickinfo for snap brick path
Using /var/run/gluster/snaps/<snap-uuid>/ <original brick number>/<original brick's mount dir> as the snapshot brick path Change-Id: Icdd838512e662ed687662188bd197ed1a889fbea Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/7231 Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c408
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
5 files changed, 262 insertions, 161 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index ba4b05b99..671271aea 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -393,9 +393,10 @@ out:
int
glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
{
- char *snap_mount = NULL;
+ char *snap_brick_dir = NULL;
+ char *snap_device = NULL;
char *tmpstr = NULL;
- char snapmntname[PATH_MAX] = "";
+ char key[PATH_MAX] = "";
char snapbrckcnt[PATH_MAX] = "";
char snapbrckord[PATH_MAX] = "";
int ret = -1;
@@ -404,17 +405,16 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
int64_t volume_count = 0;
int64_t brick_count = 0;
int64_t brick_order = 0;
+ xlator_t *this = NULL;
-
- if (!dst || !src) {
- gf_log ("", GF_LOG_ERROR, "Source or Destination "
- "dict is empty.");
- goto out;
- }
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (dst);
+ GF_ASSERT (src);
ret = dict_get_int64 (src, "volcount", &volume_count);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "failed to "
+ gf_log (this->name, GF_LOG_ERROR, "failed to "
"get the volume count");
goto out;
}
@@ -425,58 +425,88 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
"vol%ld_brickcount", i+1);
ret = dict_get_int64 (src, snapbrckcnt, &brick_count);
if (ret) {
- gf_log ("", GF_LOG_TRACE,
+ gf_log (this->name, GF_LOG_TRACE,
"No bricks for this volume in this dict");
continue;
}
for (j = 0; j < brick_count; j++) {
/* Fetching data from source dict */
- memset (snapmntname, '\0', sizeof(snapmntname));
- ret = snprintf (snapmntname, sizeof(snapmntname) - 1,
- "vol%ld.brick%ld", i+1, j);
+ snprintf (key, sizeof(key) - 1,
+ "vol%ld.brickdir%ld", i+1, j);
+
+ ret = dict_get_ptr (src, key,
+ (void **)&snap_brick_dir);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to fetch snap brick dir");
+ goto out;
+ }
- ret = dict_get_ptr (src, snapmntname, (void **)&snap_mount);
+ snprintf (key, sizeof(key) - 1,
+ "vol%ld.brick_snapdevice%ld", i+1, j);
+
+ ret = dict_get_ptr (src, key,
+ (void **)&snap_device);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Unable to fetch "
- "snap mount path");
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to fetch snap_device");
goto out;
}
- memset (snapbrckord, '\0', sizeof(snapbrckord));
- ret = snprintf (snapbrckord, sizeof(snapbrckord) - 1,
- "vol%ld.brick%ld.order", i+1, j);
+
+ snprintf (snapbrckord, sizeof(snapbrckord) - 1,
+ "vol%ld.brick%ld.order", i+1, j);
ret = dict_get_int64 (src, snapbrckord, &brick_order);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to get brick order");
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get brick order");
goto out;
}
/* Adding the data in the dst dict */
- memset (snapmntname, '\0', sizeof(snapmntname));
- ret = snprintf (snapmntname, sizeof(snapmntname) - 1,
- "vol%ld.brick%ld", i+1, brick_order);
+ snprintf (key, sizeof(key) - 1,
+ "vol%ld.brickdir%ld", i+1, brick_order);
+
+ tmpstr = gf_strdup (snap_brick_dir);
+ if (!tmpstr) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Out Of Memory");
+ ret = -1;
+ goto out;
+ }
+ ret = dict_set_dynstr (dst, key, tmpstr);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ GF_FREE (tmpstr);
+ goto out;
+ }
- tmpstr = gf_strdup (snap_mount);
+ snprintf (key, sizeof(key) - 1,
+ "vol%ld.brick_snapdevice%ld",
+ i+1, brick_order);
+
+ tmpstr = gf_strdup (snap_device);
if (!tmpstr) {
- gf_log (THIS->name, GF_LOG_ERROR, "Out Of Memory");
ret = -1;
goto out;
}
- ret = dict_set_dynstr (dst, snapmntname, tmpstr);
+ ret = dict_set_dynstr (dst, key, tmpstr);
if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR, "Failed to set %s",
- snap_mount);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
GF_FREE (tmpstr);
goto out;
}
+
}
}
ret = 0;
out:
- gf_log (THIS->name, GF_LOG_TRACE, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
return ret;
}
@@ -525,8 +555,8 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
char *snapname = NULL;
char *device = NULL;
char *tmpstr = NULL;
- char *snap_brick_dir = NULL;
- char snap_brick_path[PATH_MAX] = "";
+ char *brick_dir = NULL;
+ char snap_brick_dir[PATH_MAX] = "";
char *mnt_pt = NULL;
char key[PATH_MAX] = "";
char snap_mount[PATH_MAX] = "";
@@ -662,15 +692,16 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
- glusterd_replace_slash_with_hyphen (device);
- if (device[0] == '-')
- device[0] = '/';
-
- ret = snprintf (snap_mount, sizeof(snap_mount) - 1,
- "%s/%s%s-brick",
- snap_mount_folder,
- snap_volname, device);
- snap_mount[ret] = '\0';
+ snprintf (key, sizeof(key),
+ "vol%ld.brick_snapdevice%ld", i,
+ brick_count);
+ ret = dict_set_dynstr (rsp_dict, key, device);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ GF_FREE (device);
+ goto out;
+ }
ret = glusterd_get_brick_root (brickinfo->path, &mnt_pt);
if (ret) {
@@ -688,26 +719,23 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
- snap_brick_dir = &brickinfo->path[strlen (mnt_pt)];
- if (snap_brick_dir)
- snap_brick_dir++;
+ brick_dir = &brickinfo->path[strlen (mnt_pt)];
+ brick_dir++;
- snprintf (snap_brick_path, sizeof (snap_brick_path),
- "%s/%s", snap_mount, snap_brick_dir);
+ snprintf (snap_brick_dir, sizeof (snap_brick_dir),
+ "/%s", brick_dir);
-
- tmpstr = gf_strdup (snap_brick_path);
+ tmpstr = gf_strdup (snap_brick_dir);
if (!tmpstr) {
ret = -1;
goto out;
}
- snprintf (key, sizeof(key), "vol%ld.brick%ld", i,
+ snprintf (key, sizeof(key), "vol%ld.brickdir%ld", i,
brick_count);
ret = dict_set_dynstr (rsp_dict, key, tmpstr);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to set %s", snap_mount);
- GF_FREE (tmpstr);
goto out;
}
tmpstr = NULL;
@@ -2576,18 +2604,16 @@ out:
int32_t
glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo,
- glusterd_brickinfo_t *original_brickinfo)
+ glusterd_brickinfo_t *original_brickinfo,
+ int32_t brick_count, char *snap_brick_dir)
{
int32_t ret = -1;
xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- char *snap_brick_dir = NULL;
char snap_brick_mount_path[PATH_MAX] = "";
- char *tmp = NULL;
char snap_brick_path[PATH_MAX] = "";
char msg[1024] = "";
char *mnt_pt = NULL;
- struct mntent *entry = NULL;
FILE *mtab = NULL;
struct stat statbuf = {0, };
runner_t runner = {0, };
@@ -2595,62 +2621,18 @@ glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo,
this = THIS;
priv = this->private;
- if (!device) {
- gf_log (this->name, GF_LOG_ERROR, "device is NULL");
- goto out;
- }
-
- if (!snap_volinfo) {
- gf_log (this->name, GF_LOG_ERROR, "snap volinfo is NULL");
- goto out;
- }
-
- if (!original_brickinfo) {
- gf_log (this->name, GF_LOG_ERROR, "original brickinfo is NULL"
- "(snap: %s)", snap_volinfo->volname);
- goto out;
- }
-
- tmp = gf_strdup (device);
- if (!tmp) {
- gf_log (this->name, GF_LOG_INFO, "out of memory");
- goto out;
- }
-
- glusterd_replace_slash_with_hyphen (tmp);
- if (tmp[0] == '-')
- tmp[0] = '/';
-
- ret = glusterd_get_brick_root (original_brickinfo->path, &mnt_pt);
- if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "could not get the root of"
- "the brick path %s", original_brickinfo->path);
- goto out;
- }
-
- if (strncmp (original_brickinfo->path, mnt_pt, strlen (mnt_pt))) {
- gf_log (this->name, GF_LOG_WARNING, "brick: %s brick mount: %s",
- original_brickinfo->path, mnt_pt);
- goto out;
- }
-
- snap_brick_dir = &original_brickinfo->path[strlen (mnt_pt)];
- if (snap_brick_dir)
- snap_brick_dir++;
+ GF_ASSERT (device);
+ GF_ASSERT (snap_volinfo);
+ GF_ASSERT (original_brickinfo);
+ GF_ASSERT (snap_brick_dir);
snprintf (snap_brick_mount_path, sizeof (snap_brick_mount_path),
- "%s/%s%s-brick", snap_mount_folder,
- snap_volinfo->volname, tmp);
+ "%s/%s/brick%d", snap_mount_folder, snap_volinfo->volname,
+ brick_count+1);
- snprintf (snap_brick_path, sizeof (snap_brick_path), "%s/%s",
+ snprintf (snap_brick_path, sizeof (snap_brick_path), "%s%s",
snap_brick_mount_path, snap_brick_dir);
- entry = glusterd_get_mnt_entry_info (mnt_pt, mtab);
- if (!entry) {
- ret = -1;
- goto out;
- }
-
ret = mkdir_p (snap_brick_mount_path, 0777, _gf_true);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "creating the brick directory"
@@ -2668,8 +2650,8 @@ glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo,
runinit (&runner);
snprintf (msg, sizeof (msg), "mounting snapshot of the brick %s:%s",
original_brickinfo->hostname, original_brickinfo->path);
- runner_add_args (&runner, "mount", "-t", entry->mnt_type,
- "-o", "nouuid", device, snap_brick_mount_path, NULL);
+ runner_add_args (&runner, "mount", "-o", "nouuid", device,
+ snap_brick_mount_path, NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
//let glusterd get blocked till snapshot is over
@@ -2706,7 +2688,6 @@ glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo,
}
out:
- GF_FREE (tmp);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "unmounting the snap brick"
" mount %s", snap_brick_mount_path);
@@ -2720,16 +2701,152 @@ out:
return ret;
}
+static int32_t
+glusterd_add_bricks_to_snap_volume (dict_t *dict, glusterd_volinfo_t *snap_vol,
+ glusterd_brickinfo_t *original_brickinfo,
+ char **snap_brick_dir, int64_t volcount,
+ int32_t brick_count)
+{
+ char key[PATH_MAX] = "";
+ char snap_brick_path[PATH_MAX] = "";
+ char *snap_device = NULL;
+ glusterd_brickinfo_t *snap_brickinfo = NULL;
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (dict);
+ GF_ASSERT (snap_vol);
+ GF_ASSERT (original_brickinfo);
+ GF_ASSERT (snap_brick_dir);
+
+ ret = glusterd_brickinfo_new (&snap_brickinfo);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "initializing the brick for the snap "
+ "volume failed (snapname: %s)",
+ snap_vol->snapshot->snapname);
+ goto out;
+ }
+
+ snprintf (key, sizeof(key) - 1, "vol%ld.brickdir%d", volcount,
+ brick_count);
+ ret = dict_get_ptr (dict, key, (void **)snap_brick_dir);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Unable to fetch "
+ "snap mount path (%s)", key);
+ GF_FREE (snap_brickinfo);
+ goto out;
+ }
+
+ snprintf (key, sizeof(key), "vol%ld.brick_snapdevice%d",
+ volcount, brick_count);
+ ret = dict_get_ptr (dict, key, (void **)&snap_device);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Unable to fetch "
+ "snap device (%s)", key);
+ GF_FREE (snap_brickinfo);
+ goto out;
+ }
+
+ /* Create brick-path in the format /var/run/gluster/snaps/ *
+ * <snap-uuid>/<original-brick#>/snap-brick-dir *
+ */
+ snprintf (snap_brick_path, sizeof(snap_brick_path),
+ "%s/%s/brick%d%s", snap_mount_folder,
+ snap_vol->volname, brick_count+1,
+ *snap_brick_dir);
+
+ ret = gf_canonicalize_path (snap_brick_path);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to canonicalize path");
+ goto out;
+ }
+
+ strcpy (snap_brickinfo->hostname, original_brickinfo->hostname);
+ strcpy (snap_brickinfo->path, snap_brick_path);
+ strcpy (snap_brickinfo->device_path, snap_device);
+ uuid_copy (snap_brickinfo->uuid, original_brickinfo->uuid);
+ list_add_tail (&snap_brickinfo->brick_list, &snap_vol->bricks);
+
+out:
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ return ret;
+}
+
+static int32_t
+glusterd_take_brick_snapshot (glusterd_volinfo_t *origin_vol,
+ glusterd_volinfo_t *snap_vol,
+ glusterd_brickinfo_t *original_brickinfo,
+ char *snap_brick_dir, int32_t brick_count)
+{
+ char *device = NULL;
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (origin_vol);
+ GF_ASSERT (snap_vol);
+ GF_ASSERT (original_brickinfo);
+ GF_ASSERT (snap_brick_dir);
+
+ if (!glusterd_is_brick_started (original_brickinfo)) {
+ gf_log (this->name, GF_LOG_WARNING, "brick %s:%s is not"
+ " started (volume: %s snap: %s)",
+ original_brickinfo->hostname,
+ original_brickinfo->path,
+ origin_vol->volname,
+ snap_vol->snapshot->snapname);
+ ret = 0;
+ goto out;
+ }
+
+ device = glusterd_take_lvm_snapshot (snap_vol, original_brickinfo);
+ /* Fail the snapshot even though snapshot on one of
+ the bricks fails. At the end when we check whether
+ the snapshot volume meets quorum or not, then the
+ the snapshot can either be treated as success, or
+ in case of failure we can undo the changes and return
+ failure to cli. */
+ if (!device) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to take snapshot of %s:%s",
+ original_brickinfo->hostname,
+ original_brickinfo->path);
+ goto out;
+ }
+
+ /* create the complete brick here */
+ ret = glusterd_snap_brick_create (device, snap_vol,
+ original_brickinfo,
+ brick_count, snap_brick_dir);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "not able to"
+ " create the brickinfo for the snap %s"
+ ", volume %s", snap_vol->snapshot->snapname,
+ origin_vol->volname);
+ goto out;
+ }
+
+out:
+ if (device)
+ GF_FREE (device);
+
+ gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
+ return ret;
+}
+
glusterd_volinfo_t *
glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
dict_t *dict, int64_t volcount)
{
- char *snap_brick_mount_path = "";
char key[PATH_MAX] = "";
- char *device = NULL;
+ char *snap_brick_dir = NULL;
char *username = NULL;
char *password = NULL;
- glusterd_brickinfo_t *snap_brickinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_conf_t *priv = NULL;
glusterd_volinfo_t *snap_vol = NULL;
@@ -2796,70 +2913,39 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
/* Adding snap brickinfos to the snap volinfo */
brick_count = 0;
list_for_each_entry (brickinfo, &origin_vol->bricks, brick_list) {
- snap_brickinfo = NULL;
- device = NULL;
- ret = glusterd_brickinfo_new (&snap_brickinfo);
+ ret = glusterd_add_bricks_to_snap_volume (dict,
+ snap_vol,
+ brickinfo,
+ &snap_brick_dir,
+ volcount,
+ brick_count);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
- "initializing the brick for the snap "
- "volume failed (snapname: %s)", snap->snapname);
- goto out;
- }
-
- snprintf (key, sizeof(key) - 1, "vol%ld.brick%d", volcount,
- brick_count);
- ret = dict_get_ptr (dict, key, (void **)&snap_brick_mount_path);
- if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to fetch "
- "snap mount path (%s)", key);
- GF_FREE (snap_brickinfo);
+ "Failed to add the snap brick for "
+ "%s:%s to the snap volume",
+ brickinfo->hostname, brickinfo->path);
goto out;
}
- strcpy (snap_brickinfo->hostname, brickinfo->hostname);
- strcpy (snap_brickinfo->path, snap_brick_mount_path);
- uuid_copy (snap_brickinfo->uuid, brickinfo->uuid);
- list_add_tail (&snap_brickinfo->brick_list, &snap_vol->bricks);
- brick_count++;
- }
-
- list_for_each_entry (brickinfo, &origin_vol->bricks, brick_list) {
- if (uuid_compare (brickinfo->uuid, MY_UUID))
- continue;
-
- if (!glusterd_is_brick_started (brickinfo)) {
- gf_log (this->name, GF_LOG_WARNING, "brick %s:%s is not"
- " started (volume: %s snap: %s)",
- brickinfo->hostname, brickinfo->path,
- origin_vol->volname, snap->snapname);
+ /* Take snapshot of the brick */
+ if (uuid_compare (brickinfo->uuid, MY_UUID)) {
+ brick_count++;
continue;
}
- device = glusterd_take_lvm_snapshot (snap_vol, brickinfo);
- /* Fail the snapshot even though snapshot on one of
- the bricks fails. At the end when we check whether
- the snapshot volume meets quorum or not, then the
- the snapshot can either be treated as success, or
- in case of failure we can undo the changes and return
- failure to cli. */
- if (!device) {
+ ret = glusterd_take_brick_snapshot (origin_vol,
+ snap_vol,
+ brickinfo,
+ snap_brick_dir,
+ brick_count);
+ if (ret) {
gf_log (this->name, GF_LOG_ERROR,
- "Failed to take snapshot of %s:%s",
+ "Failed to take snapshot for %s:%s",
brickinfo->hostname, brickinfo->path);
goto out;
}
- /* create the complete brick here */
- ret = glusterd_snap_brick_create (device, snap_vol, brickinfo);
- GF_FREE (device);
- device = NULL;
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "not able to"
- " create the brickinfo for the snap %s"
- ", volume %s", snap->snapname,
- origin_vol->volname);
- goto out;
- }
+ brick_count++;
}
/*TODO: the quorum check of the snap volume here */
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 70b24aa81..48910fe3a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -241,6 +241,14 @@ glusterd_store_brickinfo_write (int fd, glusterd_brickinfo_t *brickinfo)
if (ret)
goto out;
+ if (strlen(brickinfo->device_path) > 0) {
+ snprintf (value, sizeof(value), "%s", brickinfo->device_path);
+ ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_BRICK_DEVICE_PATH,
+ value);
+ if (ret)
+ goto out;
+ }
+
if (!brickinfo->vg[0])
goto out;
@@ -1935,6 +1943,10 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
} else if (!strncmp (key, GLUSTERD_STORE_KEY_BRICK_DECOMMISSIONED,
strlen (GLUSTERD_STORE_KEY_BRICK_DECOMMISSIONED))) {
gf_string2int (value, &brickinfo->decommissioned);
+ } else if (!strncmp (key, GLUSTERD_STORE_KEY_BRICK_DEVICE_PATH,
+ strlen (GLUSTERD_STORE_KEY_BRICK_DEVICE_PATH))) {
+ strncpy (brickinfo->device_path, value,
+ sizeof (brickinfo->device_path));
} else if (!strncmp (key,
GLUSTERD_STORE_KEY_BRICK_VGNAME,
strlen (GLUSTERD_STORE_KEY_BRICK_VGNAME))) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index 008cca066..85ef4fec0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -76,6 +76,7 @@ typedef enum glusterd_store_ver_ac_{
#define GLUSTERD_STORE_KEY_BRICK_RDMA_PORT "rdma.listen-port"
#define GLUSTERD_STORE_KEY_BRICK_DECOMMISSIONED "decommissioned"
#define GLUSTERD_STORE_KEY_BRICK_VGNAME "vg"
+#define GLUSTERD_STORE_KEY_BRICK_DEVICE_PATH "device_path"
#define GLUSTERD_STORE_KEY_PEER_UUID "uuid"
#define GLUSTERD_STORE_KEY_PEER_HOSTNAME "hostname"
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 206a5ecc3..8eec06c1a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -552,6 +552,7 @@ glusterd_brickinfo_dup (glusterd_brickinfo_t *brickinfo,
strcpy (dup_brickinfo->hostname, brickinfo->hostname);
strcpy (dup_brickinfo->path, brickinfo->path);
+ strcpy (dup_brickinfo->device_path, brickinfo->device_path);
ret = gf_canonicalize_path (dup_brickinfo->path);
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR, "Failed to canonicalize "
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 9920b53f0..4634c1c4e 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -177,6 +177,7 @@ typedef enum gf_brick_status {
struct glusterd_brickinfo {
char hostname[1024];
char path[PATH_MAX];
+ char device_path[PATH_MAX];
struct list_head brick_list;
uuid_t uuid;
int port;