From 891c32918ac3086d0addd663a5a77a62fbae6608 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 13 Feb 2023 17:35:12 +0900 Subject: [PATCH] Neutron: Enable metering agent only when Telemetry is enabled The metering-agent service is an optional service to gather metrics in Telemetry(ceilometer + gnocchi), thus is usually disabled if Telemetry is disabled. This change disables the service in the scenarios without Telemetry so that we can validate deployments without this optional service. Change-Id: I6f1bb575b891318ac83e26450d7b0699a1911b66 --- fixtures/scenario001.pp | 1 + fixtures/scenario002.pp | 4 +++- manifests/neutron.pp | 21 ++++++++++++++++----- manifests/tempest.pp | 5 ++++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/fixtures/scenario001.pp b/fixtures/scenario001.pp index 0e8583492..009c1b289 100644 --- a/fixtures/scenario001.pp +++ b/fixtures/scenario001.pp @@ -69,6 +69,7 @@ class { 'openstack_integration::glance': } class { 'openstack_integration::neutron': notification_topics => $notification_topics, + metering_enabled => true, } include openstack_integration::placement class { 'openstack_integration::nova': diff --git a/fixtures/scenario002.pp b/fixtures/scenario002.pp index 3aeac97d7..e9bfd2608 100644 --- a/fixtures/scenario002.pp +++ b/fixtures/scenario002.pp @@ -57,7 +57,9 @@ class { 'openstack_integration::glance': backend => 'swift', image_encryption => true, } -include openstack_integration::neutron +class { 'openstack_integration::neutron': + metering_enabled => true, +} include openstack_integration::swift include openstack_integration::ironic include openstack_integration::zaqar diff --git a/manifests/neutron.pp b/manifests/neutron.pp index f9f323ea4..46f1209f0 100644 --- a/manifests/neutron.pp +++ b/manifests/neutron.pp @@ -5,6 +5,10 @@ # Can be: openvswitch, linuxbridge or ovn. # Defaults to 'openvswitch'. # +# [*metering_enabled*] +# (optional) Flag to enable metering agent +# Defaults to false. +# # [*bgpvpn_enabled*] # (optional) Flag to enable BGPVPN # API extensions. @@ -24,6 +28,7 @@ # class openstack_integration::neutron ( $driver = 'openvswitch', + $metering_enabled = false, $bgpvpn_enabled = false, $l2gw_enabled = false, $bgp_dragent_enabled = false, @@ -115,7 +120,10 @@ class openstack_integration::neutron ( $providers_list = undef } else { $dhcp_agent_notification = true - + $metering_plugin = $metering_enabled ? { + true => 'metering', + default => undef, + } $bgpvpn_plugin = $bgpvpn_enabled ? { true => 'bgpvpn', default => undef, @@ -144,7 +152,7 @@ class openstack_integration::neutron ( default => undef, } - $plugins_list = delete_undef_values(['router', 'metering', 'qos', 'trunk', $bgpvpn_plugin, $l2gw_plugin, $bgp_dr_plugin]) + $plugins_list = delete_undef_values(['router', 'qos', 'trunk', $metering_plugin, $bgpvpn_plugin, $l2gw_plugin, $bgp_dr_plugin]) } if $driver == 'linuxbridge' { @@ -311,9 +319,12 @@ class openstack_integration::neutron ( interface_driver => $driver, debug => true, } - class { 'neutron::agents::metering': - interface_driver => $driver, - debug => true, + + if $metering_enabled { + class { 'neutron::agents::metering': + interface_driver => $driver, + debug => true, + } } } class { 'neutron::server::notifications::nova': diff --git a/manifests/tempest.pp b/manifests/tempest.pp index 917e587f8..c955459d4 100644 --- a/manifests/tempest.pp +++ b/manifests/tempest.pp @@ -236,7 +236,10 @@ class openstack_integration::tempest ( } else { $neutron_agent_scheduler_extensions = ['dhcp_agent_scheduler', 'l3_agent_scheduler'] $neutron_l3_extensions = ['dvr', 'l3-flavors', 'l3-ha'] - $neutron_metering_extensions = ['metering'] + $neutron_metering_extensions = $ceilometer ? { + true => ['metering'], + default => [] + } } $neutron_l2gw_extensions = $l2gw ? {