vs_port not working in CentOS 9 preview

Bug #1929707 reported by Alfredo Moralejo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
puppet-vswitch
Undecided
Unassigned

Bug Description

When using following commands:

sudo ip link add name loop2 type dummy
sudo ip addr add 127.2.0.1/24 dev loop2

Create following manifest:

# cat test.pp

include vswitch::ovs

vs_bridge { 'br-test2':
  ensure => present,
}

vs_port { 'loop2':
  ensure => present,
  bridge => 'br-test2',
}

When i try to apply, following error is found:

Error: Execution of '/usr/sbin/ifdown br-test2' returned 10: Error: '/etc/sysconfig/network-scripts/ifcfg-br-test2' is not an active connection.
Error: no active connection provided.
Error: /Stage[main]/Main/Vs_port[loop2]/ensure: change from 'absent' to 'present' failed: Execution of '/usr/sbin/ifdown br-test2' returned 10: Error: '/etc/sysconfig/network-scripts/ifcfg-br-test2' is not an active connection.
Error: no active connection provided.

Note that ovs_redhat provider of vs_port relies in ifcfg scripts which is removed in favor of NetworkManager in CentOS9 preview.

Revision history for this message
Kevin Carter (kevin-carter) wrote :

if you still have this environment up, can you try the following DIFF

``` diff

index 5bb8526..eea7b71 100644
--- a/usr/share/openstack-puppet/modules/vswitch/lib/puppet/provider/vs_port/ovs_redhat.rb
+++ b/usr/share/openstack-puppet/modules/vswitch/lib/puppet/provider/vs_port/ovs_redhat.rb.old
@@ -15,7 +15,7 @@ Puppet::Type.type(:vs_port).provide(
     'ONBOOT' => 'yes',
     'BOOTPROTO' => 'dhcp',
     'PEERDNS' => 'no',
- 'NM_CONTROLLED' => 'yes',
+ 'NM_CONTROLLED' => 'no',
     'NOZEROCONF' => 'yes'
   }

@@ -23,8 +23,8 @@ Puppet::Type.type(:vs_port).provide(
   defaultfor :osfamily => :redhat

   commands :ip => 'ip'
- commands :ifdown => 'nmcli connection down'
- commands :ifup => 'nmcli connection up'
+ commands :ifdown => 'ifdown'
+ commands :ifup => 'ifup'
   commands :vsctl => 'ovs-vsctl'

   def initialize(value={})

```

I have a hypothesis that NM will still read IFCFG files in C9, even if network-scripts is not available and I'd like to see if the following change would "fix" the issue you're seeing?

Revision history for this message
Kevin Carter (kevin-carter) wrote :

sorry the diff was in reverse. but you can see the modification i'm making.

Revision history for this message
Kevin Carter (kevin-carter) wrote :

in my local test environment on C8, this seems to work.

``` shell
$ sudo puppet apply --modulepath=/usr/share/openstack-puppet/modules test.pp
Warning: /etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
   (file: /etc/puppet/hiera.yaml)
Warning: Undefined variable '::deploy_config_name';
   (file & line not available)
Notice: Compiled catalog for undercloud.localdomain in environment production in 0.21 seconds
Notice: /Stage[main]/Main/Vs_bridge[br-test]/ensure: created
Notice: /Stage[main]/Main/Vs_port[loop2]/ensure: created
Notice: Applied catalog in 0.93 seconds
```

However, I don't have immediate access to a C9 lab at this time to confirm.

Revision history for this message
Alan Pevec (apevec) wrote :

Yes this should work, in RHEL9 / CentOS Stream 9 default /etc/NetworkManager/NetworkManager.conf has
[main]
#plugins=keyfile,ifcfg-rh

which is coming from F33 feature https://fedoraproject.org/wiki/Changes/NetworkManager_keyfile_instead_of_ifcfg_rh

so by default EL9 NM will not create ifcfg* files but will be able to read them

So you could also reproduce this on Fedora >=33 if you like!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-vswitch (master)
Changed in puppet-vswitch:
status: New → In Progress
Revision history for this message
Alfredo Moralejo (amoralej) wrote :

This is not working as expected in my c9 env. puppet apply succeeded but it's using ovs instead of ovs_redhat provider and it's not persisting the change. Note that command implies confine so it's probably looking for a 'nmcli connection down' command?

I can provide you with a c9 environment for your test if you want to experiment a bit.

NM can actually check ifcfg files as alan mentioned, but i'm not sure if understand the full syntax, tbh.

Revision history for this message
Kevin Carter (kevin-carter) wrote :

Alfredo, if you have a reproducer env and dont mind share (or providing a new one) I would greatly appreciate it. These are my keys https://github.com/cloudnull.keys

Revision history for this message
Kevin Carter (kevin-carter) wrote :

I spent some more time looking into this last week / end and sadly I've discovered that the rh-ifcfg plugin does not work for our use-case; it does not support any OVS device type. https://developer.gnome.org/NetworkManager/stable/nm-settings-ifcfg-rh.html

So we're going to need to develop nmcli integration into our module, or switch to something else.

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

So... I think there are many problems now...

1.
The vswitch calss used vswitch::params::provider to determine which class should be included but we don't have vswitch::ovs_redhat so this class does NEVER work in CentOS/RHEL.
(This is an independent problem, though)

2.
Currently we have multiple provider implementations for vs_port but these implementations are NEVER automatically selected but the first one(ovs.rb) is always used. That's why Alfredo experienced that ovs provider was used.
We need to add a new option to that ovs_port type to switch provider.
(I'm still looking for the way to implement this properly)

So what we need here is to fix 2 and add a new provider implementation relying on network manager...

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

Ignore what I mentioned in the second point. I totally missed defined defaultfor/confine.

If that switch is working then I think what we need is a new provider code relying on nmcli.

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

So I submitted very rough prototype of the new provider based on nmcli
 https://review.opendev.org/c/openstack/puppet-vswitch/+/795476

Because I've not yet tested this in actual setup, it might be broken and also some features are still missing now. However I think this can be used as our starting point to support CentOS/RHEL9.

Regarding 1 I mentioned in my comment 9, I submitted the fix.
 https://review.opendev.org/c/openstack/puppet-vswitch/+/795477

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on puppet-vswitch (master)

Change abandoned by "Kevin Carter <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/puppet-vswitch/+/793262

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers