Merge pull request #2922 from brauner/2019-04-02/ovs_fixes

network: fix network device removal
This commit is contained in:
Stéphane Graber 2019-04-02 23:08:12 -04:00 committed by GitHub
commit 1f6af53257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2574,17 +2574,16 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
* interface to the network namespace, we have to destroy it.
*/
ret = lxc_netdev_delete_by_index(netdev->ifindex);
if (-ret == ENODEV) {
INFO("Interface \"%s\" with index %d already "
"deleted or existing in different network "
"namespace",
if (ret < 0) {
if (errno != ENODEV) {
WARN("Failed to remove interface \"%s\" with index %d",
netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex);
goto clear_ifindices;
}
INFO("Interface \"%s\" with index %d already deleted or existing in different network namespace",
netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex);
} else if (ret < 0) {
WARN("Failed to remove interface \"%s\" with index %d",
netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex);
goto clear_ifindices;
}
INFO("Removed interface \"%s\" with index %d",
netdev->name[0] != '\0' ? netdev->name : "(null)",