Skip to content

Commit 9085415

Browse files
vpandey-RHgluster-ant
authored andcommitted
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>
1 parent f49294c commit 9085415

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

heal/src/glfs-heal.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ int32_t is_xml;
7171
#define USAGE_STR "Usage: %s <VOLNAME> [bigger-file <FILE> | "\
7272
"latest-mtime <FILE> | "\
7373
"source-brick <HOSTNAME:BRICKNAME> [<FILE>] | "\
74-
"split-brain-info | info-summary]\n"
74+
"split-brain-info | info-summary] [glusterd-sock <FILE>"\
75+
"]\n"
7576

7677
typedef enum {
7778
GLFSH_MODE_CONTINUE_ON_ERROR = 1,
@@ -1561,14 +1562,19 @@ main (int argc, char **argv)
15611562
char *path = NULL;
15621563
char *file = NULL;
15631564
char *op_errstr = NULL;
1565+
char *socket_filepath = NULL;
15641566
gf_xl_afr_op_t heal_op = -1;
15651567

15661568
if (argc < 2) {
15671569
printf (USAGE_STR, argv[0]);
15681570
ret = -1;
15691571
goto out;
1572+
} else if (argc >= 4) {
1573+
if (!strcmp(argv[argc - 2], "glusterd-sock")) {
1574+
socket_filepath = argv[argc - 1];
1575+
argc = argc - 2;
1576+
}
15701577
}
1571-
15721578
volname = argv[1];
15731579
switch (argc) {
15741580
case 2:
@@ -1591,12 +1597,12 @@ main (int argc, char **argv)
15911597
}
15921598
break;
15931599
case 4:
1594-
if ((!strcmp (argv[2], "split-brain-info"))
1595-
&& (!strcmp (argv[3], "xml"))) {
1600+
if ((!strcmp (argv[2], "split-brain-info")) &&
1601+
(!strcmp (argv[3], "xml"))) {
15961602
heal_op = GF_SHD_OP_SPLIT_BRAIN_FILES;
15971603
is_xml = 1;
1598-
} else if ((!strcmp (argv[2], "info-summary"))
1599-
&& (!strcmp (argv[3], "xml"))) {
1604+
} else if ((!strcmp (argv[2], "info-summary")) &&
1605+
(!strcmp (argv[3], "xml"))) {
16001606
heal_op = GF_SHD_OP_HEAL_SUMMARY;
16011607
is_xml = 1;
16021608
} else if (!strcmp (argv[2], "bigger-file")) {
@@ -1663,8 +1669,12 @@ main (int argc, char **argv)
16631669
fs->ctx->secure_mgmt = 1;
16641670
fs->ctx->ssl_cert_depth = glusterfs_read_secure_access_file ();
16651671
}
1666-
1667-
ret = glfs_set_volfile_server (fs, "unix", DEFAULT_GLUSTERD_SOCKFILE, 0);
1672+
if (socket_filepath != NULL) {
1673+
ret = glfs_set_volfile_server (fs, "unix", socket_filepath, 0);
1674+
} else {
1675+
ret = glfs_set_volfile_server (fs, "unix",
1676+
DEFAULT_GLUSTERD_SOCKFILE, 0);
1677+
}
16681678
if (ret) {
16691679
ret = -errno;
16701680
gf_asprintf (&op_errstr, "Setting the volfile server failed, "

0 commit comments

Comments
 (0)