From nobody Tue Apr 30 22:51:25 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 1529426490657341.9721997454983; Tue, 19 Jun 2018 09:41:30 -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 3CDC4308A973; Tue, 19 Jun 2018 16:41:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF7015D9C5; Tue, 19 Jun 2018 16:41: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 A27694A46C; Tue, 19 Jun 2018 16:41:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5JGfEe2011275 for ; Tue, 19 Jun 2018 12:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDAAC2018062; Tue, 19 Jun 2018 16:41:13 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3EAB2026D68; Tue, 19 Jun 2018 16:41:13 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Jun 2018 12:40:47 -0400 Message-Id: <9f395feb77f34ec3d8d6aafcea6b534de93b2890.1529426092.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] qemu: command: Make qemuBuildNicStr static 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.41]); Tue, 19 Jun 2018 16:41:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It doesn't have any external callers Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_command.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 20c6ac2a04..4625851dc5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3352,7 +3352,7 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) } =20 =20 -char * +static char * qemuBuildNicStr(virDomainNetDefPtr net, const char *prefix, int vlan) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index da75645ac5..0bcbf3018b 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -92,11 +92,6 @@ char *qemuBuildHostNetStr(virDomainNetDefPtr net, char **vhostfd, size_t vhostfdSize); =20 -/* Legacy, pre device support */ -char *qemuBuildNicStr(virDomainNetDefPtr net, - const char *prefix, - int vlan); - /* Current, best practice */ char *qemuBuildNicDevStr(virDomainDefPtr def, virDomainNetDefPtr net, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 22:51:25 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 1529426479761714.3165235888957; Tue, 19 Jun 2018 09:41:19 -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 294DE308FB8B; Tue, 19 Jun 2018 16:41:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7F6E600C0; Tue, 19 Jun 2018 16:41:17 +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 AD6444A464; Tue, 19 Jun 2018 16:41:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5JGfERE011280 for ; Tue, 19 Jun 2018 12:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DF0E2018076; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03DA32026D68; Tue, 19 Jun 2018 16:41:13 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Jun 2018 12:40:48 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/6] qemu: command: Rename BuildNicStr to BuildLegacyNicStr 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 19 Jun 2018 16:41:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Makes it less ambiguous Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4625851dc5..f7038a8c5e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3353,9 +3353,9 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) =20 =20 static char * -qemuBuildNicStr(virDomainNetDefPtr net, - const char *prefix, - int vlan) +qemuBuildLegacyNicStr(virDomainNetDefPtr net, + const char *prefix, + int vlan) { char *str; char macaddr[VIR_MAC_STRING_BUFLEN]; @@ -8517,7 +8517,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else { - if (!(nic =3D qemuBuildNicStr(net, "nic,", vlan))) + if (!(nic =3D qemuBuildLegacyNicStr(net, "nic,", vlan))) goto cleanup; virCommandAddArgList(cmd, "-net", nic, NULL); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 22:51:25 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 1529426495528101.39492176632723; Tue, 19 Jun 2018 09:41:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D0C4356DE; Tue, 19 Jun 2018 16:41:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21DB0308332C; Tue, 19 Jun 2018 16:41:34 +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 BAE7E41091; Tue, 19 Jun 2018 16:41:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5JGfEXd011290 for ; Tue, 19 Jun 2018 12:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42D002018061; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 290622026D68; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Jun 2018 12:40:49 -0400 Message-Id: <439f1d8e3e1e6ff7e5ac3e71931e27c24e4acaf3.1529426092.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] qemu: command: remove unused LegacyNicStr arg 'prefix' 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 19 Jun 2018 16:41:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Hardcode the only string that's passed in Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f7038a8c5e..31a0b7761a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3354,15 +3354,13 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) =20 static char * qemuBuildLegacyNicStr(virDomainNetDefPtr net, - const char *prefix, int vlan) { char *str; char macaddr[VIR_MAC_STRING_BUFLEN]; =20 ignore_value(virAsprintf(&str, - "%smacaddr=3D%s,vlan=3D%d%s%s%s%s", - prefix ? prefix : "", + "nic,macaddr=3D%s,vlan=3D%d%s%s%s%s", virMacAddrFormat(&net->mac, macaddr), vlan, (net->model ? ",model=3D" : ""), @@ -8517,7 +8515,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else { - if (!(nic =3D qemuBuildLegacyNicStr(net, "nic,", vlan))) + if (!(nic =3D qemuBuildLegacyNicStr(net, vlan))) goto cleanup; virCommandAddArgList(cmd, "-net", nic, NULL); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 22:51:25 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 152942647971263.3796978067179; Tue, 19 Jun 2018 09:41:19 -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 2A7DA83F3E; Tue, 19 Jun 2018 16:41:18 +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 BEDAF5D9C5; Tue, 19 Jun 2018 16:41:17 +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 2EC171800538; Tue, 19 Jun 2018 16:41:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5JGfEWs011289 for ; Tue, 19 Jun 2018 12:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 668812018077; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D55C2026D68; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Jun 2018 12:40:50 -0400 Message-Id: <0d6bfcf551588a39759879580fb8ab0163fbe589.1529426092.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/6] qemu: command: replace vlan= with netdev= for legacy nic 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.27]); Tue, 19 Jun 2018 16:41:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" VMs with hardcoded platform network devices are forced to use old style '-net nic' command line config. Current we use qemu's vlan option to hook this with the '-netdev' host side of things. However since qemu 1.2 there is '-net nic,netdev=3DX' option for explicitly referencing a netdev ID, which is more inline with typical VM commandlines, so let's switch to that Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 52 ++++++------------- .../arm-vexpressa9-basic.args | 4 +- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 31a0b7761a..a2687c5693 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3354,15 +3354,15 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) =20 static char * qemuBuildLegacyNicStr(virDomainNetDefPtr net, - int vlan) + int vlan ATTRIBUTE_UNUSED) { char *str; char macaddr[VIR_MAC_STRING_BUFLEN]; =20 ignore_value(virAsprintf(&str, - "nic,macaddr=3D%s,vlan=3D%d%s%s%s%s", + "nic,macaddr=3D%s,netdev=3Dhost%s%s%s%s%s", virMacAddrFormat(&net->mac, macaddr), - vlan, + net->info.alias, (net->model ? ",model=3D" : ""), (net->model ? net->model : ""), (net->info.alias ? ",name=3D" : ""), @@ -3374,7 +3374,7 @@ qemuBuildLegacyNicStr(virDomainNetDefPtr net, char * qemuBuildNicDevStr(virDomainDefPtr def, virDomainNetDefPtr net, - int vlan, + int vlan ATTRIBUTE_UNUSED, unsigned int bootindex, size_t vhostfdSize, virQEMUCapsPtr qemuCaps) @@ -3523,10 +3523,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",host_mtu=3D%u", net->mtu); } =20 - if (vlan =3D=3D -1) - virBufferAsprintf(&buf, ",netdev=3Dhost%s", net->info.alias); - else - virBufferAsprintf(&buf, ",vlan=3D%d", vlan); + virBufferAsprintf(&buf, ",netdev=3Dhost%s", net->info.alias); virBufferAsprintf(&buf, ",id=3D%s", net->info.alias); virBufferAsprintf(&buf, ",mac=3D%s", virMacAddrFormat(&net->mac, macaddr)); @@ -3555,7 +3552,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, char * qemuBuildHostNetStr(virDomainNetDefPtr net, virQEMUDriverPtr driver, - int vlan, + int vlan ATTRIBUTE_UNUSED, char **tapfd, size_t tapfdSize, char **vhostfd, @@ -3670,13 +3667,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, break; } =20 - if (vlan >=3D 0) { - virBufferAsprintf(&buf, "vlan=3D%d,", vlan); - if (net->info.alias) - virBufferAsprintf(&buf, "name=3Dhost%s,", net->info.alias); - } else { - virBufferAsprintf(&buf, "id=3Dhost%s,", net->info.alias); - } + virBufferAsprintf(&buf, "id=3Dhost%s,", net->info.alias); =20 if (is_tap) { if (vhostfdSize) { @@ -8494,22 +8485,20 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driv= er, goto cleanup; } =20 + if (!(host =3D qemuBuildHostNetStr(net, driver, + vlan, + tapfdName, tapfdSize, + vhostfdName, vhostfdSize))) + goto cleanup; + virCommandAddArgList(cmd, "-netdev", host, NULL); + /* Possible combinations: * - * 1. Old way: -net nic,model=3De1000,vlan=3D1 -net tap,vlan=3D1 - * 2. New way: -netdev type=3Dtap,id=3Dnetdev1 -device e1000,id=3Dn= etdev1 - * - * NB: The backend and frontend are reversed above + * Old way: -netdev type=3Dtap,id=3Dnetdev1 \ + * -net nic,model=3De1000,netdev=3Dnetdev1 + * New way: -netdev type=3Dtap,id=3Dnetdev1 -device e1000,id=3Dnetde= v1 */ - if (qemuDomainSupportsNicdev(def, net)) { - if (!(host =3D qemuBuildHostNetStr(net, driver, - vlan, - tapfdName, tapfdSize, - vhostfdName, vhostfdSize))) - goto cleanup; - virCommandAddArgList(cmd, "-netdev", host, NULL); - if (!(nic =3D qemuBuildNicDevStr(def, net, vlan, bootindex, vhostfdSize, qemuCaps))) goto cleanup; @@ -8518,13 +8507,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr drive= r, if (!(nic =3D qemuBuildLegacyNicStr(net, vlan))) goto cleanup; virCommandAddArgList(cmd, "-net", nic, NULL); - - if (!(host =3D qemuBuildHostNetStr(net, driver, - vlan, - tapfdName, tapfdSize, - vhostfdName, vhostfdSize))) - goto cleanup; - virCommandAddArgList(cmd, "-net", host, NULL); } =20 ret =3D 0; diff --git a/tests/qemuxml2argvdata/arm-vexpressa9-basic.args b/tests/qemux= ml2argvdata/arm-vexpressa9-basic.args index d9689b8ea8..1821ed4d38 100644 --- a/tests/qemuxml2argvdata/arm-vexpressa9-basic.args +++ b/tests/qemuxml2argvdata/arm-vexpressa9-basic.args @@ -27,7 +27,7 @@ server,nowait \ -dtb /arm.dtb \ -usb \ -drive file=3D/arm.raw,format=3Draw,if=3Dsd,index=3D0 \ --net nic,macaddr=3D52:54:00:09:a4:37,vlan=3D0,model=3Dlan9118,name=3Dnet0 \ --net user,vlan=3D0,name=3Dhostnet0 \ +-netdev user,id=3Dhostnet0 \ +-net nic,macaddr=3D52:54:00:09:a4:37,netdev=3Dhostnet0,model=3Dlan9118,nam= e=3Dnet0 \ -chardev pty,id=3Dcharserial0 \ -serial chardev:charserial0 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 22:51:25 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 1529426491496983.6597684797877; Tue, 19 Jun 2018 09:41: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 4A37FC04AC53; Tue, 19 Jun 2018 16:41:29 +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 03A06308BDB2; Tue, 19 Jun 2018 16:41:29 +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 A3860180053B; Tue, 19 Jun 2018 16:41:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5JGfE9D011291 for ; Tue, 19 Jun 2018 12:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8BC022018078; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 712592026D68; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Jun 2018 12:40:51 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/6] qemu: Remove vlan function arguments 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.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.31]); Tue, 19 Jun 2018 16:41:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" They are all unused now Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 23 +++++------------------ src/qemu/qemu_command.h | 3 --- src/qemu/qemu_hotplug.c | 3 +-- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a2687c5693..f2dbb3fadd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3353,8 +3353,7 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) =20 =20 static char * -qemuBuildLegacyNicStr(virDomainNetDefPtr net, - int vlan ATTRIBUTE_UNUSED) +qemuBuildLegacyNicStr(virDomainNetDefPtr net) { char *str; char macaddr[VIR_MAC_STRING_BUFLEN]; @@ -3374,7 +3373,6 @@ qemuBuildLegacyNicStr(virDomainNetDefPtr net, char * qemuBuildNicDevStr(virDomainDefPtr def, virDomainNetDefPtr net, - int vlan ATTRIBUTE_UNUSED, unsigned int bootindex, size_t vhostfdSize, virQEMUCapsPtr qemuCaps) @@ -3552,7 +3550,6 @@ qemuBuildNicDevStr(virDomainDefPtr def, char * qemuBuildHostNetStr(virDomainNetDefPtr net, virQEMUDriverPtr driver, - int vlan ATTRIBUTE_UNUSED, char **tapfd, size_t tapfdSize, char **vhostfd, @@ -8194,7 +8191,6 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, } =20 if (!(netdev =3D qemuBuildHostNetStr(net, driver, - -1, NULL, 0, NULL, 0))) goto error; =20 @@ -8210,7 +8206,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, virCommandAddArg(cmd, netdev); VIR_FREE(netdev); =20 - if (!(nic =3D qemuBuildNicDevStr(def, net, -1, bootindex, + if (!(nic =3D qemuBuildNicDevStr(def, net, bootindex, queues, qemuCaps))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Error generating NIC -device string")); @@ -8239,7 +8235,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, virDomainDefPtr def, virDomainNetDefPtr net, virQEMUCapsPtr qemuCaps, - int vlan, unsigned int bootindex, virNetDevVPortProfileOp vmop, bool standalone, @@ -8486,7 +8481,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, } =20 if (!(host =3D qemuBuildHostNetStr(net, driver, - vlan, tapfdName, tapfdSize, vhostfdName, vhostfdSize))) goto cleanup; @@ -8499,12 +8493,12 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driv= er, * New way: -netdev type=3Dtap,id=3Dnetdev1 -device e1000,id=3Dnetde= v1 */ if (qemuDomainSupportsNicdev(def, net)) { - if (!(nic =3D qemuBuildNicDevStr(def, net, vlan, bootindex, + if (!(nic =3D qemuBuildNicDevStr(def, net, bootindex, vhostfdSize, qemuCaps))) goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else { - if (!(nic =3D qemuBuildLegacyNicStr(net, vlan))) + if (!(nic =3D qemuBuildLegacyNicStr(net))) goto cleanup; virCommandAddArgList(cmd, "-net", nic, NULL); } @@ -8577,16 +8571,9 @@ qemuBuildNetCommandLine(virQEMUDriverPtr driver, =20 for (i =3D 0; i < def->nnets; i++) { virDomainNetDefPtr net =3D def->nets[i]; - int vlan; - - /* VLANs are not used with -netdev and -device, so don't recor= d them */ - if (qemuDomainSupportsNicdev(def, net)) - vlan =3D -1; - else - vlan =3D i; =20 if (qemuBuildInterfaceCommandLine(driver, logManager, cmd, def= , net, - qemuCaps, vlan, bootNet, vmo= p, + qemuCaps, bootNet, vmop, standalone, nnicindexes, nicindexes, chardevStdioLogd) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 0bcbf3018b..c78282eb09 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -83,10 +83,8 @@ qemuBuildChrDeviceStr(char **deviceStr, virDomainChrDefPtr chr, virQEMUCapsPtr qemuCaps); =20 -/* With vlan =3D=3D -1, use netdev syntax, else old hostnet */ char *qemuBuildHostNetStr(virDomainNetDefPtr net, virQEMUDriverPtr driver, - int vlan, char **tapfd, size_t tapfdSize, char **vhostfd, @@ -95,7 +93,6 @@ char *qemuBuildHostNetStr(virDomainNetDefPtr net, /* Current, best practice */ char *qemuBuildNicDevStr(virDomainDefPtr def, virDomainNetDefPtr net, - int vlan, unsigned int bootindex, size_t vhostfdSize, virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7c0c366b99..7a1bbc7c8c 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -994,7 +994,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, } =20 if (!(netstr =3D qemuBuildHostNetStr(net, driver, - -1, tapfdName, tapfdSize, vhostfdName, vhostfdSize))) goto cleanup; @@ -1027,7 +1026,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, for (i =3D 0; i < vhostfdSize; i++) VIR_FORCE_CLOSE(vhostfd[i]); =20 - if (!(nicstr =3D qemuBuildNicDevStr(vm->def, net, -1, 0, + if (!(nicstr =3D qemuBuildNicDevStr(vm->def, net, 0, queueSize, priv->qemuCaps))) goto try_remove; =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 22:51:25 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 1529426500768835.3506875776465; Tue, 19 Jun 2018 09:41:40 -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 5923B13AA4; Tue, 19 Jun 2018 16:41:39 +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 1FE165D9C7; Tue, 19 Jun 2018 16:41:39 +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 BFA4518052EA; Tue, 19 Jun 2018 16:41:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5JGfECw011292 for ; Tue, 19 Jun 2018 12:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE479201807A; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94A882026D68; Tue, 19 Jun 2018 16:41:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Jun 2018 12:40:52 -0400 Message-Id: <9db0a71c70e54b2774892ef62cfa1c12bf4ee717.1529426092.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/6] qemu: command: vhost: cleanup error reporting 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]); Tue, 19 Jun 2018 16:41:40 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" - Switch to cleanup: label and share free calls - Don't overwrite qemuBuildNicDevStr error Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f2dbb3fadd..1ffcb5b1ae 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8147,11 +8147,12 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driv= er, char *netdev =3D NULL; unsigned int queues =3D net->driver.virtio.queues; char *nic =3D NULL; + int ret =3D -1; =20 if (!qemuDomainSupportsNicdev(def, net)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Nicdev support unavailable")); - goto error; + goto cleanup; } =20 switch ((virDomainChrType)net->data.vhostuser->type) { @@ -8160,7 +8161,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, net->data.vhostuser, net->info.alias, qemuCaps, = false, chardevStdioLogd))) - goto error; + goto cleanup; break; =20 case VIR_DOMAIN_CHR_TYPE_NULL: @@ -8179,7 +8180,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, virReportError(VIR_ERR_INTERNAL_ERROR, _("vhost-user type '%s' not supported"), virDomainChrTypeToString(net->data.vhostuser->type)= ); - goto error; + goto cleanup; } =20 if (queues > 1 && @@ -8187,45 +8188,38 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driv= er, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("multi-queue is not supported for vhost-user " "with this QEMU binary")); - goto error; + goto cleanup; } =20 if (!(netdev =3D qemuBuildHostNetStr(net, driver, NULL, 0, NULL, 0))) - goto error; + goto cleanup; =20 if (virNetDevOpenvswitchGetVhostuserIfname(net->data.vhostuser->data.n= ix.path, &net->ifname) < 0) - goto error; + goto cleanup; =20 virCommandAddArg(cmd, "-chardev"); virCommandAddArg(cmd, chardev); - VIR_FREE(chardev); =20 virCommandAddArg(cmd, "-netdev"); virCommandAddArg(cmd, netdev); - VIR_FREE(netdev); =20 if (!(nic =3D qemuBuildNicDevStr(def, net, bootindex, queues, qemuCaps))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error generating NIC -device string")); - goto error; + goto cleanup; } =20 virCommandAddArgList(cmd, "-device", nic, NULL); - VIR_FREE(nic); - virObjectUnref(cfg); =20 - return 0; - - error: + ret =3D 0; + cleanup: virObjectUnref(cfg); VIR_FREE(netdev); VIR_FREE(chardev); VIR_FREE(nic); =20 - return -1; + return ret; } =20 static int --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list