mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
network: Separate cleanup from networkRemoveInactive
The new function (networkCleanupInactive) can be called from an iterator over the list of networks without the risk of deadlock. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
74a22c09be
commit
2bea2782d5
@ -325,10 +325,10 @@ networkDnsmasqConfigFileName(virNetworkDriverConfig *cfg,
|
||||
}
|
||||
|
||||
|
||||
/* do needed cleanup steps and remove the network from the list */
|
||||
/* do needed cleanup steps */
|
||||
static int
|
||||
networkRemoveInactive(virNetworkDriverState *driver,
|
||||
virNetworkObj *obj)
|
||||
networkCleanupInactive(virNetworkDriverState *driver,
|
||||
virNetworkObj *obj)
|
||||
{
|
||||
g_autoptr(virNetworkDriverConfig) cfg = virNetworkDriverGetConfig(driver);
|
||||
g_autofree char *leasefile = NULL;
|
||||
@ -372,6 +372,18 @@ networkRemoveInactive(virNetworkDriverState *driver,
|
||||
/* remove status file */
|
||||
unlink(statusfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* do needed cleanup steps and remove the network from the list */
|
||||
static int
|
||||
networkRemoveInactive(virNetworkDriverState *driver,
|
||||
virNetworkObj *obj)
|
||||
{
|
||||
if (networkCleanupInactive(driver, obj) < 0)
|
||||
return -1;
|
||||
|
||||
/* remove the network definition */
|
||||
virNetworkObjRemoveInactive(driver->networks, obj);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user