Merge "Use oslo_service's SignalHandler for signals" into stable/2024.1
This commit is contained in:
commit
1276051ea2
@ -19,7 +19,6 @@ import datetime
|
||||
import functools
|
||||
import multiprocessing
|
||||
import operator
|
||||
import signal
|
||||
import threading
|
||||
import types
|
||||
import uuid
|
||||
@ -43,6 +42,7 @@ from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as os_db_exc
|
||||
from oslo_log import log
|
||||
from oslo_service import service as oslo_service
|
||||
from oslo_utils import timeutils
|
||||
from ovsdbapp.backend.ovs_idl import idlutils
|
||||
|
||||
@ -313,8 +313,9 @@ class OVNMechanismDriver(api.MechanismDriver):
|
||||
themselves to the hash ring.
|
||||
"""
|
||||
# Attempt to remove the node from the ring when the worker stops
|
||||
sh = oslo_service.SignalHandler()
|
||||
atexit.register(self._remove_node_from_hash_ring)
|
||||
signal.signal(signal.SIGTERM, self._remove_node_from_hash_ring)
|
||||
sh.add_handler("SIGTERM", self._remove_node_from_hash_ring)
|
||||
|
||||
admin_context = n_context.get_admin_context()
|
||||
if not self._hash_ring_probe_event.is_set():
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
import atexit
|
||||
import queue
|
||||
import signal
|
||||
import threading
|
||||
import traceback
|
||||
import weakref
|
||||
@ -24,6 +23,7 @@ from neutron_lib.callbacks import resources
|
||||
from neutron_lib import context as n_ctx
|
||||
from neutron_lib.db import api as db_api
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import service
|
||||
|
||||
from neutron.api.rpc.callbacks import events as rpc_events
|
||||
from neutron.api.rpc.handlers import resources_rpc
|
||||
@ -38,8 +38,9 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
def _setup_change_handlers_cleanup():
|
||||
atexit.register(_ObjectChangeHandler.clean_up)
|
||||
signal.signal(signal.SIGINT, _ObjectChangeHandler.clean_up)
|
||||
signal.signal(signal.SIGTERM, _ObjectChangeHandler.clean_up)
|
||||
sh = service.SignalHandler()
|
||||
sh.add_handler("SIGINT", _ObjectChangeHandler.clean_up)
|
||||
sh.add_handler("SIGTERM", _ObjectChangeHandler.clean_up)
|
||||
|
||||
|
||||
class _ObjectChangeHandler(object):
|
||||
|
@ -38,7 +38,7 @@ oslo.privsep>=2.3.0 # Apache-2.0
|
||||
oslo.reports>=1.18.0 # Apache-2.0
|
||||
oslo.rootwrap>=5.15.0 # Apache-2.0
|
||||
oslo.serialization>=2.25.0 # Apache-2.0
|
||||
oslo.service>=2.8.0 # Apache-2.0
|
||||
oslo.service>=3.4.1 # Apache-2.0
|
||||
oslo.upgradecheck>=1.3.0 # Apache-2.0
|
||||
oslo.utils>=7.0.0 # Apache-2.0
|
||||
oslo.versionedobjects>=1.35.1 # Apache-2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user