Fix up RPC cleanup process

We don't need to assert here, because we will
throw exceptions when using TRANSPORT and
NOTIFICATION_TRANSPORT if they are None.

If NOTIFIER is None, log an exception and continue,
since it is not used here.

This still allows detection of problems like the
asserts did, but will not fail needlessly.

Change-Id: I6f0c3ce19a60339e926946b605962d4121a06d8e
This commit is contained in:
Eric Harney 2016-05-16 10:36:05 -04:00
parent 5bd5f22053
commit 4805958b3e
1 changed files with 3 additions and 4 deletions

View File

@ -35,7 +35,7 @@ profiler = importutils.try_import('osprofiler.profiler')
import cinder.context
import cinder.exception
from cinder.i18n import _LI
from cinder.i18n import _LE, _LI
from cinder import objects
from cinder.objects import base
@ -85,9 +85,8 @@ def initialized():
def cleanup():
global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
assert TRANSPORT is not None
assert NOTIFICATION_TRANSPORT is not None
assert NOTIFIER is not None
if NOTIFIER is None:
LOG.exception(_LE("RPC cleanup: NOTIFIER is None"))
TRANSPORT.cleanup()
NOTIFICATION_TRANSPORT.cleanup()
TRANSPORT = NOTIFICATION_TRANSPORT = NOTIFIER = None