From nobody Wed May 14 13:19:37 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522415797737339.78295543535955; Fri, 30 Mar 2018 06:16:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C7C47AE9D; Fri, 30 Mar 2018 13:16:36 +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 23C165D6A8; Fri, 30 Mar 2018 13:16:36 +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 A593E180BAE5; Fri, 30 Mar 2018 13:16:35 +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 w2UDGCil010420 for ; Fri, 30 Mar 2018 09:16:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0AA701C710; Fri, 30 Mar 2018 13:16:12 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A53EC6352D for ; Fri, 30 Mar 2018 13:16:11 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Fri, 30 Mar 2018 15:15:23 +0200 Message-Id: <4a55526f8a2d288da1f0cc84e278a3ba25df1447.1522415592.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/44] Clean up qemuDomainAttachNetDevice 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 30 Mar 2018 13:16:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Now that we assume -netdev support, we no longer set the VLAN or need the hostPlugged bool. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7f5c68e0c..a3e20c6e8 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -825,7 +825,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, char *nicstr =3D NULL; char *netstr =3D NULL; int ret =3D -1; - int vlan; bool releaseaddr =3D false; bool iface_connected =3D false; virDomainNetType actualType; @@ -836,7 +835,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, char *charDevAlias =3D NULL; bool charDevPlugged =3D false; bool netdevPlugged =3D false; - bool hostPlugged =3D false; + char *netdev_name; =20 /* preallocate new slot for device */ if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0) @@ -1029,7 +1028,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, =20 releaseaddr =3D true; =20 - vlan =3D -1; if (VIR_ALLOC_N(tapfdName, tapfdSize) < 0 || VIR_ALLOC_N(vhostfdName, vhostfdSize) < 0) goto cleanup; @@ -1078,7 +1076,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, for (i =3D 0; i < vhostfdSize; i++) VIR_FORCE_CLOSE(vhostfd[i]); =20 - if (!(nicstr =3D qemuBuildNicDevStr(vm->def, net, vlan, 0, + if (!(nicstr =3D qemuBuildNicDevStr(vm->def, net, -1, 0, queueSize, priv->qemuCaps))) goto try_remove; =20 @@ -1169,31 +1167,17 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto cleanup; =20 virErrorPreserveLast(&originalError); - if (vlan < 0) { - char *netdev_name; - if (virAsprintf(&netdev_name, "host%s", net->info.alias) >=3D 0) { - qemuDomainObjEnterMonitor(driver, vm); - if (charDevPlugged && - qemuMonitorDetachCharDev(priv->mon, charDevAlias) < 0) - VIR_WARN("Failed to remove associated chardev %s", charDev= Alias); - if (netdevPlugged && - qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0) - VIR_WARN("Failed to remove network backend for netdev %s", - netdev_name); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); - VIR_FREE(netdev_name); - } - } else { - char *hostnet_name; - if (virAsprintf(&hostnet_name, "host%s", net->info.alias) >=3D 0) { - qemuDomainObjEnterMonitor(driver, vm); - if (hostPlugged && - qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name= ) < 0) - VIR_WARN("Failed to remove network backend for vlan %d, ne= t %s", - vlan, hostnet_name); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); - VIR_FREE(hostnet_name); - } + if (virAsprintf(&netdev_name, "host%s", net->info.alias) >=3D 0) { + qemuDomainObjEnterMonitor(driver, vm); + if (charDevPlugged && + qemuMonitorDetachCharDev(priv->mon, charDevAlias) < 0) + VIR_WARN("Failed to remove associated chardev %s", charDevAlia= s); + if (netdevPlugged && + qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0) + VIR_WARN("Failed to remove network backend for netdev %s", + netdev_name); + ignore_value(qemuDomainObjExitMonitor(driver, vm)); + VIR_FREE(netdev_name); } virErrorRestore(&originalError); goto cleanup; --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list