daemon: update iface to use desired name when configuring, gui: dont assign mac to non container nodes

This commit is contained in:
Blake Harnden 2022-03-22 21:08:31 -07:00
parent 346364d705
commit 26f0848cb4
2 changed files with 10 additions and 8 deletions

View file

@ -404,9 +404,11 @@ class CoreClient:
for edge in self.links.values():
link = edge.link
if not definition:
if link.iface1 and not link.iface1.mac:
node1 = self.session.nodes[link.node1_id]
node2 = self.session.nodes[link.node2_id]
if nutils.is_container(node1) and link.iface1 and not link.iface1.mac:
link.iface1.mac = self.ifaces_manager.next_mac()
if link.iface2 and not link.iface2.mac:
if nutils.is_container(node2) and link.iface2 and not link.iface2.mac:
link.iface2.mac = self.ifaces_manager.next_mac()
links.append(link)
if edge.asymmetric_link:

View file

@ -195,24 +195,24 @@ class NodeBase(abc.ABC):
localname,
self.session.use_ovs(),
mtu,
node=self,
server=self.server,
self,
self.server,
)
if iface_data:
if iface_data.mac:
iface.set_mac(iface_data.mac)
for ip in iface_data.get_ips():
iface.add_ip(ip)
if iface_data.name:
name = iface_data.name
if options:
iface.options.update(options)
self.ifaces[iface_id] = iface
if self.up:
iface.startup()
if iface_data and iface_data.name is not None:
name = iface_data.name
else:
name = iface.name
self.adopt_iface(iface, name)
else:
iface.name = name
return iface
def delete_iface(self, iface_id: int) -> CoreInterface: