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:
Roman Bogorodskiy 2014-06-13 18:56:59 +04:00
parent 381a3dbdab
commit 5c1f82efae

View File

@ -78,6 +78,7 @@ bhyveNetCleanup(virDomainObjPtr vm)
int actualType = virDomainNetGetActualType(net);
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
if (net->ifname) {
ignore_value(virNetDevBridgeRemovePort(
virDomainNetGetActualBridgeName(net),
net->ifname));
@ -85,6 +86,7 @@ bhyveNetCleanup(virDomainObjPtr vm)
}
}
}
}
int
virBhyveProcessStart(virConnectPtr conn,