diff --git a/config/puppet-modules/puppet-network/debian/deb_folder/patches/0002-set-provider-mode-when-formatting-interfaces-file.patch b/config/puppet-modules/puppet-network/debian/deb_folder/patches/0002-set-provider-mode-when-formatting-interfaces-file.patch new file mode 100644 index 000000000..af8a040e9 --- /dev/null +++ b/config/puppet-modules/puppet-network/debian/deb_folder/patches/0002-set-provider-mode-when-formatting-interfaces-file.patch @@ -0,0 +1,68 @@ +From 800d2d360068874b306735cd000b657c55cbb0f4 Mon Sep 17 00:00:00 2001 +From: Andre Fernando Zanella Kantek + +Date: Wed, 2 Mar 2022 13:32:03 -0300 +Subject: [PATCH] set provider mode when formatting interfaces file + +When the interfaces file is generated it is necessary to determine the +mode (vlan or raw) from the interface name. Originally the plugin +considers that a previous interfaces file exists and will use it to +set the mode value. + +But on StarlingX network_config is generated by sysinv and there is no +previous file to parse, so this change adds the mode logic on +file formatting. + +Signed-off-by: Andre Fernando Zanella Kantek +--- + .../provider/network_config/interfaces.rb | 25 ++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/lib/puppet/provider/network_config/interfaces.rb b/lib/puppet/provider/network_config/interfaces.rb +index d72ab45..f16d082 100644 +--- a/lib/puppet/provider/network_config/interfaces.rb ++++ b/lib/puppet/provider/network_config/interfaces.rb +@@ -200,9 +200,15 @@ Puppet::Type.type(:network_config).provide(:interfaces) do + # 'vlan22' + when %r{^vlan} + :vlan +- # 'eth2.0003' or 'br1.2' ++ # 'eno1.0003' or 'br1.0002' + when %r{^[a-z]{1,}[0-9]{1,}\.[0-9]{1,4}} + :vlan ++ # 'enp0s9.0003' ++ when %r{^[a-z]{1,}[0-9]{1,}[a-z]{1,}[0-9]{1,}\.[0-9]{1,4}} ++ :vlan ++ # handles 'eth0' or 'enp0s9.100' ++ # there is no need to mark as vlan in case of enp0s9.100 ++ # or eth2.4 as it does not need vlan-raw-device option + else + :raw + end +@@ -279,6 +285,23 @@ Puppet::Type.type(:network_config).provide(:interfaces) do + stanza = [] + stanza << %(iface #{provider.name} #{provider.family} #{provider.method}) + ++ provider.mode = case provider.name ++ # 'vlan22' ++ when %r{^vlan} ++ :vlan ++ # 'eno1.0003' or 'br1.0002' ++ when %r{^[a-z]{1,}[0-9]{1,}\.[0-9]{1,4}} ++ :vlan ++ # 'enp0s9.0003' ++ when %r{^[a-z]{1,}[0-9]{1,}[a-z]{1,}[0-9]{1,}\.[0-9]{1,4}} ++ :vlan ++ # handles 'eth0' or 'enp0s9.100' ++ # there is no need to mark as vlan in case of enp0s9.100 ++ # as it does not need vlan-raw-device option ++ else ++ :raw ++ end ++ + # add the vlan-raw-device only when explicitely set in interfaces(5) stanza + # otherwise it's already assumed given the stanza name (ethX.NN) + if provider.mode == :vlan +-- +2.17.1 + diff --git a/config/puppet-modules/puppet-network/debian/deb_folder/patches/series b/config/puppet-modules/puppet-network/debian/deb_folder/patches/series index 6dbc7cac7..c15dcf1af 100644 --- a/config/puppet-modules/puppet-network/debian/deb_folder/patches/series +++ b/config/puppet-modules/puppet-network/debian/deb_folder/patches/series @@ -1 +1,2 @@ -0001-save-result-file-to-var-run-network-to-allow-manipul.patch \ No newline at end of file +0001-save-result-file-to-var-run-network-to-allow-manipul.patch +0002-set-provider-mode-when-formatting-interfaces-file.patch \ No newline at end of file