network: fix ovs removal

Closes #3137. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent de95b436
...@@ -3492,29 +3492,19 @@ bool lxc_delete_network_priv(struct lxc_handler *handler) ...@@ -3492,29 +3492,19 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
if (hostveth[0] == '\0') if (hostveth[0] == '\0')
goto clear_ifindices; goto clear_ifindices;
ret = lxc_netdev_delete_by_name(hostveth); if (is_empty_string(netdev->link) || !is_ovs_bridge(netdev->link)) {
if (ret < 0) { ret = lxc_netdev_delete_by_name(hostveth);
WARN("Failed to remove interface \"%s\" from \"%s\"", if (ret < 0)
hostveth, netdev->link); WARN("Failed to remove interface \"%s\" from \"%s\"", hostveth, netdev->link);
goto clear_ifindices;
}
INFO("Removed interface \"%s\" from \"%s\"", hostveth, netdev->link);
if (netdev->link[0] == '\0' || !is_ovs_bridge(netdev->link)) { INFO("Removed interface \"%s\" from \"%s\"", hostveth, netdev->link);
netdev->priv.veth_attr.veth1[0] = '\0'; } else if (!is_empty_string(netdev->link)) {
netdev->ifindex = 0; ret = lxc_ovs_delete_port(netdev->link, hostveth);
netdev->priv.veth_attr.ifindex = 0; if (ret < 0)
goto clear_ifindices; WARN("Failed to remove port \"%s\" from openvswitch bridge \"%s\"", hostveth, netdev->link);
}
/* Delete the openvswitch port. */ INFO("Removed port \"%s\" from openvswitch bridge \"%s\"", hostveth, netdev->link);
ret = lxc_ovs_delete_port(netdev->link, hostveth); }
if (ret < 0)
WARN("Failed to remove port \"%s\" from openvswitch "
"bridge \"%s\"", hostveth, netdev->link);
else
INFO("Removed port \"%s\" from openvswitch bridge \"%s\"",
hostveth, netdev->link);
clear_ifindices: clear_ifindices:
/* We need to clear any ifindices we recorded so liblxc won't /* We need to clear any ifindices we recorded so liblxc won't
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment