Merge "LightOS: update discovery client configuration"
This commit is contained in:
@@ -23,6 +23,7 @@ import time
|
||||
import traceback
|
||||
|
||||
from oslo_concurrency import processutils as putils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import netutils
|
||||
import psutil
|
||||
@@ -35,12 +36,30 @@ from os_brick import utils
|
||||
|
||||
|
||||
DEVICE_SCAN_ATTEMPTS_DEFAULT = 5
|
||||
DISCOVERY_CLIENT_PORT = 6060
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
nvmec_pattern = ".*nvme[0-9]+[cp][0-9]+.*"
|
||||
nvmec_match = re.compile(nvmec_pattern)
|
||||
|
||||
_opts = [
|
||||
cfg.HostAddressOpt('lightos_discovery_client_address',
|
||||
default="localhost",
|
||||
help="Address of the LightOS discovery client"),
|
||||
cfg.PortOpt('lightos_discovery_client_port',
|
||||
default=6060,
|
||||
help="Port of the LightOS discovery client"),
|
||||
cfg.StrOpt('lightos_discovery_client_dir_path',
|
||||
default='/etc/discovery-client/discovery.d/',
|
||||
help="Directory path for the LightOS discovery client files.")
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(_opts, group='os_brick')
|
||||
|
||||
|
||||
def list_opts():
|
||||
"""oslo.config.opts entrypoint for sample config generation."""
|
||||
return [('os_brick', _opts)]
|
||||
|
||||
|
||||
class LightOSConnector(base.BaseLinuxConnector):
|
||||
"""Connector class to attach/detach LightOS volumes using NVMe/TCP."""
|
||||
@@ -62,7 +81,15 @@ class LightOSConnector(base.BaseLinuxConnector):
|
||||
device_scan_attempts=device_scan_attempts,
|
||||
*args, **kwargs)
|
||||
self.message_queue = message_queue
|
||||
self.DISCOVERY_DIR_PATH = '/etc/discovery-client/discovery.d/'
|
||||
self.discovery_dir_path = (
|
||||
cfg.CONF.os_brick.lightos_discovery_client_dir_path
|
||||
)
|
||||
self.discovery_address = (
|
||||
cfg.CONF.os_brick.lightos_discovery_client_address
|
||||
)
|
||||
self.discovery_port = (
|
||||
cfg.CONF.os_brick.lightos_discovery_client_port
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_ip_addresses():
|
||||
@@ -120,10 +147,12 @@ class LightOSConnector(base.BaseLinuxConnector):
|
||||
return props
|
||||
|
||||
def dsc_file_name(self, uuid):
|
||||
return os.path.join(self.DISCOVERY_DIR_PATH, "%s.conf" % uuid)
|
||||
return os.path.join(self.discovery_dir_path, "%s.conf" % uuid)
|
||||
|
||||
def find_dsc(self):
|
||||
conn = http.client.HTTPConnection("localhost", DISCOVERY_CLIENT_PORT)
|
||||
conn = http.client.HTTPConnection(
|
||||
self.discovery_address,
|
||||
self.discovery_port)
|
||||
try:
|
||||
conn.request("HEAD", "/metrics")
|
||||
resp = conn.getresponse()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
**LightOS connector**: Introduce new configuration options to customize
|
||||
the LightOS discovery client’s behavior.
|
||||
|
||||
Operators can now override the default values for:
|
||||
|
||||
- ``discovery_client_address``
|
||||
- ``discovery_client_port``
|
||||
- ``discovery_client_dir_path``
|
||||
|
||||
These settings allow fine-tuning of the discovery client’s network
|
||||
endpoint and configuration directory.
|
||||
|
||||
upgrade:
|
||||
- |
|
||||
**LightOS connector**: Introduce new configuration options to customize
|
||||
the LightOS discovery client’s behavior.
|
||||
|
||||
Operators can now override the default values for:
|
||||
|
||||
- ``discovery_client_address``
|
||||
- ``discovery_client_port``
|
||||
- ``discovery_client_dir_path``
|
||||
|
||||
No changes required. Default values are retained for backward compatibility;
|
||||
no action is needed during upgrade.
|
||||
Reference in New Issue
Block a user