From cabe18dd79ea5144554697dba0a523a6f8dc42e7 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 17 Jun 2024 10:24:44 +0000 Subject: [PATCH] Set the Neutron server workers name The patch [1] defines the RpcWorker and RpcReportsWorker processes names. However, the parent class ``neutron_lib.worker.BaseWorker`` init method is not reading the class variable defined in [1]. This patch is explictly passing the ``desc`` class name in the init method. [1]https://review.opendev.org/c/openstack/neutron/+/907712 Closes-Bug: #2069581 Change-Id: I50c2b0567ea10316ad06e6e6c1d01db8b9520e3e --- neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/worker.py | 6 +++++- neutron/service.py | 3 ++- neutron/worker.py | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/worker.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/worker.py index b0320189706..81ad25a5872 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/worker.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/worker.py @@ -18,8 +18,12 @@ from neutron.common import config class MaintenanceWorker(worker.BaseWorker): + desc = 'maintenance worker' - def start(self): + def __init__(self, **kwargs): + super().__init__(desc=self.desc, **kwargs) + + def start(self, **kwargs): super(MaintenanceWorker, self).start() # NOTE(twilson) The super class will trigger the post_fork_initialize # in the driver, which starts the connection/IDL notify loop which diff --git a/neutron/service.py b/neutron/service.py index 78d1827dc49..2d942605b74 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -100,7 +100,8 @@ class RpcWorker(neutron_worker.NeutronBaseWorker): def __init__(self, plugins, worker_process_count=1): super(RpcWorker, self).__init__( - worker_process_count=worker_process_count + worker_process_count=worker_process_count, + desc=self.desc, ) self._plugins = plugins diff --git a/neutron/worker.py b/neutron/worker.py index 81e711092d7..44d99ec71cb 100644 --- a/neutron/worker.py +++ b/neutron/worker.py @@ -17,11 +17,13 @@ from oslo_service import loopingcall class NeutronBaseWorker(worker.BaseWorker): - def __init__(self, worker_process_count=1, set_proctitle=None): + def __init__(self, worker_process_count=1, set_proctitle=None, + desc=None): set_proctitle = set_proctitle or cfg.CONF.setproctitle super(NeutronBaseWorker, self).__init__( worker_process_count=worker_process_count, - set_proctitle=set_proctitle + set_proctitle=set_proctitle, + desc=desc, ) def start(self, name="neutron-server", desc=None):