virNetworkBridgeInUse() doesn't check if the bridge is manually created outside of libvirt. Check if the bridge actually exist on host using the virNetDevExists(). Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx> --- src/conf/network_conf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index b334b64..8e9f3ac 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -3294,6 +3294,7 @@ int virNetworkBridgeInUse(virNetworkObjListPtr nets, const char *bridge, const char *skipname) { + int ret; virNetworkObjPtr obj; struct virNetworkBridgeInUseHelperData data = {bridge, skipname}; @@ -3301,7 +3302,12 @@ int virNetworkBridgeInUse(virNetworkObjListPtr nets, obj = virHashSearch(nets->objs, virNetworkBridgeInUseHelper, &data); virObjectUnlock(nets); - return obj != NULL; + if (obj) + ret = 1; + else /* Bridge might have been created by a user manually outside libvirt */ + ret = virNetDevExists(bridge) ? 1 : 0; + + return ret; } char *virNetworkAllocateBridge(virNetworkObjListPtr nets, -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list