From 3f2e063c7894151df1a40dea6cbee9265b30cdb8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 30 Nov 2020 09:26:57 +0900 Subject: [PATCH] Enable debug logging of libvirt services when Debug is true This patch ensures that debug logging of libvirt services is enabled when the global Debug parameter is true, since the parameter is supposed to enable debug logging for all services. Also it introduces a new LibvirtDebug parameter, to allow operators to enable debug of libvirt services more easily, than setting log level number between 1 and 4. Change-Id: I54e0ee6fe59d04686f15cb5638262b34572596e1 --- deployment/logging/files/nova-libvirt.yaml | 30 ++++++++++++------- deployment/logging/stdout/nova-libvirt.yaml | 30 ++++++++++++------- .../notes/libvirt-debug-0bf95db421329ff6.yaml | 9 ++++++ 3 files changed, 49 insertions(+), 20 deletions(-) create mode 100644 releasenotes/notes/libvirt-debug-0bf95db421329ff6.yaml diff --git a/deployment/logging/files/nova-libvirt.yaml b/deployment/logging/files/nova-libvirt.yaml index 03f8b13563..1b29b1b9ba 100644 --- a/deployment/logging/files/nova-libvirt.yaml +++ b/deployment/logging/files/nova-libvirt.yaml @@ -4,6 +4,14 @@ description: > OpenStack containerized Nova libvirt service parameters: + Debug: + type: boolean + default: false + description: Set to True to enable debugging on all services. + LibvirtDebug: + type: boolean + default: false + description: Set to True to enable debugging libvirt services. LibvirtLogLevel: default: 3 description: Defines log level in libvirt to filter log output. @@ -24,17 +32,19 @@ outputs: description: Extra hieradata needed to log to files in the host. value: nova::compute::libvirt::log_outputs: - str_replace: - template: - 'LEVEL:file:/var/log/libvirt/libvirtd.log' - params: - LEVEL: {get_param: LibvirtLogLevel} + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtLogLevel} nova::compute::libvirt::virtlogd::log_outputs: - str_replace: - template: - 'LEVEL:file:/var/log/libvirt/virtlogd.log' - params: - LEVEL: {get_param: LibvirtVirtlogdLogLevel} + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtlogdLogLevel} volumes: description: The volumes needed to log to files in the host. value: diff --git a/deployment/logging/stdout/nova-libvirt.yaml b/deployment/logging/stdout/nova-libvirt.yaml index afd00fb9aa..04048027f2 100644 --- a/deployment/logging/stdout/nova-libvirt.yaml +++ b/deployment/logging/stdout/nova-libvirt.yaml @@ -4,6 +4,14 @@ description: > OpenStack containerized Nova libvirt service parameters: + Debug: + type: boolean + default: false + description: Set to True to enable debugging on all services. + LibvirtDebug: + type: boolean + default: false + description: Set to True to enable debugging libvirt services. LibvirtLogLevel: default: 3 description: Defines log level in libvirt to filter log output. @@ -24,17 +32,19 @@ outputs: description: Extra hieradata needed to log to stdout. value: nova::compute::libvirt::log_outputs: - str_replace: - template: - 'LEVEL:stderr' - params: - LEVEL: {get_param: LibvirtLogLevel} + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtLogLevel} nova::compute::libvirt::virtlogd::log_outputs: - str_replace: - template: - 'LEVEL:stderr' - params: - LEVEL: {get_param: LibvirtVirtlogdLogLevel} + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtlogdLogLevel} docker_config: description: Extra containers needed for logging to stdout or a sidecar container. value: null diff --git a/releasenotes/notes/libvirt-debug-0bf95db421329ff6.yaml b/releasenotes/notes/libvirt-debug-0bf95db421329ff6.yaml new file mode 100644 index 0000000000..6712c9a840 --- /dev/null +++ b/releasenotes/notes/libvirt-debug-0bf95db421329ff6.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The ``LibvirtDebug`` parameter has been added to enable or disable debug + logging of libvirtd and virtlogd. + + - | + Now the debug logging of libvirtd and virtlogd is enabled automatically + when the Debug parameter is true.