From: Ondrej Lichtner olichtne@redhat.com
This patch adds the classes NetConfigDeviceVEth and NmConfigDeviceVEth. That represent configuration of veth type devices. Since NM doesn't support veth devices, the NmConfigDeviceVEth class just to defines the is_nm_managed method.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Slave/NetConfigDevice.py | 22 +++++++++++++++++++++- lnst/Slave/NmConfigDevice.py | 9 ++++++++- 2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py index d64c471..2a15a82 100644 --- a/lnst/Slave/NetConfigDevice.py +++ b/lnst/Slave/NetConfigDevice.py @@ -394,6 +394,25 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
self._del_ports()
+class NetConfigDeviceVEth(NetConfigDeviceGeneric): + _modulename = "" + _moduleload = False + + def create(self): + conf = self._dev_config + exec_cmd("ip link add %s type veth peer name %s" % (conf["name"], + conf["peer_name"])) + + def destroy(self): + conf = self._dev_config + exec_cmd("ip link del %s" % conf["name"]) + + def configure(self): + #no configuration options supported at the moment + return True + + def deconfigure(self): + return True
type_class_mapping = { "eth": NetConfigDeviceEth, @@ -402,7 +421,8 @@ type_class_mapping = { "macvlan": NetConfigDeviceMacvlan, "vlan": NetConfigDeviceVlan, "team": NetConfigDeviceTeam, - "ovs_bridge": NetConfigDeviceOvsBridge + "ovs_bridge": NetConfigDeviceOvsBridge, + "veth": NetConfigDeviceVEth }
def NetConfigDevice(dev_config, if_manager): diff --git a/lnst/Slave/NmConfigDevice.py b/lnst/Slave/NmConfigDevice.py index 718bd9f..37251e9 100644 --- a/lnst/Slave/NmConfigDevice.py +++ b/lnst/Slave/NmConfigDevice.py @@ -805,6 +805,12 @@ class NmConfigDeviceOvsBridge(NmConfigDeviceGeneric):
return managed
+class NmConfigDeviceVEth(NmConfigDeviceGeneric): + #Not supported by NetworkManager + @classmethod + def is_nm_managed(cls, dev_config, if_manager): + return False + type_class_mapping = { "eth": NmConfigDeviceEth, "bond": NmConfigDeviceBond, @@ -812,7 +818,8 @@ type_class_mapping = { "macvlan": NmConfigDeviceMacvlan, "vlan": NmConfigDeviceVlan, "team": NmConfigDeviceTeam, - "ovs_bridge": NmConfigDeviceOvsBridge + "ovs_bridge": NmConfigDeviceOvsBridge, + "veth": NmConfigDeviceVEth }
def is_nm_managed(dev_config, if_manager):