From: Daniel P. Berrangé Date: Thu, 12 Sep 2019 13:21:21 +0000 (+0100) Subject: conf: avoid looking up network port that doesn't exist X-Git-Tag: v5.8.0-rc1~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb0239ff304d8cb1e0e029a8494ae8b1c3f4d8e3;p=thirdparty%2Flibvirt.git conf: avoid looking up network port that doesn't exist If the hypervisor driver has not yet created the network port, the portid field will be "00000000-0000-0000-0000-000000000000". If a failure occurs during early VM startup, the hypervisor driver may none the less try to release the network port, resulting in an undesirable warning: 2019-09-12 13:17:42.349+0000: 16544: error : virNetworkObjLookupPort:1679 : network port not found: Network port with UUID 00000000-0000-0000-0000-000000000000 does not exist By checking if the portid UUID is valid, we can avoid polluting the logs in this way. Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3dc638f0de..b1f8a13319 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30994,6 +30994,12 @@ virDomainNetReleaseActualDevice(virConnectPtr conn, virNetworkPortPtr port = NULL; int ret = -1; + /* Port might not exist if a failure occurred during VM startup */ + if (!virUUIDIsValid(iface->data.network.portid)) { + ret = 0; + goto cleanup; + } + if (!(net = virNetworkLookupByName(conn, iface->data.network.name))) goto cleanup;