diff options
Diffstat (limited to 'geo-replication/src')
| -rw-r--r-- | geo-replication/src/gsyncd.c | 14 | ||||
| -rwxr-xr-x | geo-replication/src/gverify.sh | 33 | ||||
| -rw-r--r-- | geo-replication/src/peer_georep-sshkey.py.in | 4 | ||||
| -rwxr-xr-x | geo-replication/src/peer_gsec_create.in | 4 | ||||
| -rw-r--r-- | geo-replication/src/peer_mountbroker.py.in | 31 | ||||
| -rw-r--r-- | geo-replication/src/procdiggy.c | 24 | ||||
| -rwxr-xr-x | geo-replication/src/set_geo_rep_pem_keys.sh | 1 |
7 files changed, 71 insertions, 40 deletions
diff --git a/geo-replication/src/gsyncd.c b/geo-replication/src/gsyncd.c index cf0e76f69c4..b5aeec5bf33 100644 --- a/geo-replication/src/gsyncd.c +++ b/geo-replication/src/gsyncd.c @@ -7,8 +7,8 @@ later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ -#include "compat.h" -#include "syscall.h" +#include <glusterfs/compat.h> +#include <glusterfs/syscall.h> #include <stdlib.h> #include <stdio.h> @@ -24,13 +24,13 @@ * We unconditionally pass then while building gsyncd binary. */ #ifdef USE_LIBGLUSTERFS -#include "glusterfs.h" -#include "globals.h" -#include "defaults.h" +#include <glusterfs/glusterfs.h> +#include <glusterfs/globals.h> +#include <glusterfs/defaults.h> #endif -#include "common-utils.h" -#include "run.h" +#include <glusterfs/common-utils.h> +#include <glusterfs/run.h> #include "procdiggy.h" #define _GLUSTERD_CALLED_ "_GLUSTERD_CALLED_" diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh index d048de0992b..f5f70d245e0 100755 --- a/geo-replication/src/gverify.sh +++ b/geo-replication/src/gverify.sh @@ -94,6 +94,7 @@ echo $cmd_line; function master_stats() { MASTERVOL=$1; + local inet6=$2; local d; local i; local disk_size; @@ -102,7 +103,12 @@ function master_stats() local m_status; d=$(mktemp -d -t ${0##*/}.XXXXXX 2>/dev/null); - glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --volfile-id $MASTERVOL -l $master_log_file $d; + if [ "$inet6" = "inet6" ]; then + glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --xlator-option="transport.address-family=inet6" --volfile-id $MASTERVOL -l $master_log_file $d; + else + glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --volfile-id $MASTERVOL -l $master_log_file $d; + fi + i=$(get_inode_num $d); if [[ "$i" -ne "1" ]]; then echo 0:0; @@ -124,12 +130,18 @@ function slave_stats() SLAVEUSER=$1; SLAVEHOST=$2; SLAVEVOL=$3; + local inet6=$4; local cmd_line; local ver; local status; d=$(mktemp -d -t ${0##*/}.XXXXXX 2>/dev/null); - glusterfs --xlator-option="*dht.lookup-unhashed=off" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d; + if [ "$inet6" = "inet6" ]; then + glusterfs --xlator-option="*dht.lookup-unhashed=off" --xlator-option="transport.address-family=inet6" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d; + else + glusterfs --xlator-option="*dht.lookup-unhashed=off" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d; + fi + i=$(get_inode_num $d); if [[ "$i" -ne "1" ]]; then echo 0:0; @@ -167,6 +179,10 @@ function main() log_file=$6 > $log_file + inet6=$7 + local cmd_line + local ver + # Use FORCE_BLOCKER flag in the error message to differentiate # between the errors which the force command should bypass @@ -192,20 +208,21 @@ function main() exit 1; fi; + cmd_line=$(cmd_slave); if [[ -z "${GR_SSH_IDENTITY_KEY}" ]]; then - err=$((ssh -p ${SSH_PORT} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "gluster --version") 2>&1) + ver=$(ssh -p ${SSH_PORT} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 bash -c "'$cmd_line'") else - err=$((ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "gluster --version") 2>&1) + ver=$(ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 bash -c "'$cmd_line'") fi - if [ $? -ne 0 ]; then - echo "FORCE_BLOCKER|gluster command on $2@$3 failed. Error: $err" > $log_file + if [ -z "$ver" ]; then + echo "FORCE_BLOCKER|gluster command not found on $3 for user $2." > $log_file exit 1; fi; ERRORS=0; - master_data=$(master_stats $1); - slave_data=$(slave_stats $2 $3 $4); + master_data=$(master_stats $1 ${inet6}); + slave_data=$(slave_stats $2 $3 $4 ${inet6}); master_disk_size=$(echo $master_data | cut -f1 -d':'); slave_disk_size=$(echo $slave_data | cut -f1 -d':'); master_used_size=$(echo $master_data | cut -f2 -d':'); diff --git a/geo-replication/src/peer_georep-sshkey.py.in b/geo-replication/src/peer_georep-sshkey.py.in index 2196fd7491a..58696e9a616 100644 --- a/geo-replication/src/peer_georep-sshkey.py.in +++ b/geo-replication/src/peer_georep-sshkey.py.in @@ -30,8 +30,8 @@ from prettytable import PrettyTable SECRET_PEM = "@GLUSTERD_WORKDIR@/geo-replication/secret.pem" TAR_SSH_PEM = "@GLUSTERD_WORKDIR@/geo-replication/tar_ssh.pem" -GSYNCD_CMD = 'command="@GLUSTERFS_LIBEXECDIR@/gsyncd" ' -TAR_CMD = 'command="tar ${SSH_ORIGINAL_COMMAND#* }" ' +GSYNCD_CMD = 'command="@GLUSTERFS_LIBEXECDIR@/gsyncd" ' +TAR_CMD = 'command="tar ${SSH_ORIGINAL_COMMAND#* }" ' COMMON_SECRET_FILE = "@GLUSTERD_WORKDIR@/geo-replication/common_secret.pem.pub" diff --git a/geo-replication/src/peer_gsec_create.in b/geo-replication/src/peer_gsec_create.in index 05c1638bdcd..6d4a4847013 100755 --- a/geo-replication/src/peer_gsec_create.in +++ b/geo-replication/src/peer_gsec_create.in @@ -18,7 +18,7 @@ if [ "Xcontainer" = "X$1" ]; then output1=`cat "$GLUSTERD_WORKDIR"/geo-replication/secret.pem.pub` output2=`cat "$GLUSTERD_WORKDIR"/geo-replication/tar_ssh.pem.pub` else - output1=`echo command=\"${libexecdir}/glusterfs/gsyncd\" " "``cat "$GLUSTERD_WORKDIR"/geo-replication/secret.pem.pub` - output2=`echo command=\"tar \$\{SSH_ORIGINAL_COMMAND#* \}\" " "``cat "$GLUSTERD_WORKDIR"/geo-replication/tar_ssh.pem.pub` + output1=`echo command=\"${libexecdir}/glusterfs/gsyncd\" ""``cat "$GLUSTERD_WORKDIR"/geo-replication/secret.pem.pub` + output2=`echo command=\"tar \$\{SSH_ORIGINAL_COMMAND#* \}\" ""``cat "$GLUSTERD_WORKDIR"/geo-replication/tar_ssh.pem.pub` fi echo -e "$output1\n$output2" diff --git a/geo-replication/src/peer_mountbroker.py.in b/geo-replication/src/peer_mountbroker.py.in index 77b938646e8..40b90ffc560 100644 --- a/geo-replication/src/peer_mountbroker.py.in +++ b/geo-replication/src/peer_mountbroker.py.in @@ -11,6 +11,7 @@ from gluster.cliutils import (execute, Cmd, node_output_ok, from prettytable import PrettyTable LOG_DIR = "@localstatedir@/log/glusterfs/geo-replication-slaves" +CLI_LOG = "@localstatedir@/log/glusterfs/cli.log" GEOREP_DIR = "@GLUSTERD_WORKDIR@/geo-replication" GLUSTERD_VOLFILE = "@GLUSTERD_VOLFILE@" @@ -46,7 +47,7 @@ class MountbrokerUserMgmt(object): for line in f: line = line.strip() if line.startswith("option "): - key, value = line.split(" ")[1:] + key, value = line.split()[1:] self._options[key] = value if line.startswith("#"): self.commented_lines.append(line) @@ -145,7 +146,7 @@ class NodeSetup(Cmd): # chgrp -R <grp> /var/log/glusterfs/geo-replication-slaves # chgrp -R <grp> /var/lib/glusterd/geo-replication # chmod -R 770 /var/log/glusterfs/geo-replication-slaves - # chmod -R 770 /var/lib/glusterd/geo-replication + # chmod 770 /var/lib/glusterd/geo-replication # mkdir -p <mnt_root> # chmod 0711 <mnt_root> # If selinux, @@ -195,8 +196,13 @@ class NodeSetup(Cmd): execute(["chgrp", "-R", args.group, GEOREP_DIR]) execute(["chgrp", "-R", args.group, LOG_DIR]) - execute(["chmod", "-R", "770", GEOREP_DIR]) - execute(["chmod", "-R", "770", args.group, LOG_DIR]) + execute(["chgrp", args.group, CLI_LOG]) + execute(["chmod", "770", GEOREP_DIR]) + execute(["find", LOG_DIR, "-type", "d", "-exec", "chmod", "770", "{}", + "+"]) + execute(["find", LOG_DIR, "-type", "f", "-exec", "chmod", "660", "{}", + "+"]) + execute(["chmod", "660", CLI_LOG]) m.set_mount_root_and_group(args.mount_root, args.group) m.save() @@ -216,8 +222,10 @@ class CliSetup(Cmd): name = "setup" def args(self, parser): - parser.add_argument("mount_root") - parser.add_argument("group") + parser.add_argument("mount_root", + help="Path to the mountbroker-root directory.") + parser.add_argument("group", + help="Group to be used for setup.") def run(self, args): out = execute_in_peers("node-setup", [args.mount_root, @@ -327,8 +335,10 @@ class CliAdd(Cmd): name = "add" def args(self, parser): - parser.add_argument("volume") - parser.add_argument("user") + parser.add_argument("volume", + help="Volume to be added.") + parser.add_argument("user", + help="User for which volume is to be added.") def run(self, args): out = execute_in_peers("node-add", [args.volume, @@ -368,8 +378,9 @@ class CliRemove(Cmd): name = "remove" def args(self, parser): - parser.add_argument("--volume", default=".") - parser.add_argument("--user", default=".") + parser.add_argument("--volume", default=".", help="Volume to be removed.") + parser.add_argument("--user", default=".", + help="User for which volume has to be removed.") def run(self, args): out = execute_in_peers("node-remove", [args.volume, diff --git a/geo-replication/src/procdiggy.c b/geo-replication/src/procdiggy.c index 05c1e1edc68..8068ef79a42 100644 --- a/geo-replication/src/procdiggy.c +++ b/geo-replication/src/procdiggy.c @@ -15,8 +15,8 @@ #include <ctype.h> #include <sys/param.h> /* for PATH_MAX */ -#include "common-utils.h" -#include "syscall.h" +#include <glusterfs/common-utils.h> +#include <glusterfs/syscall.h> #include "procdiggy.h" pid_t @@ -31,6 +31,10 @@ pidinfo(pid_t pid, char **name) }; char *p = NULL; int ret = 0; + pid_t lpid = -1; + + if (name) + *name = NULL; snprintf(path, sizeof path, PROC "/%d/status", pid); @@ -38,14 +42,12 @@ pidinfo(pid_t pid, char **name) if (!f) return -1; - if (name) - *name = NULL; for (;;) { size_t len; memset(buf, 0, sizeof(buf)); if (fgets(buf, sizeof(buf), f) == NULL || (len = strlen(buf)) == 0 || buf[len - 1] != '\n') { - pid = -1; + lpid = -1; goto out; } buf[len - 1] = '\0'; @@ -57,7 +59,7 @@ pidinfo(pid_t pid, char **name) ; *name = gf_strdup(p); if (!*name) { - pid = -2; + lpid = -2; goto out; } continue; @@ -71,17 +73,17 @@ pidinfo(pid_t pid, char **name) while (isspace(*++p)) ; - ret = gf_string2int(p, &pid); + ret = gf_string2int(p, &lpid); if (ret == -1) - pid = -1; + lpid = -1; out: fclose(f); - if (pid == -1 && name && *name) + if (lpid == -1 && name && *name) GF_FREE(*name); - if (pid == -2) + if (lpid == -2) fprintf(stderr, "out of memory\n"); - return pid; + return lpid; } int diff --git a/geo-replication/src/set_geo_rep_pem_keys.sh b/geo-replication/src/set_geo_rep_pem_keys.sh index ae23f4ff0c6..8a43fa39d1f 100755 --- a/geo-replication/src/set_geo_rep_pem_keys.sh +++ b/geo-replication/src/set_geo_rep_pem_keys.sh @@ -47,6 +47,7 @@ function main() cp $home_dir/${COMMON_SECRET_PEM_PUB} ${GLUSTERD_WORKDIR}/geo-replication/ gluster system:: copy file /geo-replication/${COMMON_SECRET_PEM_PUB} gluster system:: execute add_secret_pub $user geo-replication/${master_vol}_${slave_vol}_common_secret.pem.pub + gluster vol set ${slave_vol} features.read-only on else echo "$home_dir/common_secret.pem.pub not present. Please run geo-replication command on master with push-pem option to generate the file" exit 1; |
