Patchwork [BUG:1283,2/3] glusterd: prefix added to gluster commands

login
register
Submitter Amar Tumballi
Date 2010-08-21 07:23:42
Message ID <20100821072342.GA22218@gluster.com>
Download mbox | patch
Permalink /patch/4232/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Amar Tumballi - 2010-08-21 07:23:42
Signed-off-by: Amar Tumballi <amar@gluster.com>
---
 xlators/mgmt/glusterd/src/Makefile.am        |    3 +-
 xlators/mgmt/glusterd/src/glusterd-handler.c |    4 +-
 xlators/mgmt/glusterd/src/glusterd-op-sm.c   |   28 ++++++++++++++-----------
 xlators/mgmt/glusterd/src/glusterd-utils.c   |    4 +-
 4 files changed, 22 insertions(+), 17 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index db5b9fa..29733d0 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -15,6 +15,7 @@  noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h glusterd-sm.h \
 AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
 	-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS)\
 	-I$(rpclibdir) -L$(xlatordir)/ -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/rpc/xdr/src\
-	-I$(top_srcdir)/rpc/rpc-lib/src -I$(CONTRIBDIR)/uuid
+	-I$(top_srcdir)/rpc/rpc-lib/src -I$(CONTRIBDIR)/uuid -DGFS_PREFIX=\"$(prefix)\"
+
 
 CLEANFILES =
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 64db68f..7e9a82e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -863,10 +863,10 @@  glusterd_handle_defrag_volume (rpcsvc_request_t *req)
                         goto out;
                 }
 
-                snprintf (cmd_str, 4096, "glusterfs -f %s/vols/%s/%s-tcp.vol "
+                snprintf (cmd_str, 4096, "%s/sbin/glusterfs -f %s/vols/%s/%s-tcp.vol "
                           "--xlator-option dht0.unhashed-sticky-bit=yes "
                           "--xlator-option dht0.lookup-unhashed=yes "
-                          "--volume-name quickread %s",
+                          "--volume-name quickread %s", GFS_PREFIX,
                           priv->workdir, cli_req.volname, cli_req.volname,
                           defrag->mount);
                 ret = system (cmd_str);
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 8af6cee..364377e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -290,34 +290,36 @@  glusterd_volume_create_generate_volfiles (glusterd_volinfo_t *volinfo)
                 case GF_CLUSTER_TYPE_REPLICATE:
                 {
                         snprintf (cmd_str, 8192,
-                                  "glusterfs-volgen --portmapper-mode -n %s "
+                                  "%s/bin/glusterfs-volgen --portmapper-mode -n %s "
                                   " -c %s -r 1 %s -p %d --num-replica %d",
-                                  volinfo->volname, path, bricks,
+                                  GFS_PREFIX, volinfo->volname, path, bricks,
                                   volinfo->port, volinfo->sub_count);
                         ret = system (cmd_str);
+                        gf_log ("", 1, "%s", cmd_str);
                         break;
                 }
 
                 case GF_CLUSTER_TYPE_STRIPE:
                 {
                         snprintf (cmd_str, 8192,
-                                  "glusterfs-volgen --portmapper-mode -n %s "
+                                  "%s/bin/glusterfs-volgen --portmapper-mode -n %s "
                                   " -c %s -r 0 %s -p %d --num-stripe %d",
-                                  volinfo->volname, path, bricks,
+                                  GFS_PREFIX, volinfo->volname, path, bricks,
                                   volinfo->port, volinfo->sub_count);
                         ret = system (cmd_str);
+                        gf_log ("", 1, "%s", cmd_str);
                         break;
                 }
 
                 case GF_CLUSTER_TYPE_NONE:
                 {
                         snprintf (cmd_str, 8192,
-                                  "glusterfs-volgen --portmapper-mode -n %s "
-                                  " -c %s %s -p %d",
-                                  volinfo->volname, path, bricks,
+                                  "%s/bin/glusterfs-volgen --portmapper-mode "
+                                  " -n %s -c %s %s -p %d",
+                                  GFS_PREFIX, volinfo->volname, path, bricks,
                                   volinfo->port);
-                        gf_log ("", 1, "%s", cmd_str);
                         ret = system (cmd_str);
+                        gf_log ("", 1, "%s", cmd_str);
                         break;
                 }
 
@@ -1004,8 +1006,9 @@  rb_spawn_dst_brick (glusterd_volinfo_t *volinfo,
 
         priv = THIS->private;
 
-        snprintf (cmd_str, 8192, "glusterfs -f %s/vols/%s/%s -p %s/vols/%s/%s",
-                  priv->workdir, volinfo->volname,
+        snprintf (cmd_str, 8192,
+                  "%s/sbin/glusterfs -f %s/vols/%s/%s -p %s/vols/%s/%s",
+                  GFS_PREFIX, priv->workdir, volinfo->volname,
                   RB_DSTBRICKVOL_FILENAME,
                   priv->workdir, volinfo->volname,
                   RB_DSTBRICK_PIDFILE);
@@ -1038,8 +1041,9 @@  rb_spawn_glusterfs_client (glusterd_volinfo_t *volinfo,
 
         priv = THIS->private;
 
-        snprintf (cmd_str, 4096, "glusterfs -f %s/vols/%s/%s %s/vols/%s/%s",
-                  priv->workdir, volinfo->volname,
+        snprintf (cmd_str, 4096,
+                  "%s/sbin/glusterfs -f %s/vols/%s/%s %s/vols/%s/%s",
+                  GFS_PREFIX, priv->workdir, volinfo->volname,
                   RB_CLIENTVOL_FILENAME,
                   priv->workdir, volinfo->volname,
                   RB_CLIENT_MOUNTPOINT);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 4202f27..424c35f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -767,9 +767,9 @@  glusterd_volume_start_glusterfs (glusterd_volinfo_t  *volinfo,
                   volinfo->volname, count);
 
         snprintf (cmd_str, 8192,
-                  "glusterfs --xlator-option server-*.listen-port=%d "
+                  "%s/sbin/glusterfs --xlator-option server-*.listen-port=%d "
                   "-s localhost --volfile-id %s -p %s --brick-name %s "
-                  "--brick-port %d",
+                  "--brick-port %d", GFS_PREFIX,
                   port, volfile, pidfile, brickinfo->path, port);
         ret = system (cmd_str);