Project

General

Profile

Actions

Bug #61499

open

cepadm fails to deploy ceph-exporter on ipv6-only

Added by Hugo Rodenburg 11 months ago. Updated 11 months ago.

Status:
Pending Backport
Priority:
Normal
Category:
orchestrator
Target version:
-
% Done:

0%

Source:
Tags:
backport_processed
Backport:
reef
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

When installing on an IPv6-only cluster using cephadm, ceph-exporter fails to start.
In syslog, the following is shown:

...
File "/var/lib/ceph/<fsid>/cephadm.<hash>", line 2692, in get_daemon_args#012    ceph_exporter = CephExporter.init(ctx, fsid, daemon_id)#012  File "/var/lib/ceph/8367956c-c0de-41df-9e77-64020157ccbb/cephadm.7ab03136237675497d535fb1b85d1d0f95bbe5b95f32cd4e6f3ca71a9f97bf3c", line 972, in init#012    return cls(ctx, fsid, daemon_id,#012  File "/var/lib/ceph/8367956c-c0de-41df-9e77-64020157ccbb/cephadm.7ab03136237675497d535fb1b85d1d0f95bbe5b95f32cd4e6f3ca71a9f97bf3c", line 962, in __init__#012    self.addrs = config_json.get('addrs', socket.gethostbyname(socket.gethostname()))#012socket.gaierror: [Errno -5] No address associated with hostname

This is using Debian 11, Ceph Quincy, cephadm installed as debian package, version: 17.2.6-1~bpo11+1

In cephadm "socket.gethostbyname" is used to get the ip of the local system. However, this is an ipv4-only function: https://docs.python.org/3/library/socket.html#socket.gethostbyname
When changing this function to use "socket.getaddrinfo", the deployment succeeds.
I've patched the cephadm python script in /var/lib/<fsid>/cephadm.<hash> using the following patch:

--- cephadm.orig    2023-05-22 13:42:53.228515763 +0200
+++ cephadm    2023-05-25 09:57:20.278673702 +0200
@@ -959,7 +959,7 @@
         self.image = image

         self.sock_dir = config_json.get('sock-dir', '/var/run/ceph/')
-        self.addrs = config_json.get('addrs', socket.gethostbyname(socket.gethostname()))
+        self.addrs = config_json.get('addrs', socket.getaddrinfo(socket.gethostname(), None)[0][4][0])
         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)

I'm far from a Python expert, but to my belief this will handle ipv6 and ipv4 correctly.


Related issues 1 (0 open1 closed)

Copied to Orchestrator - Backport #61680: reef: cepadm fails to deploy ceph-exporter on ipv6-onlyRejectedAdam KingActions
Actions #1

Updated by Redouane Kachach Elhichou 11 months ago

  • Status changed from New to In Progress
  • Assignee set to Redouane Kachach Elhichou
Actions #2

Updated by Redouane Kachach Elhichou 11 months ago

  • Pull request ID set to 51832
Actions #3

Updated by Redouane Kachach Elhichou 11 months ago

  • Status changed from In Progress to Fix Under Review
Actions #4

Updated by Adam King 11 months ago

  • Status changed from Fix Under Review to Pending Backport
  • Backport set to reef
Actions #5

Updated by Backport Bot 11 months ago

  • Copied to Backport #61680: reef: cepadm fails to deploy ceph-exporter on ipv6-only added
Actions #6

Updated by Backport Bot 11 months ago

  • Tags set to backport_processed
Actions

Also available in: Atom PDF