Add 'is_available' function

Resolves the following warnings seen in the likes of nova:

    DeprecationWarning: Please provide `is_available()` function in your
    custom Eventlet hub <module 'oslo_service' from
    '../oslo_service/__init__.py'>."

    It must return bool: whether hub supports current platform. See
    eventlet/hubs/{epoll,kqueue} for example.

Since we're simply taking the default hub provided by eventlet and
overriding a single attribute, we will always have support so set the
attribute.

Change-Id: I219cf652526802b8212fe8a8f6c499e9aa24a3cf
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2019-11-27 16:56:08 +00:00
parent 3a92fe1abf
commit e86fb9dcce

View File

@ -37,6 +37,8 @@ def service_hub():
# to ensure that things like loopingcall work properly.
hub = eventlet.hubs.get_default_hub().Hub()
hub.clock = _monotonic
# get_default_hub() will return a hub that is supported on this platform
hub.is_available = lambda: True
return hub