diff options
author | Adam King <47704447+adk3798@users.noreply.github.com> | 2023-06-14 18:51:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-14 18:51:14 +0200 |
commit | 256cb0f83d2bc65581dbdc9b09bf04f91e2a4e73 (patch) | |
tree | 7571df35a6fd09bcb677a5898029b5a461d2172a /src/cephadm | |
parent | Merge pull request #51817 from rkachach/fix_issue_61494 (diff) | |
parent | cephadm: adding support for ipv6 when deploying ceph-exporter (diff) | |
download | ceph-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-x | src/cephadm/cephadm.py | 5 |
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) |