1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
$NetBSD: patch-bq,v 1.8 2011/11/28 08:42:39 manu Exp $
Make sure gluseterfsd listens on the same address family as glusterd
--- xlators/mgmt/glusterd/src/glusterd-utils.c.orig 2011-11-27 07:38:16.000000000 +0100
+++ xlators/mgmt/glusterd/src/glusterd-utils.c 2011-11-27 07:38:16.000000000 +0100
@@ -88,8 +88,52 @@
//TODO: set timestamp
return 0;
}
+static const char *
+glusterd_listener_family_name(void)
+{
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
+ rpcsvc_listener_t *listener = NULL;
+ struct sockaddr_storage ss;
+
+ this = THIS;
+ GF_ASSERT (this);
+ conf = this->private;
+ GF_ASSERT (conf);
+ GF_ASSERT (conf->rpc);
+
+ list_for_each_entry (listener, &conf->rpc->listeners, list)
+ break; /* grab first one */
+
+ GF_ASSERT (listener->trans);
+
+ if (rpc_transport_get_myaddr(listener->trans, NULL, 0,
+ &ss, sizeof(ss)) != 0) {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "rpc_transport_get_myname failed: %s",
+ strerror(errno));
+ return NULL;
+ }
+
+ switch (ss.ss_family) {
+ case AF_INET:
+ return "inet";
+ break;
+ case AF_INET6:
+ return "inet6";
+ break;
+ default:
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "unknown address family %d",
+ ss.ss_family);
+ break;
+ }
+
+ return NULL;
+}
+
gf_boolean_t
glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname)
{
GF_ASSERT (sa);
@@ -1032,8 +1076,10 @@
int rdma_port = 0;
FILE *file = NULL;
gf_boolean_t is_locked = _gf_false;
char socketpath[PATH_MAX] = {0};
+ const char *family_name;
+ char *family_option[8192] = {0,};
GF_ASSERT (volinfo);
GF_ASSERT (brickinfo);
@@ -1112,14 +1158,19 @@
port = brickinfo->port;
if (!port)
port = pmap_registry_alloc (THIS);
+ if ((family_name = glusterd_listener_family_name()) != NULL)
+ snprintf (family_option, 8192,
+ "--xlator-option %s-server.transport.address-family=%s ",
+ volinfo->volname, family_name);
+
if (volinfo->transport_type != GF_TRANSPORT_BOTH_TCP_RDMA) {
snprintf (cmd_str, 8192,
"%s/sbin/glusterfsd --xlator-option %s-server.listen-port=%d "
- "-s localhost --volfile-id %s -p %s -S %s --brick-name %s "
+ "%s -s localhost --volfile-id %s -p %s -S %s --brick-name %s "
"--brick-port %d -l %s", GFS_PREFIX, volinfo->volname,
- port, volfile, pidfile, socketpath, brickinfo->path, port,
+ port, family_option, volfile, pidfile, socketpath, brickinfo->path, port,
brickinfo->logfile);
} else {
rdma_port = brickinfo->rdma_port;
if (!rdma_port)
|