summaryrefslogtreecommitdiffstats
path: root/src/cephadm
diff options
context:
space:
mode:
authorAdam King <47704447+adk3798@users.noreply.github.com>2023-06-14 18:51:14 +0200
committerGitHub <noreply@github.com>2023-06-14 18:51:14 +0200
commit256cb0f83d2bc65581dbdc9b09bf04f91e2a4e73 (patch)
tree7571df35a6fd09bcb677a5898029b5a461d2172a /src/cephadm
parentMerge pull request #51817 from rkachach/fix_issue_61494 (diff)
parentcephadm: adding support for ipv6 when deploying ceph-exporter (diff)
downloadceph-256cb0f83d2bc65581dbdc9b09bf04f91e2a4e73.tar.xz
ceph-256cb0f83d2bc65581dbdc9b09bf04f91e2a4e73.zip
Merge pull request #51832 from rkachach/fix_issue_61499
cephadm: adding support for ipv6 when deploying ceph-exporter Reviewed-by: Adam King <adking@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 32caebddcc9..3500f8b5e39 100755
--- a/src/cephadm/cephadm.py
+++ b/src/cephadm/cephadm.py
@@ -972,7 +972,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)