fix deleting virtual network devices

This commit is contained in:
Michael Hudson-Doyle 2020-03-20 09:07:17 +13:00
parent cc52bb62a5
commit 3856a11186
2 changed files with 18 additions and 10 deletions

View File

@ -24,6 +24,13 @@ Network:
action: EDIT_IPV4
method-data:
method: dhcp
- obj: [interface name bond10]
action: DELETE
- action: create-bond
data:
name: bond10
devices:
- [interface index 0]
- action: done
Proxy:
proxy: ""

View File

@ -129,16 +129,17 @@ class NetworkView(BaseView):
_action_EDIT_BOND = _stretchy_shower(BondStretchy)
_action_ADD_VLAN = _stretchy_shower(AddVlanStretchy)
def _action_DELETE(self, device):
touched_devs = set()
if device.type == "bond":
for name in device.config['interfaces']:
touched_devs.add(self.model.get_netdev_by_name(name))
device.config = None
self.del_link(device)
for dev in touched_devs:
self.update_link(dev)
self.controller.apply_config()
def _action_DELETE(self, name, device):
with self.controller.context.child(name):
touched_devs = set()
if device.type == "bond":
for name in device.config['interfaces']:
touched_devs.add(self.model.get_netdev_by_name(name))
device.config = None
self.del_link(device)
for dev in touched_devs:
self.update_link(dev)
self.controller.apply_config()
def _action(self, sender, action, device):
action, meth = action