diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2013-12-03 13:57:24 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2013-12-03 14:04:44 +0530 |
commit | 7fb03c40022af4ab5111ddccdd5d2ce926fe2ca9 (patch) | |
tree | 21223ceafd1b14e1ed5e25949977b8cf7952f229 | |
parent | 79a2b1997459cf6932e929488b0ade3535b9ced9 (diff) |
mgmt/glusterd: use runner apis to mount the snap device
Instead of using mount api to mount the snap device, use runner apis
to execute the mount command which mounts the snap device.
Change-Id: I8cf1fd4ade44d35dcd48c93fab10f5bea7f96f73
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index ea26059b5..f436f5ece 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -2465,6 +2465,8 @@ glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo, char *snap_brick_dir = NULL; char snap_brick_path[PATH_MAX] = {0, }; struct stat statbuf = {0, }; + runner_t runner = {0, }; + char msg[1024] = {0, }; this = THIS; @@ -2536,9 +2538,22 @@ glusterd_snap_brick_create (char *device, glusterd_volinfo_t *snap_volinfo, } /* mount the snap logical device on the directory inside /run/gluster/snaps/<snapname>/@snap_brick_mount_path + Way to mount the snap brick via mount api is this. + ret = mount (device, snap_brick_mount_path, entry->mnt_type, MS_MGC_VAL, + "nouuid"); + But for now, mounting using runner apis. */ - ret = mount (device, snap_brick_mount_path, entry->mnt_type, MS_MGC_VAL, - "nouuid"); + 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_log (&runner, "", GF_LOG_DEBUG, msg); + + //let glusterd get blocked till snapshot is over + synclock_unlock (&priv->big_lock); + ret = runner_run (&runner); + synclock_lock (&priv->big_lock); if (ret) { gf_log (this->name, GF_LOG_ERROR, "mounting the snapshot " "logical device %s failed (error: %s)", device, |