From nobody Fri May 3 08:42:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1535113863966476.18990236648017; Fri, 24 Aug 2018 05:31:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06B833D07; Fri, 24 Aug 2018 12:31:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6905D17D14; Fri, 24 Aug 2018 12:31:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 49B0A18005D0; Fri, 24 Aug 2018 12:30:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7OCUvEU014055 for ; Fri, 24 Aug 2018 08:30:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2EAA561470; Fri, 24 Aug 2018 12:30:57 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-58.phx2.redhat.com [10.3.116.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC98017B10 for ; Fri, 24 Aug 2018 12:30:54 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 24 Aug 2018 08:30:50 -0400 Message-Id: <20180824123050.5999-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] process: Ignore nwfilter binding instantiation issues during reconnect X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 24 Aug 2018 12:31:02 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1607202 It's essentially stated in the nwfilterBindingDelete that we will allow the admin to shoot themselves in the foot by deleting the nwfilter binding which then allows them to undefine the nwfilter that is in use for the running guest... However, by allowing this we cause a problem for libvirtd restart reconnect processing which would then try to recreate the missing binding attempting to use the deleted filter resulting in an error and thus shutting the guest down. So rather than keep adding virDomainConfNWFilterInstantiate flags to "ignore" specific error conditions and since (so far) this is the only path that cared about checking if the filter already exists and ignoring, let's just ignore all errors and make the qemuProcessFiltersInstantiate be a void which will attempt to check all networks for bindings and reload all filters that exist. Using the VIR_INFO in order to at least "log" the avoided issue. This also means virDomainConfNWFilterInstantiate no longer needs to handle/check the ignoreExists possbility. Signed-off-by: John Ferlan --- v1: https://www.redhat.com/archives/libvir-list/2018-August/msg01407.html Changes - removed the ignoreExists and just change the logic for reconnect processing to essentially ignore all errors. If it's felt the VIR_INFO would be too chatty (especially since it'll be generated for every already defined filter binding), I can remove it. Another option would be to keep the ignoreExists logic and only generate that VIR_INFO for "other" messages. In that case, I'd probably want to change it to a VIR_WARN. Still figured I'd post the remove it all option first for consideration with this caveat so that "option" can be considered as well. src/conf/domain_nwfilter.c | 15 +++------------ src/conf/domain_nwfilter.h | 3 +-- src/lxc/lxc_process.c | 2 +- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_interface.c | 4 ++-- src/qemu/qemu_process.c | 23 +++++++++++++++-------- src/uml/uml_conf.c | 2 +- 7 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c index f39c8a1f9b..51c9063ca7 100644 --- a/src/conf/domain_nwfilter.c +++ b/src/conf/domain_nwfilter.c @@ -84,8 +84,7 @@ virNWFilterBindingDefForNet(const char *vmname, int virDomainConfNWFilterInstantiate(const char *vmname, const unsigned char *vmuuid, - virDomainNetDefPtr net, - bool ignoreExists) + virDomainNetDefPtr net) { virConnectPtr conn =3D virGetConnectNWFilter(); virNWFilterBindingDefPtr def =3D NULL; @@ -93,20 +92,12 @@ virDomainConfNWFilterInstantiate(const char *vmname, char *xml =3D NULL; int ret =3D -1; =20 - VIR_DEBUG("vmname=3D%s portdev=3D%s filter=3D%s ignoreExists=3D%d", - vmname, NULLSTR(net->ifname), NULLSTR(net->filter), ignoreEx= ists); + VIR_DEBUG("vmname=3D%s portdev=3D%s filter=3D%s", + vmname, NULLSTR(net->ifname), NULLSTR(net->filter)); =20 if (!conn) goto cleanup; =20 - if (ignoreExists) { - binding =3D virNWFilterBindingLookupByPortDev(conn, net->ifname); - if (binding) { - ret =3D 0; - goto cleanup; - } - } - if (!(def =3D virNWFilterBindingDefForNet(vmname, vmuuid, net))) goto cleanup; =20 diff --git a/src/conf/domain_nwfilter.h b/src/conf/domain_nwfilter.h index 6bda228fc8..d2ebeff853 100644 --- a/src/conf/domain_nwfilter.h +++ b/src/conf/domain_nwfilter.h @@ -25,8 +25,7 @@ =20 int virDomainConfNWFilterInstantiate(const char *vmname, const unsigned char *vmuuid, - virDomainNetDefPtr net, - bool ignoreExists); + virDomainNetDefPtr net); void virDomainConfNWFilterTeardown(virDomainNetDefPtr net); void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm); =20 diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 33c806630b..86f7463e53 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -303,7 +303,7 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, } =20 if (net->filter && - virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) <= 0) + virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net) < 0) goto cleanup; =20 ret =3D containerVeth; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 0b84a503bb..38c74bd9b1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3435,7 +3435,7 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm, =20 if (newdev->filter && virDomainConfNWFilterInstantiate(vm->def->name, - vm->def->uuid, newdev, false) < 0= ) { + vm->def->uuid, newdev) < 0) { virErrorPtr errobj; =20 virReportError(VIR_ERR_OPERATION_FAILED, @@ -3444,7 +3444,7 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm, olddev->ifname); virErrorPreserveLast(&errobj); ignore_value(virDomainConfNWFilterInstantiate(vm->def->name, - vm->def->uuid, oldde= v, false)); + vm->def->uuid, oldde= v)); virErrorRestore(&errobj); return -1; } diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index a3f13093f5..5d54a85c53 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -467,7 +467,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, goto cleanup; =20 if (net->filter && - virDomainConfNWFilterInstantiate(def->name, def->uuid, net, false)= < 0) { + virDomainConfNWFilterInstantiate(def->name, def->uuid, net) < 0) { goto cleanup; } =20 @@ -586,7 +586,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def, goto cleanup; =20 if (net->filter && - virDomainConfNWFilterInstantiate(def->name, def->uuid, net, false)= < 0) { + virDomainConfNWFilterInstantiate(def->name, def->uuid, net) < 0) { goto cleanup; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ab749389ee..48d9bab128 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3160,22 +3160,30 @@ qemuProcessNotifyNets(virDomainDefPtr def) } } =20 -static int -qemuProcessFiltersInstantiate(virDomainDefPtr def, bool ignoreExists) + +/* Attempt to instantiate the filters. Ignore failures because it's + * (primarily) possible that a filter binding either already exists + * or someone deleted it and the associated filter while the guest + * was running and we don't want that action to cause failure to + * keep the guest running during the reconnection processing. */ +static void +qemuProcessFiltersInstantiate(virDomainDefPtr def) { size_t i; =20 for (i =3D 0; i < def->nnets; i++) { virDomainNetDefPtr net =3D def->nets[i]; if ((net->filter) && (net->ifname)) { - if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net= , ignoreExists) < 0) - return 1; + if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net= ) < 0) { + VIR_INFO("filter '%s' instantiation for '%s' failed '%s'", + net->filter, net->ifname, virGetLastErrorMessage(= )); + virResetLastError(); + } } } - - return 0; } =20 + static int qemuProcessUpdateState(virQEMUDriverPtr driver, virDomainObjPtr vm) { @@ -7892,8 +7900,7 @@ qemuProcessReconnect(void *opaque) =20 qemuProcessNotifyNets(obj->def); =20 - if (qemuProcessFiltersInstantiate(obj->def, true)) - goto error; + qemuProcessFiltersInstantiate(obj->def); =20 if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index f116e619ef..9c548f0e80 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -137,7 +137,7 @@ umlConnectTapDevice(virDomainDefPtr vm, } =20 if (net->filter) { - if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, fals= e) < 0) { + if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net) < 0)= { if (template_ifname) VIR_FREE(net->ifname); goto error; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list