Blame SOURCES/BZ_1741049_vlan_interface_should_activated_after_base.patch

245567
From abe64cecf310d482f1779c10af5f903c4c0bd98c Mon Sep 17 00:00:00 2001
245567
From: Edward Haas <edwardh@redhat.com>
245567
Date: Tue, 13 Aug 2019 20:37:53 +0800
245567
Subject: [PATCH] nm.applier: Prioritize base iface activation before the vlan
245567
245567
When both the base interface and the VLAN interface are created in one
245567
transaction, the base interface must be activated before the vlan one,
245567
otherwise the VLAN activation fails.
245567
245567
The new VLAN interfaces are now activated after all other interfaces.
245567
245567
Signed-off-by: Edward Haas <edwardh@redhat.com>
245567
Signed-off-by: Gris Ge <fge@redhat.com>
245567
---
245567
 libnmstate/nm/applier.py       |  8 ++++++++
245567
 libnmstate/schema.py           |  2 ++
245567
 1 files changed, 10 insertions(+)
245567
245567
diff --git a/libnmstate/nm/applier.py b/libnmstate/nm/applier.py
245567
index ae5cd75..750ca3d 100644
245567
--- a/libnmstate/nm/applier.py
245567
+++ b/libnmstate/nm/applier.py
245567
@@ -21,6 +21,8 @@ import itertools
245567
 import six
245567
 
245567
 from libnmstate.error import NmstateValueError
245567
+from libnmstate.schema import Interface
245567
+from libnmstate.schema import InterfaceType
245567
 from libnmstate.schema import LinuxBridge as LB
245567
 
245567
 from . import bond
245567
@@ -118,6 +120,7 @@ def set_ifaces_admin_state(ifaces_desired_state, con_profiles=()):
245567
     con_profiles_by_devname = _index_profiles_by_devname(con_profiles)
245567
     new_ifaces = _get_new_ifaces(con_profiles)
245567
     new_ifaces_to_activate = set()
245567
+    new_vlan_ifaces_to_activate = set()
245567
     new_ovs_interface_to_activate = set()
245567
     new_ovs_port_to_activate = set()
245567
     master_ifaces_to_edit = set()
245567
@@ -133,6 +136,8 @@ def set_ifaces_admin_state(ifaces_desired_state, con_profiles=()):
245567
                     new_ovs_interface_to_activate.add(ifname)
245567
                 elif iface_desired_state['type'] == ovs.PORT_TYPE:
245567
                     new_ovs_port_to_activate.add(ifname)
245567
+                elif iface_desired_state[Interface.TYPE] == InterfaceType.VLAN:
245567
+                    new_vlan_ifaces_to_activate.add(ifname)
245567
                 else:
245567
                     new_ifaces_to_activate.add(ifname)
245567
         else:
245567
@@ -186,6 +191,9 @@ def set_ifaces_admin_state(ifaces_desired_state, con_profiles=()):
245567
     for dev, con_profile in ifaces_to_edit:
245567
         device.modify(dev, con_profile)
245567
 
245567
+    for ifname in new_vlan_ifaces_to_activate:
245567
+        device.activate(dev=None, connection_id=ifname)
245567
+
245567
     for dev, actions in six.viewitems(remove_devs_actions):
245567
         for action in actions:
245567
             action(dev)
245567
diff --git a/libnmstate/schema.py b/libnmstate/schema.py
245567
index 1737003..0af60ef 100644
245567
--- a/libnmstate/schema.py
245567
+++ b/libnmstate/schema.py
245567
@@ -88,6 +88,7 @@ class InterfaceType(object):
245567
     KEY = Interface.TYPE
245567
 
245567
     BOND = 'bond'
245567
+    DUMMY = 'dummy'
245567
     ETHERNET = 'ethernet'
245567
     LINUX_BRIDGE = 'linux-bridge'
245567
     OVS_BRIDGE = 'ovs-bridge'
245567
@@ -98,6 +99,7 @@ class InterfaceType(object):
245567
 
245567
     VIRT_TYPES = (
245567
         BOND,
245567
+        DUMMY,
245567
         LINUX_BRIDGE,
245567
         OVS_BRIDGE,
245567
         OVS_PORT,
245567
-- 
245567
2.22.1
245567