Short-circuit notifications when not enabled
When running Cinder with notifications disabled we are still doing all the work and calls to Oslo message notifier and it's there, at the very last moment when it's going to send the message that it checks that there's no actual extension loaded in the driver manager and skips the actual send of the data. This is considerably wasteful considering that for some of the notifications we are actually querying the DB to get data, for example volume attachments and glance metadata information when notifying about volume usage. This patch proposes short-circuiting notification methods as much as possible to optimize code execution when Cinder has no notification transport mechanism configured, as is the case when deployed as a standalone SDS service. Closes-Bug: #1660303 Change-Id: I77f655d3ef90088ce71304da5d4ea7b543991e90
This commit is contained in:
@@ -31,6 +31,7 @@ from cinder import exception
|
||||
from cinder.i18n import _, _LE
|
||||
from cinder import quota
|
||||
from cinder import rpc
|
||||
from cinder import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -186,6 +187,7 @@ def is_public_volume_type(context, volume_type_id):
|
||||
return volume_type['is_public']
|
||||
|
||||
|
||||
@utils.if_notifications_enabled
|
||||
def notify_about_volume_type_access_usage(context,
|
||||
volume_type_id,
|
||||
project_id,
|
||||
|
||||
Reference in New Issue
Block a user