mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 11:01:19 +00:00
nwfilter: tolerate disappearing interfaces while instantiating filter
When instantiating a filter, a VM may disappear and remove its tap interfaces. Tolerate this case and don't report an error.
This commit is contained in:
parent
d30d572650
commit
762101c7af
@ -898,11 +898,18 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
int ifindex;
|
int ifindex;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (ifaceGetIndex(true, net->ifname, &ifindex) < 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
virNWFilterLockFilterUpdates();
|
virNWFilterLockFilterUpdates();
|
||||||
|
|
||||||
|
/* after grabbing the filter update lock check for the interface; if
|
||||||
|
it's not there anymore its filters will be or are being removed
|
||||||
|
(while holding the lock) and we don't want to build new ones */
|
||||||
|
if (ifaceGetIndex(false, net->ifname, &ifindex) < 0) {
|
||||||
|
/* interfaces / VMs can disappear during filter instantiation;
|
||||||
|
don't mark it as an error */
|
||||||
|
rc = 0;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
rc = __virNWFilterInstantiateFilter(conn,
|
rc = __virNWFilterInstantiateFilter(conn,
|
||||||
teardownOld,
|
teardownOld,
|
||||||
net->ifname,
|
net->ifname,
|
||||||
@ -917,6 +924,7 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
false,
|
false,
|
||||||
foundNewFilter);
|
foundNewFilter);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virNWFilterUnlockFilterUpdates();
|
virNWFilterUnlockFilterUpdates();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user