mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
bhyve: do not cleanup unallocated networks on fail
virBhyveProcessStart() calls bhyveNetCleanup() if it fails. However, it might fail earlier than networks are allocated, so modify bhyveNetCleanup() to check if net->ifname is not NULL before going further with the cleanup.
This commit is contained in:
@@ -78,10 +78,12 @@ bhyveNetCleanup(virDomainObjPtr vm)
|
||||
int actualType = virDomainNetGetActualType(net);
|
||||
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||
ignore_value(virNetDevBridgeRemovePort(
|
||||
virDomainNetGetActualBridgeName(net),
|
||||
net->ifname));
|
||||
ignore_value(virNetDevTapDelete(net->ifname));
|
||||
if (net->ifname) {
|
||||
ignore_value(virNetDevBridgeRemovePort(
|
||||
virDomainNetGetActualBridgeName(net),
|
||||
net->ifname));
|
||||
ignore_value(virNetDevTapDelete(net->ifname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user