From nobody Thu Nov 28 11:00:02 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 1524843391013721.1207442247231; Fri, 27 Apr 2018 08:36:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EC5E300440C; Fri, 27 Apr 2018 15:36:28 +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 34CEB314EE64; Fri, 27 Apr 2018 15:36:28 +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 71F12180BAD4; Fri, 27 Apr 2018 15:36:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3RFPOri032298 for ; Fri, 27 Apr 2018 11:25:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED887AB3EF; Fri, 27 Apr 2018 15:25:23 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33E5583B76; Fri, 27 Apr 2018 15:25:23 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 27 Apr 2018 16:25:07 +0100 Message-Id: <20180427152513.28928-9-berrange@redhat.com> In-Reply-To: <20180427152513.28928-1-berrange@redhat.com> References: <20180427152513.28928-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/14] nwfilter: pass vm name in when instantiating filters 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 27 Apr 2018 15:36:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 The vm name is not needed for any functional requirement, but it will be useful when debugging problems to identify which VM is associated with a filter, since UUID is not human friendly. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Jiri Denemark --- src/conf/domain_nwfilter.c | 5 +++-- src/conf/domain_nwfilter.h | 6 ++++-- src/lxc/lxc_process.c | 2 +- src/nwfilter/nwfilter_driver.c | 3 ++- src/qemu/qemu_hotplug.c | 6 ++++-- src/qemu/qemu_interface.c | 4 ++-- src/qemu/qemu_process.c | 2 +- src/uml/uml_conf.c | 2 +- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c index 176e7e6734..e360aceeba 100644 --- a/src/conf/domain_nwfilter.c +++ b/src/conf/domain_nwfilter.c @@ -38,11 +38,12 @@ virDomainConfNWFilterRegister(virDomainConfNWFilterDriv= erPtr driver) } =20 int -virDomainConfNWFilterInstantiate(const unsigned char *vmuuid, +virDomainConfNWFilterInstantiate(const char *vmname, + const unsigned char *vmuuid, virDomainNetDefPtr net) { if (nwfilterDriver !=3D NULL) - return nwfilterDriver->instantiateFilter(vmuuid, net); + return nwfilterDriver->instantiateFilter(vmname, vmuuid, net); /* driver module not available -- don't indicate failure */ return 0; } diff --git a/src/conf/domain_nwfilter.h b/src/conf/domain_nwfilter.h index af047c745a..857cac6c2a 100644 --- a/src/conf/domain_nwfilter.h +++ b/src/conf/domain_nwfilter.h @@ -23,7 +23,8 @@ #ifndef DOMAIN_NWFILTER_H # define DOMAIN_NWFILTER_H =20 -typedef int (*virDomainConfInstantiateNWFilter)(const unsigned char *vmuui= d, +typedef int (*virDomainConfInstantiateNWFilter)(const char *vmname, + const unsigned char *vmuui= d, virDomainNetDefPtr net); typedef void (*virDomainConfTeardownNWFilter)(virDomainNetDefPtr net); =20 @@ -35,7 +36,8 @@ typedef virDomainConfNWFilterDriver *virDomainConfNWFilte= rDriverPtr; =20 void virDomainConfNWFilterRegister(virDomainConfNWFilterDriverPtr driver); =20 -int virDomainConfNWFilterInstantiate(const unsigned char *vmuuid, +int virDomainConfNWFilterInstantiate(const char *vmname, + const unsigned char *vmuuid, virDomainNetDefPtr net); void virDomainConfNWFilterTeardown(virDomainNetDefPtr net); void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm); diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index e911d88b56..3610523c06 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -304,7 +304,7 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, } =20 if (net->filter && - virDomainConfNWFilterInstantiate(vm->uuid, net) < 0) + virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net) < 0) goto cleanup; =20 ret =3D containerVeth; diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index fef3aa272b..d17a8ec00b 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -642,7 +642,8 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter, =20 =20 static int -nwfilterInstantiateFilter(const unsigned char *vmuuid, +nwfilterInstantiateFilter(const char *vmname ATTRIBUTE_UNUSED, + const unsigned char *vmuuid, virDomainNetDefPtr net) { return virNWFilterInstantiateFilter(driver, vmuuid, net); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index df9e8aa716..3bb0c72257 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3016,7 +3016,8 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm, virDomainConfNWFilterTeardown(olddev); =20 if (newdev->filter && - virDomainConfNWFilterInstantiate(vm->def->uuid, newdev) < 0) { + virDomainConfNWFilterInstantiate(vm->def->name, + vm->def->uuid, newdev) < 0) { virErrorPtr errobj; =20 virReportError(VIR_ERR_OPERATION_FAILED, @@ -3024,7 +3025,8 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm, "- attempting to restore old rules"), olddev->ifname); virErrorPreserveLast(&errobj); - ignore_value(virDomainConfNWFilterInstantiate(vm->def->uuid, oldde= v)); + ignore_value(virDomainConfNWFilterInstantiate(vm->def->name, + vm->def->uuid, oldde= v)); virErrorRestore(&errobj); return -1; } diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index ffa4b875c0..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->uuid, net) < 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->uuid, net) < 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 6a5262ae46..9233d26948 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2952,7 +2952,7 @@ qemuProcessFiltersInstantiate(virDomainDefPtr def) for (i =3D 0; i < def->nnets; i++) { virDomainNetDefPtr net =3D def->nets[i]; if ((net->filter) && (net->ifname)) { - if (virDomainConfNWFilterInstantiate(def->uuid, net) < 0) + if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net= ) < 0) return 1; } } diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 49589b33c9..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->uuid, net) < 0) { + if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net) < 0)= { if (template_ifname) VIR_FREE(net->ifname); goto error; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list