summaryrefslogtreecommitdiffstats
path: root/src/cephadm
diff options
context:
space:
mode:
authorRedouane Kachach <rkachach@redhat.com>2023-05-30 14:31:15 +0200
committerRedouane Kachach <rkachach@redhat.com>2023-05-30 14:32:32 +0200
commit04c6727f4d4b43433f8ca6b2290caddd938fc348 (patch)
tree085b75fbfbf6b224b88039db7ec6aae4239ed285 /src/cephadm
parentMerge pull request #51662 from yuvalif/wip-yuval-61328 (diff)
downloadceph-04c6727f4d4b43433f8ca6b2290caddd938fc348.tar.xz
ceph-04c6727f4d4b43433f8ca6b2290caddd938fc348.zip
cephadm: adding support for ipv6 when deploying ceph-exporter
Fixes: https://tracker.ceph.com/issues/61499 Signed-off-by: Redouane Kachach <rkachach@redhat.com>
Diffstat (limited to 'src/cephadm')
-rwxr-xr-xsrc/cephadm/cephadm.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py
index 672c1701155..84f47a56ec2 100755
--- a/src/cephadm/cephadm.py
+++ b/src/cephadm/cephadm.py
@@ -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)