|
|
1797a9 |
From 95d77329b30c9a9a435a881941e27f9a1bed074e Mon Sep 17 00:00:00 2001
|
|
|
1797a9 |
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
|
1797a9 |
Date: Wed, 5 May 2021 10:14:40 +0200
|
|
|
1797a9 |
Subject: [PATCH 1/2] nm.profile: do not activate new interfaces twice
|
|
|
1797a9 |
|
|
|
1797a9 |
The current code is always adding the action MODIFIED if the interface
|
|
|
1797a9 |
is marked as up on the desired state. When a new interface is being
|
|
|
1797a9 |
added, Nmstate is adding two actions MODIFIED and NEW_*, that is
|
|
|
1797a9 |
incorrect.
|
|
|
1797a9 |
|
|
|
1797a9 |
This patch is improving the performance when creating new interfaces.
|
|
|
1797a9 |
|
|
|
1797a9 |
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
|
1797a9 |
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
|
1797a9 |
---
|
|
|
1797a9 |
libnmstate/nm/profile.py | 3 ++-
|
|
|
1797a9 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
1797a9 |
|
|
|
1797a9 |
diff --git a/libnmstate/nm/profile.py b/libnmstate/nm/profile.py
|
|
|
1797a9 |
index b4814d9..e117dfe 100644
|
|
|
1797a9 |
--- a/libnmstate/nm/profile.py
|
|
|
1797a9 |
+++ b/libnmstate/nm/profile.py
|
|
|
1797a9 |
@@ -164,7 +164,6 @@ class NmProfile:
|
|
|
1797a9 |
if self._iface.is_virtual and self._nm_dev:
|
|
|
1797a9 |
self._add_action(NmProfile.ACTION_DELETE_DEVICE)
|
|
|
1797a9 |
elif self._iface.is_up and not self._needs_veth_activation():
|
|
|
1797a9 |
- self._add_action(NmProfile.ACTION_MODIFIED)
|
|
|
1797a9 |
if not self._nm_dev:
|
|
|
1797a9 |
if self._iface.type == InterfaceType.OVS_PORT:
|
|
|
1797a9 |
self._add_action(NmProfile.ACTION_NEW_OVS_PORT)
|
|
|
1797a9 |
@@ -176,6 +175,8 @@ class NmProfile:
|
|
|
1797a9 |
self._add_action(NmProfile.ACTION_NEW_VXLAN)
|
|
|
1797a9 |
else:
|
|
|
1797a9 |
self._add_action(NmProfile.ACTION_NEW_IFACES)
|
|
|
1797a9 |
+ else:
|
|
|
1797a9 |
+ self._add_action(NmProfile.ACTION_MODIFIED)
|
|
|
1797a9 |
|
|
|
1797a9 |
elif self._iface.is_down:
|
|
|
1797a9 |
if self._nm_ac:
|
|
|
1797a9 |
--
|
|
|
1797a9 |
2.31.1
|
|
|
1797a9 |
|
|
|
1797a9 |
|
|
|
1797a9 |
From 9ea925a9a978671881e428abf82aac39c01376e8 Mon Sep 17 00:00:00 2001
|
|
|
1797a9 |
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
|
1797a9 |
Date: Wed, 5 May 2021 10:52:32 +0200
|
|
|
1797a9 |
Subject: [PATCH 2/2] nm.profile: activate modified ovs-port first
|
|
|
1797a9 |
|
|
|
1797a9 |
When removing an ovs-br with an ovs-iface attached and creating a new
|
|
|
1797a9 |
ovs-br with the ovs-iface attached in the same transaction the order of
|
|
|
1797a9 |
the activations is important.
|
|
|
1797a9 |
|
|
|
1797a9 |
The ovs-port must be activated before the ovs-iface. If not, NM will
|
|
|
1797a9 |
throw a dependency error. This error is correct because the ovs-iface
|
|
|
1797a9 |
depends on the ovs-port, so it must be updated first.
|
|
|
1797a9 |
|
|
|
1797a9 |
This fixes:
|
|
|
1797a9 |
|
|
|
1797a9 |
```
|
|
|
1797a9 |
Traceback (most recent call last):
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/nm/checkpoint.py", line 93, in _refresh_checkpoint_timeout
|
|
|
1797a9 |
self._dbuspath, self._timeout, cancellable, cb, cb_data
|
|
|
1797a9 |
TypeError: Argument 1 does not allow None as a value
|
|
|
1797a9 |
^CTraceback (most recent call last):
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/nmstate.py", line 53, in plugin_context
|
|
|
1797a9 |
yield plugins
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 78, in apply
|
|
|
1797a9 |
_apply_ifaces_state(plugins, net_state, verify_change, save_to_disk)
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 116, in _apply_ifaces_state
|
|
|
1797a9 |
plugin.apply_changes(net_state, save_to_disk)
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/nm/plugin.py", line 204, in apply_changes
|
|
|
1797a9 |
NmProfiles(self.context).apply_config(net_state, save_to_disk)
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/nm/profiles.py", line 89, in apply_config
|
|
|
1797a9 |
self._ctx.wait_all_finish()
|
|
|
1797a9 |
File "/usr/lib/python3.6/site-packages/libnmstate/nm/context.py", line 213, in wait_all_finish
|
|
|
1797a9 |
raise tmp_error
|
|
|
1797a9 |
libnmstate.error.NmstateLibnmError: Activate profile uuid:3a359cd0-d68a-4c7a-ae50-f97b47390142 iface:net type: ovs-interface failed: reason=<enum NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED of type NM.ActiveConnectionStateReason> <enum NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED of type NM.DeviceStateReason>
|
|
|
1797a9 |
```
|
|
|
1797a9 |
|
|
|
1797a9 |
Integration test added
|
|
|
1797a9 |
|
|
|
1797a9 |
Ref: https://bugzilla.redhat.com/1947287
|
|
|
1797a9 |
|
|
|
1797a9 |
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
|
|
1797a9 |
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
|
1797a9 |
---
|
|
|
1797a9 |
libnmstate/nm/profile.py | 13 ++++++++++++-
|
|
|
1797a9 |
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
1797a9 |
|
|
|
1797a9 |
diff --git a/libnmstate/nm/profile.py b/libnmstate/nm/profile.py
|
|
|
1797a9 |
index e117dfe..b655885 100644
|
|
|
1797a9 |
--- a/libnmstate/nm/profile.py
|
|
|
1797a9 |
+++ b/libnmstate/nm/profile.py
|
|
|
1797a9 |
@@ -69,6 +69,8 @@ class NmProfile:
|
|
|
1797a9 |
ACTION_OTHER_MASTER = "other_master"
|
|
|
1797a9 |
ACTION_DELETE_PROFILE = "delete_profile"
|
|
|
1797a9 |
ACTION_TOP_MASTER = "top_master"
|
|
|
1797a9 |
+ ACTION_MODIFIED_OVS_PORT = "modified_ovs_port"
|
|
|
1797a9 |
+ ACTION_MODIFIED_OVS_IFACE = "modified_ovs_iface"
|
|
|
1797a9 |
|
|
|
1797a9 |
# This is order on group for activation/deactivation
|
|
|
1797a9 |
ACTIONS = (
|
|
|
1797a9 |
@@ -81,6 +83,8 @@ class NmProfile:
|
|
|
1797a9 |
ACTION_NEW_OVS_IFACE,
|
|
|
1797a9 |
ACTION_NEW_VETH,
|
|
|
1797a9 |
ACTION_NEW_VETH_PEER,
|
|
|
1797a9 |
+ ACTION_MODIFIED_OVS_PORT,
|
|
|
1797a9 |
+ ACTION_MODIFIED_OVS_IFACE,
|
|
|
1797a9 |
ACTION_MODIFIED,
|
|
|
1797a9 |
ACTION_NEW_VLAN,
|
|
|
1797a9 |
ACTION_NEW_VXLAN,
|
|
|
1797a9 |
@@ -176,7 +180,12 @@ class NmProfile:
|
|
|
1797a9 |
else:
|
|
|
1797a9 |
self._add_action(NmProfile.ACTION_NEW_IFACES)
|
|
|
1797a9 |
else:
|
|
|
1797a9 |
- self._add_action(NmProfile.ACTION_MODIFIED)
|
|
|
1797a9 |
+ if self._iface.type == InterfaceType.OVS_PORT:
|
|
|
1797a9 |
+ self._add_action(NmProfile.ACTION_MODIFIED_OVS_PORT)
|
|
|
1797a9 |
+ if self._iface.type == InterfaceType.OVS_INTERFACE:
|
|
|
1797a9 |
+ self._add_action(NmProfile.ACTION_MODIFIED_OVS_IFACE)
|
|
|
1797a9 |
+ else:
|
|
|
1797a9 |
+ self._add_action(NmProfile.ACTION_MODIFIED)
|
|
|
1797a9 |
|
|
|
1797a9 |
elif self._iface.is_down:
|
|
|
1797a9 |
if self._nm_ac:
|
|
|
1797a9 |
@@ -420,6 +429,8 @@ class NmProfile:
|
|
|
1797a9 |
def do_action(self, action):
|
|
|
1797a9 |
if action in (
|
|
|
1797a9 |
NmProfile.ACTION_MODIFIED,
|
|
|
1797a9 |
+ NmProfile.ACTION_MODIFIED_OVS_PORT,
|
|
|
1797a9 |
+ NmProfile.ACTION_MODIFIED_OVS_IFACE,
|
|
|
1797a9 |
NmProfile.ACTION_ACTIVATE_FIRST,
|
|
|
1797a9 |
NmProfile.ACTION_TOP_MASTER,
|
|
|
1797a9 |
NmProfile.ACTION_NEW_IFACES,
|
|
|
1797a9 |
--
|
|
|
1797a9 |
2.31.1
|
|
|
1797a9 |
|