summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Pandey <vpandey@redhat.com>2018-03-26 12:05:25 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2018-03-27 02:24:11 +0000
commit25fc63912023919e4eaea918810bcb91ee07db46 (patch)
tree32a427beddc3531fb3ad5fed482864d4ae5f2e27
parent9c047f4cae22121b2382551ab56a694665603fd7 (diff)
glfs heal binary change to accomodate socket file arguments
Change-Id: I755d6552decd015aec7859ad2cf99c76c8bee9dc fixes: bz#1558380 BUG: 1558380 Signed-off-by: Vishal Pandey <vpandey@redhat.com>
-rw-r--r--heal/src/glfs-heal.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index e86c76cde49..930b08f8301 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -71,7 +71,8 @@ int32_t is_xml;
#define USAGE_STR "Usage: %s <VOLNAME> [bigger-file <FILE> | "\
"latest-mtime <FILE> | "\
"source-brick <HOSTNAME:BRICKNAME> [<FILE>] | "\
- "split-brain-info | info-summary]\n"
+ "split-brain-info | info-summary] [glusterd-sock <FILE>"\
+ "]\n"
typedef enum {
GLFSH_MODE_CONTINUE_ON_ERROR = 1,
@@ -1561,14 +1562,19 @@ main (int argc, char **argv)
char *path = NULL;
char *file = NULL;
char *op_errstr = NULL;
+ char *socket_filepath = NULL;
gf_xl_afr_op_t heal_op = -1;
if (argc < 2) {
printf (USAGE_STR, argv[0]);
ret = -1;
goto out;
+ } else if (argc >= 4) {
+ if (!strcmp(argv[argc - 2], "glusterd-sock")) {
+ socket_filepath = argv[argc - 1];
+ argc = argc - 2;
+ }
}
-
volname = argv[1];
switch (argc) {
case 2:
@@ -1591,12 +1597,12 @@ main (int argc, char **argv)
}
break;
case 4:
- if ((!strcmp (argv[2], "split-brain-info"))
- && (!strcmp (argv[3], "xml"))) {
+ if ((!strcmp (argv[2], "split-brain-info")) &&
+ (!strcmp (argv[3], "xml"))) {
heal_op = GF_SHD_OP_SPLIT_BRAIN_FILES;
is_xml = 1;
- } else if ((!strcmp (argv[2], "info-summary"))
- && (!strcmp (argv[3], "xml"))) {
+ } else if ((!strcmp (argv[2], "info-summary")) &&
+ (!strcmp (argv[3], "xml"))) {
heal_op = GF_SHD_OP_HEAL_SUMMARY;
is_xml = 1;
} else if (!strcmp (argv[2], "bigger-file")) {
@@ -1663,8 +1669,12 @@ main (int argc, char **argv)
fs->ctx->secure_mgmt = 1;
fs->ctx->ssl_cert_depth = glusterfs_read_secure_access_file ();
}
-
- ret = glfs_set_volfile_server (fs, "unix", DEFAULT_GLUSTERD_SOCKFILE, 0);
+ if (socket_filepath != NULL) {
+ ret = glfs_set_volfile_server (fs, "unix", socket_filepath, 0);
+ } else {
+ ret = glfs_set_volfile_server (fs, "unix",
+ DEFAULT_GLUSTERD_SOCKFILE, 0);
+ }
if (ret) {
ret = -errno;
gf_asprintf (&op_errstr, "Setting the volfile server failed, "