mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
network: Clean up after disappeared transient inactive networks
If a network disappeared the daemon should not only remove it from the list of networks, but also do a proper cleanup. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
2bea2782d5
commit
8a2717e803
@ -533,6 +533,23 @@ networkUpdateState(virNetworkObj *obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
networkCleanupTransientInactive(virNetworkObj *obj,
|
||||||
|
void *opaque)
|
||||||
|
{
|
||||||
|
virNetworkDriverState *driver = opaque;
|
||||||
|
|
||||||
|
if (!virNetworkObjIsActive(obj) &&
|
||||||
|
!virNetworkObjIsPersistent(obj)) {
|
||||||
|
/* We can only do a cleanup here so that this can be called from an
|
||||||
|
* iterator over the networks */
|
||||||
|
networkCleanupInactive(driver, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
networkAutostartConfig(virNetworkObj *obj,
|
networkAutostartConfig(virNetworkObj *obj,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
@ -659,6 +676,11 @@ networkStateInitialize(bool privileged,
|
|||||||
virNetworkObjListForEach(network_driver->networks,
|
virNetworkObjListForEach(network_driver->networks,
|
||||||
networkUpdateState,
|
networkUpdateState,
|
||||||
network_driver);
|
network_driver);
|
||||||
|
/* Before removing inactive transient networks from the list make sure we
|
||||||
|
* clean up after them as well */
|
||||||
|
virNetworkObjListForEach(network_driver->networks,
|
||||||
|
networkCleanupTransientInactive,
|
||||||
|
network_driver);
|
||||||
virNetworkObjListPrune(network_driver->networks,
|
virNetworkObjListPrune(network_driver->networks,
|
||||||
VIR_CONNECT_LIST_NETWORKS_INACTIVE |
|
VIR_CONNECT_LIST_NETWORKS_INACTIVE |
|
||||||
VIR_CONNECT_LIST_NETWORKS_TRANSIENT);
|
VIR_CONNECT_LIST_NETWORKS_TRANSIENT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user