From 40d5282eb7a703d371c58e4cef594330178c4bd7 Mon Sep 17 00:00:00 2001 From: Rajesh Tailor Date: Mon, 11 Oct 2021 11:35:03 +0530 Subject: [PATCH] follow-up: Enable support for Libvirt modular daemons This change is follow-up patch to refactor the modular-libvirt changes to address suggestions mentioned on the change [1]. [1] Ic0a13ab453ae8d3c1882b3719df295a2b0b510c5 Change-Id: I988fac14da2eecba625ea35f193fb9b32a4a8d42 --- .../nova/nova-libvirt-container-puppet.yaml | 4 +- deployment/logging/files/nova-libvirt.yaml | 40 +++++++- deployment/logging/stdout/nova-libvirt.yaml | 95 +++++++++++++++++++ ...t-common.yaml => nova-libvirt-common.yaml} | 15 ++- ...nova-modular-libvirt-container-puppet.yaml | 51 +++++----- 5 files changed, 172 insertions(+), 33 deletions(-) rename deployment/nova/{nova-virt-common.yaml => nova-libvirt-common.yaml} (92%) diff --git a/deployment/deprecated/nova/nova-libvirt-container-puppet.yaml b/deployment/deprecated/nova/nova-libvirt-container-puppet.yaml index 2e499a3e92..9a6b58eca7 100644 --- a/deployment/deprecated/nova/nova-libvirt-container-puppet.yaml +++ b/deployment/deprecated/nova/nova-libvirt-container-puppet.yaml @@ -413,7 +413,9 @@ outputs: rbd_persistent_storage: {get_param: CinderEnableRbdBackend} rbd_disk_cachemodes: {get_param: RbdDiskCachemodes} tripleo::profile::base::nova::libvirt::modular_libvirt: false - nova::params::modular_libvirt: false + nova::compute::libvirt::services::modular_libvirt: false + nova::compute::libvirt::modular_libvirt: false + nova::migration::libvirt::modular_libvirt: false - if: - use_tls_for_live_migration - tripleo::profile::base::nova::migration::client::libvirt_tls: true diff --git a/deployment/logging/files/nova-libvirt.yaml b/deployment/logging/files/nova-libvirt.yaml index 37b4ac13a0..76488347a3 100644 --- a/deployment/logging/files/nova-libvirt.yaml +++ b/deployment/logging/files/nova-libvirt.yaml @@ -95,31 +95,61 @@ outputs: template: 'LEVEL:file:/var/log/libvirt/virtsecretd.log' params: - LEVEL: {get_param: LibvirtVirtsecretdLogLevel} + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtsecretdLogLevel} nova::compute::libvirt::virtnodedevd::log_outputs: str_replace: template: 'LEVEL:file:/var/log/libvirt/virtnodedevd.log' params: - LEVEL: {get_param: LibvirtVirtnodedevdLogLevel} + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtnodedevdLogLevel} nova::compute::libvirt::virtqemud::log_outputs: str_replace: template: 'LEVEL:file:/var/log/libvirt/virtqemud.log' params: - LEVEL: {get_param: LibvirtVirtqemudLogLevel} + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtqemudLogLevel} nova::compute::libvirt::virtproxyd::log_outputs: str_replace: template: 'LEVEL:file:/var/log/libvirt/virtproxyd.log' params: - LEVEL: {get_param: LibvirtVirtproxydLogLevel} + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtproxydLogLevel} nova::compute::libvirt::virtstoraged::log_outputs: str_replace: template: 'LEVEL:file:/var/log/libvirt/virtstoraged.log' params: - LEVEL: {get_param: LibvirtVirtstoragedLogLevel} + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtstoragedLogLevel} 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 e12f77a79d..8d284780ce 100644 --- a/deployment/logging/stdout/nova-libvirt.yaml +++ b/deployment/logging/stdout/nova-libvirt.yaml @@ -26,6 +26,41 @@ parameters: type: number constraints: - range: { min: 1, max: 4 } + LibvirtVirtsecretdLogLevel: + default: 3 + description: Defines log level in virtsecretd to filter log output. + See https://libvirt.org/logging.html to find its detail. + type: number + constraints: + - range: { min: 1, max: 4 } + LibvirtVirtnodedevdLogLevel: + default: 3 + description: Defines log level in virtnodedevd to filter log output. + See https://libvirt.org/logging.html to find its detail. + type: number + constraints: + - range: { min: 1, max: 4 } + LibvirtVirtqemudLogLevel: + default: 3 + description: Defines log level in virtqemud to filter log output. + See https://libvirt.org/logging.html to find its detail. + type: number + constraints: + - range: { min: 1, max: 4 } + LibvirtVirtproxydLogLevel: + default: 3 + description: Defines log level in virtproxyd to filter log output. + See https://libvirt.org/logging.html to find its detail. + type: number + constraints: + - range: { min: 1, max: 4 } + LibvirtVirtstoragedLogLevel: + default: 3 + description: Defines log level in virtstoraged to filter log output. + See https://libvirt.org/logging.html to find its detail. + type: number + constraints: + - range: { min: 1, max: 4 } outputs: config_settings: @@ -55,6 +90,66 @@ outputs: - {get_param: LibvirtDebug } - 1 - {get_param: LibvirtVirtlogdLogLevel} + nova::compute::libvirt::virtsecretd::log_outputs: + str_replace: + template: + 'LEVEL:stderr' + params: + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtsecretdLogLevel} + nova::compute::libvirt::virtnodedevd::log_outputs: + str_replace: + template: + 'LEVEL:stderr' + params: + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtnodedevdLogLevel} + nova::compute::libvirt::virtqemud::log_outputs: + str_replace: + template: + 'LEVEL:stderr' + params: + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtqemudLogLevel} + nova::compute::libvirt::virtproxyd::log_outputs: + str_replace: + template: + 'LEVEL:stderr' + params: + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtproxydLogLevel} + nova::compute::libvirt::virtstoraged::log_outputs: + str_replace: + template: + 'LEVEL:stderr' + params: + LEVEL: + if: + - or: + - {get_param: Debug } + - {get_param: LibvirtDebug } + - 1 + - {get_param: LibvirtVirtstoragedLogLevel} docker_config: description: Extra containers needed for logging to stdout or a sidecar container. value: null diff --git a/deployment/nova/nova-virt-common.yaml b/deployment/nova/nova-libvirt-common.yaml similarity index 92% rename from deployment/nova/nova-virt-common.yaml rename to deployment/nova/nova-libvirt-common.yaml index e96eb48b55..4e53cf0aff 100644 --- a/deployment/nova/nova-virt-common.yaml +++ b/deployment/nova/nova-libvirt-common.yaml @@ -81,6 +81,19 @@ conditions: - {equals: [{get_param: QemuMemoryBackingDir}, '']} - {equals: [{get_param: [RoleParameters, QemuMemoryBackingDir]}, '']} +resources: + RoleParametersValue: + type: OS::Heat::Value + properties: + type: json + value: + map_replace: + - map_replace: + - nova::compute::libvirt::qemu::memory_backing_dir: QemuMemoryBackingDir + - values: {get_param: [RoleParameters]} + - values: + QemuMemoryBackingDir: {get_param: QemuMemoryBackingDir} + outputs: kolla_config_files: description: Common kolla config_files. @@ -154,5 +167,5 @@ outputs: - - str_replace: template: "MEMORY_BACKING_DIR:MEMORY_BACKING_DIR" params: - MEMORY_BACKING_DIR: {get_attr: [RoleParametersValue, value, memory_backing_dir]} + MEMORY_BACKING_DIR: {get_attr: [RoleParametersValue, value, 'nova::compute::libvirt::qemu::memory_backing_dir']} diff --git a/deployment/nova/nova-modular-libvirt-container-puppet.yaml b/deployment/nova/nova-modular-libvirt-container-puppet.yaml index 56cd0a0ab3..0a1fac99f7 100644 --- a/deployment/nova/nova-modular-libvirt-container-puppet.yaml +++ b/deployment/nova/nova-modular-libvirt-container-puppet.yaml @@ -237,31 +237,31 @@ parameters: logging level for a given category log outputs, as specified in https://libvirt.org/logging.html . type: string - default: '1:logging 4:object 4:json 4:event 1:util' + default: '1:qemu 1:libvirt 4:object 4:json 4:event 1:util' LibvirtVirtnodedevdLogFilters: description: Defines a filter in virtnodedevd to select a different logging level for a given category log outputs, as specified in https://libvirt.org/logging.html . type: string - default: '1:logging 4:object 4:json 4:event 1:util' + default: '1:qemu 1:libvirt 4:object 4:json 4:event 1:util' LibvirtVirtstoragedLogFilters: description: Defines a filter in virtstoraged to select a different logging level for a given category log outputs, as specified in https://libvirt.org/logging.html . type: string - default: '1:logging 4:object 4:json 4:event 1:util' + default: '1:qemu 1:libvirt 4:object 4:json 4:event 1:util' LibvirtVirtqemudLogFilters: description: Defines a filter in virtqemud to select a different logging level for a given category log outputs, as specified in https://libvirt.org/logging.html . type: string - default: '1:logging 4:object 4:json 4:event 1:util' + default: '1:qemu 1:libvirt 4:object 4:json 4:event 1:util' LibvirtVirtproxydLogFilters: description: Defines a filter in virtproxyd to select a different logging level for a given category log outputs, as specified in https://libvirt.org/logging.html . type: string - default: '1:logging 4:object 4:json 4:event 1:util' + default: '1:qemu 1:libvirt 4:object 4:json 4:event 1:util' LibvirtTLSPriority: description: > Override the compile time default TLS priority string. @@ -369,8 +369,8 @@ resources: RoleName: {get_param: RoleName} RoleParameters: {get_param: RoleParameters} - VirtCommon: - type: ./nova-virt-common.yaml + NovaLibvirtCommon: + type: ./nova-libvirt-common.yaml outputs: role_data: @@ -448,7 +448,6 @@ outputs: nova::compute::libvirt::services::modular_libvirt: true nova::compute::libvirt::modular_libvirt: true nova::migration::libvirt::modular_libvirt: true - nova::params::modular_libvirt: true - if: - use_tls_for_live_migration - tripleo::profile::base::nova::migration::client::libvirt_tls: true @@ -494,28 +493,28 @@ outputs: - {get_param: NovaEnableVirtlogdContainerWrapper} - /usr/local/bin/virtlogd_wrapper - /usr/sbin/virtlogd --config /etc/libvirt/virtlogd.conf - config_files: {get_attr: [VirtCommon, kolla_config_files]} - permissions: {get_attr: [VirtCommon, kolla_permissions]} + config_files: {get_attr: [NovaLibvirtCommon, kolla_config_files]} + permissions: {get_attr: [NovaLibvirtCommon, kolla_permissions]} /var/lib/kolla/config_files/nova_virtsecretd.json: command: /usr/sbin/virtsecretd --config /etc/libvirt/virtsecretd.conf - config_files: {get_attr: [VirtCommon, kolla_config_files]} - permissions: {get_attr: [VirtCommon, kolla_permissions]} + config_files: {get_attr: [NovaLibvirtCommon, kolla_config_files]} + permissions: {get_attr: [NovaLibvirtCommon, kolla_permissions]} /var/lib/kolla/config_files/nova_virtnodedevd.json: command: /usr/sbin/virtnodedevd --config /etc/libvirt/virtnodedevd.conf - config_files: {get_attr: [VirtCommon, kolla_config_files]} - permissions: {get_attr: [VirtCommon, kolla_permissions]} + config_files: {get_attr: [NovaLibvirtCommon, kolla_config_files]} + permissions: {get_attr: [NovaLibvirtCommon, kolla_permissions]} /var/lib/kolla/config_files/nova_virtstoraged.json: command: /usr/sbin/virtstoraged --config /etc/libvirt/virtstoraged.conf - config_files: {get_attr: [VirtCommon, kolla_config_files]} - permissions: {get_attr: [VirtCommon, kolla_permissions]} + config_files: {get_attr: [NovaLibvirtCommon, kolla_config_files]} + permissions: {get_attr: [NovaLibvirtCommon, kolla_permissions]} /var/lib/kolla/config_files/nova_virtqemud.json: command: /usr/sbin/virtqemud --config /etc/libvirt/virtqemud.conf - config_files: {get_attr: [VirtCommon, kolla_config_files]} - permissions: {get_attr: [VirtCommon, kolla_permissions]} + config_files: {get_attr: [NovaLibvirtCommon, kolla_config_files]} + permissions: {get_attr: [NovaLibvirtCommon, kolla_permissions]} /var/lib/kolla/config_files/nova_virtproxyd.json: command: /usr/sbin/virtproxyd --config /etc/libvirt/virtproxyd.conf - config_files: {get_attr: [VirtCommon, kolla_config_files]} - permissions: {get_attr: [VirtCommon, kolla_permissions]} + config_files: {get_attr: [NovaLibvirtCommon, kolla_config_files]} + permissions: {get_attr: [NovaLibvirtCommon, kolla_permissions]} container_config_scripts: nova_libvirt_init_secret.sh: mode: "0755" @@ -563,7 +562,7 @@ outputs: list_concat: - {get_attr: [ContainersCommon, volumes]} - {get_attr: [NovaLibvirtLogging, volumes]} - - {get_attr: [VirtCommon, volumes]} + - {get_attr: [NovaLibvirtCommon, volumes]} - - /var/lib/kolla/config_files/nova_virtlogd.json:/var/lib/kolla/config_files/config.json:ro - if: - {get_param: NovaEnableVirtlogdContainerWrapper} @@ -593,7 +592,7 @@ outputs: list_concat: - {get_attr: [ContainersCommon, volumes]} - {get_attr: [NovaLibvirtLogging, volumes]} - - {get_attr: [VirtCommon, volumes]} + - {get_attr: [NovaLibvirtCommon, volumes]} - {get_attr: [RoleParametersValue, value, nova_libvirt_opt_volumes]} - - /var/lib/kolla/config_files/nova_virtsecretd.json:/var/lib/kolla/config_files/config.json:ro - nova_virtnodedevd: @@ -618,7 +617,7 @@ outputs: list_concat: - {get_attr: [ContainersCommon, volumes]} - {get_attr: [NovaLibvirtLogging, volumes]} - - {get_attr: [VirtCommon, volumes]} + - {get_attr: [NovaLibvirtCommon, volumes]} - {get_attr: [RoleParametersValue, value, nova_libvirt_opt_volumes]} - - /var/lib/kolla/config_files/nova_virtnodedevd.json:/var/lib/kolla/config_files/config.json:ro - nova_virtstoraged: @@ -643,7 +642,7 @@ outputs: list_concat: - {get_attr: [ContainersCommon, volumes]} - {get_attr: [NovaLibvirtLogging, volumes]} - - {get_attr: [VirtCommon, volumes]} + - {get_attr: [NovaLibvirtCommon, volumes]} - {get_attr: [RoleParametersValue, value, nova_libvirt_opt_volumes]} - - /var/lib/kolla/config_files/nova_virtstoraged.json:/var/lib/kolla/config_files/config.json:ro - nova_virtqemud: @@ -668,7 +667,7 @@ outputs: list_concat: - {get_attr: [ContainersCommon, volumes]} - {get_attr: [NovaLibvirtLogging, volumes]} - - {get_attr: [VirtCommon, volumes]} + - {get_attr: [NovaLibvirtCommon, volumes]} - {get_attr: [RoleParametersValue, value, nova_libvirt_opt_volumes]} - - /var/lib/kolla/config_files/nova_virtqemud.json:/var/lib/kolla/config_files/config.json:ro - nova_virtproxyd: @@ -693,7 +692,7 @@ outputs: list_concat: - {get_attr: [ContainersCommon, volumes]} - {get_attr: [NovaLibvirtLogging, volumes]} - - {get_attr: [VirtCommon, volumes]} + - {get_attr: [NovaLibvirtCommon, volumes]} - {get_attr: [RoleParametersValue, value, nova_libvirt_opt_volumes]} - - /var/lib/kolla/config_files/nova_virtproxyd.json:/var/lib/kolla/config_files/config.json:ro step_4: