Skip to content

Commit 45bf48f

Browse files
committed
Make the logging_rpc member a class property
The ``LoggingServiceDriverManager`` can register additional drivers by calling the method ``register_driver``. Depending on the driver type, the logging plugin will require RPC. Before this patch, the RPC server was loaded at the beginning, using the initial ``rpc_required`` value. If the initial driver doesn't require RPC, the RPC server was never loaded, regardless of future registered drivers. Within in this patch, the RPC server instance is a property that depends on the current ``rpc_required`` and the private variable storing the RPC instance. If the ``rpc_required`` flag changes, the next time the RPC server is required it will be loaded. Closes-Bug: #2141308 Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com> Change-Id: I4e7c773d19d189535fa6118e1f2d0c2a088010e4 (cherry picked from commit 1f953df)
1 parent 69b62dd commit 45bf48f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

neutron/services/logapi/drivers/manager.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,18 @@ def __init__(self):
6868
self._drivers = set()
6969
self.rpc_required = False
7070
registry.publish(log_const.LOGGING_PLUGIN, events.AFTER_INIT, self)
71-
72-
if self.rpc_required:
73-
self.logging_rpc = server_rpc.LoggingApiNotification()
71+
self._logging_rpc = None
7472

7573
@property
7674
def drivers(self):
7775
return self._drivers
7876

77+
@property
78+
def logging_rpc(self):
79+
if self.rpc_required and not self._logging_rpc:
80+
self._logging_rpc = server_rpc.LoggingApiNotification()
81+
return self._logging_rpc
82+
7983
def register_driver(self, driver):
8084
"""Register driver with logging plugin.
8185

0 commit comments

Comments
 (0)