]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: adding support for ipv6 when deploying ceph-exporter
authorRedouane Kachach <rkachach@redhat.com>
Tue, 30 May 2023 12:31:15 +0000 (14:31 +0200)
committerRedouane Kachach <rkachach@redhat.com>
Tue, 30 May 2023 12:32:32 +0000 (14:32 +0200)
Fixes: https://tracker.ceph.com/issues/61499
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
src/cephadm/cephadm.py

index 672c1701155ead2153a295e1cb3f733648a83ee2..84f47a56ec24402614f950e8ab1cd3da34217efd 100755 (executable)
@@ -961,7 +961,10 @@ class CephExporter(object):
         self.image = image
 
         self.sock_dir = config_json.get('sock-dir', '/var/run/ceph/')
-        self.addrs = config_json.get('addrs', socket.gethostbyname(socket.gethostname()))
+        ipv4_addrs, ipv6_addrs = get_ip_addresses(get_hostname())
+        # use the first ipv4 (if any) otherwise use the first ipv6
+        addrs = next(iter(ipv4_addrs or ipv6_addrs), None)
+        self.addrs = config_json.get('addrs', addrs)
         self.port = config_json.get('port', self.DEFAULT_PORT)
         self.prio_limit = config_json.get('prio-limit', 5)
         self.stats_period = config_json.get('stats-period', 5)