[ML2 OVN] Add disable_ovn_dhcp_for_baremetal_ports parameter

This parameter can be used to disable OVN's DHCP when used with
baremetal ports.

Depends-On: https://review.opendev.org/c/openstack/neutron/+/840316
Related-Bug: #1971431
Change-Id: If38730c5757bdaa6c19ece02c05106f191b91048
This commit is contained in:
Miro Tomaska 2022-07-19 22:07:52 -05:00
parent 9490e6a21e
commit 7233388ddd
3 changed files with 92 additions and 75 deletions

View File

@ -79,6 +79,11 @@
# Type: boolean
# Defaults to $::os_service_default
#
# [*disable_ovn_dhcp_for_baremetal_ports*]
# (optional) Whether to disable built-in DHCP for baremetal ports.
# Type: boolean
# Defaults to $::os_service_default
#
# [*dns_servers*]
# (optional) List of dns servers which will be as forwarders
# if a subnet's dns_nameservers is empty.
@ -118,27 +123,28 @@
# Defaults to $::os_service_default.
#
class neutron::plugins::ml2::ovn(
$ovn_nb_connection = $::os_service_default,
$ovn_sb_connection = $::os_service_default,
$ovn_nb_private_key = $::os_service_default,
$ovn_nb_certificate = $::os_service_default,
$ovn_nb_ca_cert = $::os_service_default,
$ovn_sb_private_key = $::os_service_default,
$ovn_sb_certificate = $::os_service_default,
$ovn_sb_ca_cert = $::os_service_default,
$package_ensure = 'present',
$ovsdb_connection_timeout = $::os_service_default,
$ovsdb_retry_max_interval = $::os_service_default,
$ovsdb_probe_interval = $::os_service_default,
$neutron_sync_mode = $::os_service_default,
$ovn_metadata_enabled = $::os_service_default,
$dvr_enabled = $::os_service_default,
$dns_servers = $::os_service_default,
$vhostuser_socket_dir = $::os_service_default,
$ovn_emit_need_to_frag = $::os_service_default,
$network_log_rate_limit = $::os_service_default,
$network_log_burst_limit = $::os_service_default,
$network_log_local_output_log_base = $::os_service_default,
$ovn_nb_connection = $::os_service_default,
$ovn_sb_connection = $::os_service_default,
$ovn_nb_private_key = $::os_service_default,
$ovn_nb_certificate = $::os_service_default,
$ovn_nb_ca_cert = $::os_service_default,
$ovn_sb_private_key = $::os_service_default,
$ovn_sb_certificate = $::os_service_default,
$ovn_sb_ca_cert = $::os_service_default,
$package_ensure = 'present',
$ovsdb_connection_timeout = $::os_service_default,
$ovsdb_retry_max_interval = $::os_service_default,
$ovsdb_probe_interval = $::os_service_default,
$neutron_sync_mode = $::os_service_default,
$ovn_metadata_enabled = $::os_service_default,
$dvr_enabled = $::os_service_default,
$disable_ovn_dhcp_for_baremetal_ports = $::os_service_default,
$dns_servers = $::os_service_default,
$vhostuser_socket_dir = $::os_service_default,
$ovn_emit_need_to_frag = $::os_service_default,
$network_log_rate_limit = $::os_service_default,
$network_log_burst_limit = $::os_service_default,
$network_log_local_output_log_base = $::os_service_default,
) {
include neutron::deps
@ -149,25 +155,26 @@ class neutron::plugins::ml2::ovn(
}
neutron_plugin_ml2 {
'ovn/ovn_nb_connection' : value => $ovn_nb_connection;
'ovn/ovn_sb_connection' : value => $ovn_sb_connection;
'ovn/ovn_nb_private_key' : value => $ovn_nb_private_key;
'ovn/ovn_nb_certificate' : value => $ovn_nb_certificate;
'ovn/ovn_nb_ca_cert' : value => $ovn_nb_ca_cert;
'ovn/ovn_sb_private_key' : value => $ovn_sb_private_key;
'ovn/ovn_sb_certificate' : value => $ovn_sb_certificate;
'ovn/ovn_sb_ca_cert' : value => $ovn_sb_ca_cert;
'ovn/ovsdb_connection_timeout' : value => $ovsdb_connection_timeout;
'ovn/ovsdb_retry_max_interval' : value => $ovsdb_retry_max_interval;
'ovn/ovsdb_probe_interval' : value => $ovsdb_probe_interval;
'ovn/neutron_sync_mode' : value => $neutron_sync_mode;
'ovn/ovn_metadata_enabled' : value => $ovn_metadata_enabled;
'ovn/enable_distributed_floating_ip': value => $dvr_enabled;
'ovn/dns_servers' : value => join(any2array($dns_servers), ',');
'ovn/vhost_sock_dir' : value => $vhostuser_socket_dir;
'ovn/ovn_emit_need_to_frag' : value => $ovn_emit_need_to_frag;
'network_log/rate_limit' : value => $network_log_rate_limit;
'network_log/burst_limit' : value => $network_log_burst_limit;
'network_log/local_output_log_base' : value => $network_log_local_output_log_base;
'ovn/ovn_nb_connection' : value => $ovn_nb_connection;
'ovn/ovn_sb_connection' : value => $ovn_sb_connection;
'ovn/ovn_nb_private_key' : value => $ovn_nb_private_key;
'ovn/ovn_nb_certificate' : value => $ovn_nb_certificate;
'ovn/ovn_nb_ca_cert' : value => $ovn_nb_ca_cert;
'ovn/ovn_sb_private_key' : value => $ovn_sb_private_key;
'ovn/ovn_sb_certificate' : value => $ovn_sb_certificate;
'ovn/ovn_sb_ca_cert' : value => $ovn_sb_ca_cert;
'ovn/ovsdb_connection_timeout' : value => $ovsdb_connection_timeout;
'ovn/ovsdb_retry_max_interval' : value => $ovsdb_retry_max_interval;
'ovn/ovsdb_probe_interval' : value => $ovsdb_probe_interval;
'ovn/neutron_sync_mode' : value => $neutron_sync_mode;
'ovn/ovn_metadata_enabled' : value => $ovn_metadata_enabled;
'ovn/enable_distributed_floating_ip' : value => $dvr_enabled;
'ovn/disable_ovn_dhcp_for_baremetal_ports': value => $disable_ovn_dhcp_for_baremetal_ports;
'ovn/dns_servers' : value => join(any2array($dns_servers), ',');
'ovn/vhost_sock_dir' : value => $vhostuser_socket_dir;
'ovn/ovn_emit_need_to_frag' : value => $ovn_emit_need_to_frag;
'network_log/rate_limit' : value => $network_log_rate_limit;
'network_log/burst_limit' : value => $network_log_burst_limit;
'network_log/local_output_log_base' : value => $network_log_local_output_log_base;
}
}

View File

@ -0,0 +1,6 @@
---
features:
- |
Add ``disable_ovn_dhcp_for_baremetal_ports`` parameter to
``neutron::plugins::ml2::ovn`` class which allows disabling
OVN's built-in DHCP for baremetal ports.

View File

@ -11,25 +11,26 @@ describe 'neutron::plugins::ml2::ovn' do
let :default_params do
{
:ovn_nb_connection => '<SERVICE DEFAULT>',
:ovn_sb_connection => '<SERVICE DEFAULT>',
:ovn_nb_private_key => '<SERVICE DEFAULT>',
:ovn_nb_certificate => '<SERVICE DEFAULT>',
:ovn_nb_ca_cert => '<SERVICE DEFAULT>',
:ovn_sb_private_key => '<SERVICE DEFAULT>',
:ovn_sb_certificate => '<SERVICE DEFAULT>',
:ovn_sb_ca_cert => '<SERVICE DEFAULT>',
:ovsdb_connection_timeout => '<SERVICE DEFAULT>',
:ovsdb_retry_max_interval => '<SERVICE DEFAULT>',
:ovsdb_probe_interval => '<SERVICE DEFAULT>',
:neutron_sync_mode => '<SERVICE DEFAULT>',
:dvr_enabled => '<SERVICE DEFAULT>',
:dns_servers => '<SERVICE DEFAULT>',
:vhostuser_socket_dir => '<SERVICE DEFAULT>',
:ovn_emit_need_to_frag => '<SERVICE DEFAULT>',
:network_log_rate_limit => '<SERVICE DEFAULT>',
:network_log_burst_limit => '<SERVICE DEFAULT>',
:network_log_local_output_log_base => '<SERVICE DEFAULT>',
:ovn_nb_connection => '<SERVICE DEFAULT>',
:ovn_sb_connection => '<SERVICE DEFAULT>',
:ovn_nb_private_key => '<SERVICE DEFAULT>',
:ovn_nb_certificate => '<SERVICE DEFAULT>',
:ovn_nb_ca_cert => '<SERVICE DEFAULT>',
:ovn_sb_private_key => '<SERVICE DEFAULT>',
:ovn_sb_certificate => '<SERVICE DEFAULT>',
:ovn_sb_ca_cert => '<SERVICE DEFAULT>',
:ovsdb_connection_timeout => '<SERVICE DEFAULT>',
:ovsdb_retry_max_interval => '<SERVICE DEFAULT>',
:ovsdb_probe_interval => '<SERVICE DEFAULT>',
:neutron_sync_mode => '<SERVICE DEFAULT>',
:dvr_enabled => '<SERVICE DEFAULT>',
:disable_ovn_dhcp_for_baremetal_ports => '<SERVICE DEFAULT>',
:dns_servers => '<SERVICE DEFAULT>',
:vhostuser_socket_dir => '<SERVICE DEFAULT>',
:ovn_emit_need_to_frag => '<SERVICE DEFAULT>',
:network_log_rate_limit => '<SERVICE DEFAULT>',
:network_log_burst_limit => '<SERVICE DEFAULT>',
:network_log_local_output_log_base => '<SERVICE DEFAULT>',
}
end
@ -58,6 +59,7 @@ describe 'neutron::plugins::ml2::ovn' do
should contain_neutron_plugin_ml2('ovn/ovsdb_probe_interval').with_value(p[:ovsdb_probe_interval])
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(p[:neutron_sync_mode])
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(p[:dvr_enabled])
should contain_neutron_plugin_ml2('ovn/disable_ovn_dhcp_for_baremetal_ports').with_value(p[:disable_ovn_dhcp_for_baremetal_ports])
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(p[:dns_servers])
should contain_neutron_plugin_ml2('ovn/vhost_sock_dir').with_value(p[:vhostuser_socket_dir])
should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(p[:ovn_emit_need_to_frag])
@ -70,21 +72,22 @@ describe 'neutron::plugins::ml2::ovn' do
context 'with parameters' do
let :params do
{
:ovn_nb_connection => 'tcp:127.0.0.1:6641',
:ovn_sb_connection => 'tcp:127.0.0.1:6642',
:ovn_nb_private_key => 'nb_key',
:ovn_nb_certificate => 'nb_cert',
:ovn_nb_ca_cert => 'nb_ca_cert',
:ovn_sb_private_key => 'sb_key',
:ovn_sb_certificate => 'sb_cert',
:ovn_sb_ca_cert => 'sb_ca_cert',
:ovsdb_connection_timeout => 60,
:ovsdb_retry_max_interval => 180,
:ovsdb_probe_interval => 60000,
:neutron_sync_mode => 'log',
:dvr_enabled => false,
:dns_servers => '8.8.8.8,10.10.10.10',
:ovn_emit_need_to_frag => false,
:ovn_nb_connection => 'tcp:127.0.0.1:6641',
:ovn_sb_connection => 'tcp:127.0.0.1:6642',
:ovn_nb_private_key => 'nb_key',
:ovn_nb_certificate => 'nb_cert',
:ovn_nb_ca_cert => 'nb_ca_cert',
:ovn_sb_private_key => 'sb_key',
:ovn_sb_certificate => 'sb_cert',
:ovn_sb_ca_cert => 'sb_ca_cert',
:ovsdb_connection_timeout => 60,
:ovsdb_retry_max_interval => 180,
:ovsdb_probe_interval => 60000,
:neutron_sync_mode => 'log',
:dvr_enabled => false,
:disable_ovn_dhcp_for_baremetal_ports => false,
:dns_servers => '8.8.8.8,10.10.10.10',
:ovn_emit_need_to_frag => false,
}
end
@ -102,6 +105,7 @@ describe 'neutron::plugins::ml2::ovn' do
should contain_neutron_plugin_ml2('ovn/ovsdb_probe_interval').with_value(p[:ovsdb_probe_interval])
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(p[:neutron_sync_mode])
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(p[:dvr_enabled])
should contain_neutron_plugin_ml2('ovn/disable_ovn_dhcp_for_baremetal_ports').with_value(p[:disable_ovn_dhcp_for_baremetal_ports])
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(p[:dns_servers])
should contain_neutron_plugin_ml2('ovn/vhost_sock_dir').with_value(p[:vhostuser_socket_dir])
should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(p[:ovn_emit_need_to_frag])