From nobody Wed May 14 12:56:47 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 1522284667004931.8016679898863; Wed, 28 Mar 2018 17:51:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF0737F6A8; Thu, 29 Mar 2018 00:51:05 +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 8847360177; Thu, 29 Mar 2018 00:51:05 +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 4BE03180BAD5; Thu, 29 Mar 2018 00:51:05 +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 w2T0oXN3012635 for ; Wed, 28 Mar 2018 20:50:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id DBC168442E; Thu, 29 Mar 2018 00:50:33 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82D638442B for ; Thu, 29 Mar 2018 00:50:33 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 29 Mar 2018 02:50:22 +0200 Message-Id: <2c3165ddfa8d68bfcbe6d53b224fa47f01e24ac3.1522284415.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 5/8] 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 29 Mar 2018 00:51:06 +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