1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: link: use iproute2 to create custom devices (fixes #156)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2020-05-15 17:49:56 +02:00
parent 5890ab714e
commit 100fab20b6
2 changed files with 9 additions and 1 deletions

View File

@@ -100,7 +100,7 @@ class link(Addon, moduleBase):
self.iproute2.link_add_veth(ifaceobj.name, peer_name)
elif link_type:
self.netlink.link_add(ifname=ifaceobj.name, kind=link_type)
self.iproute2.link_add(ifaceobj.name, link_type)
def _down(self, ifaceobj):
if not ifaceobj.get_attr_value_first('link-type'):

View File

@@ -254,6 +254,14 @@ class IPRoute2(Cache, Requirements):
###
def link_add(self, ifname, link_type):
utils.exec_command(
"%s link add %s type %s"
% (utils.ip_cmd, ifname, link_type)
)
###
def link_add_macvlan(self, ifname, macvlan_ifname, macvlan_mode):
utils.exec_command(
"%s link add link %s name %s type macvlan mode %s"