Update ceph-manager rabbit configuration
This work is part of Debian integration effort.
It is observed in the logs that ceph-manager cannot connect
to rabbitmq.
Oslo.messaging 5 is used on CentOS and 12 on Debian.
We see that the interface for reading configuration from files and
passing it to messaging was changed:
b0d3bfceb8
Ceph-manager uses the configuration from sysinv.conf. Ceph-manager
code is common between CentOS and Debian. Oslo.messaging module
doesn't provide a version variable, thus instead of spliting the
logic I used a common interface for configuring the rabbit driver.
Tests on AIO-SX.
CentOS:
PASS: build-pkgs, build-image, deploy
PASS: unlocked enabled available and platform-integ-apps applied
PASS: inspected ceph-manager.log for patched/non-patched, no difference
was observed.
Debian:
- live patch controller, ceph-manager.log no longer shows connection
refused errors
- logs look ok
Story: 2009101
Task: 44787
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: Ie2e7b6be4a54bca45f5ee8e9b952632310302485
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
#
|
||||
# Copyright (c) 2016-2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2016-2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@@ -30,6 +29,7 @@ from cephclient import wrapper
|
||||
|
||||
from ceph_manager.monitor import Monitor
|
||||
from ceph_manager import constants
|
||||
from ceph_manager import utils
|
||||
|
||||
from ceph_manager.i18n import _LI
|
||||
from ceph_manager.i18n import _LW
|
||||
@@ -133,7 +133,15 @@ class Service(SysinvConductorUpgradeApi, service.Service):
|
||||
|
||||
def start(self):
|
||||
super(Service, self).start()
|
||||
transport = messaging.get_transport(self.conf)
|
||||
|
||||
# pylint: disable=protected-access
|
||||
sysinv_conf = self.conf._namespace._normalized[0]['DEFAULT']
|
||||
url = "rabbit://{user}:{password}@{host}:{port}"\
|
||||
"".format(user=sysinv_conf['rabbit_userid'][0],
|
||||
password=sysinv_conf['rabbit_password'][0],
|
||||
host=utils.ipv6_bracketed(sysinv_conf['rabbit_host'][0]),
|
||||
port=sysinv_conf['rabbit_port'][0])
|
||||
transport = messaging.get_transport(self.conf, url=url)
|
||||
self.sysinv_conductor = messaging.RPCClient(
|
||||
transport,
|
||||
messaging.Target(
|
||||
|
||||
37
ceph/ceph-manager/ceph-manager/ceph_manager/utils.py
Normal file
37
ceph/ceph-manager/ceph-manager/ceph_manager/utils.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import netaddr
|
||||
|
||||
|
||||
def is_valid_ipv6(address):
|
||||
""" Helper to determine if we need the to add brackets.
|
||||
|
||||
is_valid_ipv6('fd00::1') -> True
|
||||
is_valid_ipv6('[fd00::1]') -> False
|
||||
is_valid_ipv6('192.168.1.1') -> False
|
||||
|
||||
"""
|
||||
try:
|
||||
return netaddr.valid_ipv6(address)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def ipv6_bracketed(address):
|
||||
""" Helper to ensure IPv6 is bracketed.
|
||||
|
||||
ipv6_bracketed('fd00::1') -> [fd00::1]
|
||||
ipv6_bracketed('[fd00::1]') -> [fd00::1]
|
||||
ipv6_bracketed('192.168.1.1') -> 192.168.1.1
|
||||
|
||||
"""
|
||||
if is_valid_ipv6(address):
|
||||
address = "[%s]" % address
|
||||
else:
|
||||
address = "%s" % address
|
||||
|
||||
return address
|
||||
Reference in New Issue
Block a user