]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Write correct 'mon_host' with IPv6 addresses 186/head
authorWido den Hollander <wido@widodh.nl>
Thu, 8 May 2014 11:39:42 +0000 (13:39 +0200)
committerWido den Hollander <wido@widodh.nl>
Tue, 13 May 2014 15:07:23 +0000 (17:07 +0200)
When the IP-address from a monitor is a IPv6 address, encapsulate
it with [ and ]

Fixes: #8309
ceph_deploy/new.py

index 36808212d53b44377357574b88eb8c187601f0d5..8e7b3b22e2d38c8be5377d0e0eb3374b942a60dc 100644 (file)
@@ -5,6 +5,7 @@ import uuid
 import struct
 import time
 import base64
+import socket
 
 from ceph_deploy.cliutil import priority
 from ceph_deploy import conf, hosts, exc
@@ -90,7 +91,14 @@ def new(args):
         ip = net.get_nonlocal_ip(host)
         LOG.debug('Monitor %s at %s', name, ip)
         mon_initial_members.append(name)
-        mon_host.append(ip)
+        try:
+            socket.inet_pton(socket.AF_INET6, ip)
+            mon_host.append("[" + ip + "]")
+            LOG.info('Monitors are IPv6, binding Messenger traffic on IPv6')
+            cfg.set('global', 'ms bind ipv6', 'true')
+        except socket.error:
+            mon_host.append(ip)
+
         if args.ssh_copykey:
             ssh_copy_keys(host, args.username)