backup: set default swiftclient log level to WARN

Similar to change I0857cecd7d8ab0ee7e3e9bd6e15f4987ede4d653, the
swift backup driver cannot be logging stuff while in a thread during
read and write operations. swiftclient logs requests and responses
at DEBUG level, which can cause a thread switch and break the backup
operation.

This sets a default log level of WARN for swiftclient for the
cinder-backup service.

Change-Id: I67ac11276715290839c39fc1d0e333c61a38c461
Closes-Bug: #1745168
This commit is contained in:
Matt Riedemann 2018-01-25 15:50:34 -05:00
parent 976415fbdd
commit e4989c103f
1 changed files with 9 additions and 0 deletions

View File

@ -47,12 +47,21 @@ from cinder import version
CONF = cfg.CONF
# NOTE(mriedem): The default backup driver uses swift and performs read/write
# operations in a thread. swiftclient will log requests and responses at DEBUG
# level, which can cause a thread switch and break the backup operation. So we
# set a default log level of WARN for swiftclient to try and avoid this issue.
_EXTRA_DEFAULT_LOG_LEVELS = ['swiftclient=WARN']
def main():
objects.register_all()
gmr_opts.set_defaults(CONF)
CONF(sys.argv[1:], project='cinder',
version=version.version_string())
logging.set_defaults(
default_log_levels=logging.get_default_log_levels() +
_EXTRA_DEFAULT_LOG_LEVELS)
logging.setup(CONF, "cinder")
python_logging.captureWarnings(True)
priv_context.init(root_helper=shlex.split(utils.get_root_helper()))