From patchwork Fri Jan 22 19:30:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 60191 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp51247lbb; Fri, 22 Jan 2016 11:33:13 -0800 (PST) X-Received: by 10.140.91.66 with SMTP id y60mr5941630qgd.20.1453491191968; Fri, 22 Jan 2016 11:33:11 -0800 (PST) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id e132si8555543qhc.70.2016.01.22.11.33.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 11:33:11 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUs2r010368; Fri, 22 Jan 2016 14:30:54 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUjof019934 for ; Fri, 22 Jan 2016 14:30:45 -0500 Received: from colepc.redhat.com (ovpn-113-198.phx2.redhat.com [10.3.113.198]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MJUaPW002518; Fri, 22 Jan 2016 14:30:44 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 22 Jan 2016 14:30:24 -0500 Message-Id: <887ffa9d39399d2692697570ce93dcb0079d7a6a.1453489952.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/17] qemu: command: drop QEMU_CAPS_DEVICE for net cli 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 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com -net none is never required anymore, even platforms that can't use -device abide -nodefaults. Additionally we conditionalized the cli building on nnets != 0, but that was redundant. --- src/qemu/qemu_command.c | 72 +++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 39 deletions(-) -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a943d69..55c869e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9276,6 +9276,7 @@ qemuBuildCommandLine(virConnectPtr conn, virBuffer fdc_opts = VIR_BUFFER_INITIALIZER; char *fdc_opts_str = NULL; int bootCD = 0, bootFloppy = 0, bootDisk = 0, bootHostdevNet = 0; + int bootNet = 0; VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d " @@ -10228,53 +10229,46 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (!def->nnets) { - /* If we have -device, then we set -nodefault already */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - virCommandAddArgList(cmd, "-net", "none", NULL); - } else { - int bootNet = 0; - if (emitBootindex) { - /* convert to bootindex since we didn't emit - * -boot n - */ - for (i = 0; i < def->os.nBootDevs; i++) { - if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_NET) { - bootNet = i + 1; - break; - } + if (emitBootindex) { + /* convert to bootindex since we didn't emit + * -boot n + */ + for (i = 0; i < def->os.nBootDevs; i++) { + if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_NET) { + bootNet = i + 1; + break; } } + } - for (i = 0; i < def->nnets; i++) { - virDomainNetDefPtr net = def->nets[i]; - int vlan; + for (i = 0; i < def->nnets; i++) { + virDomainNetDefPtr net = def->nets[i]; + int vlan; - /* VLANs are not used with -netdev, so don't record them */ - if (qemuDomainSupportsNetdev(def, qemuCaps, net)) - vlan = -1; - else - vlan = i; + /* VLANs are not used with -netdev, so don't record them */ + if (qemuDomainSupportsNetdev(def, qemuCaps, net)) + vlan = -1; + else + vlan = i; - if (qemuBuildInterfaceCommandLine(cmd, driver, def, net, - qemuCaps, vlan, bootNet, vmop, - standalone, nnicindexes, nicindexes) < 0) - goto error; + if (qemuBuildInterfaceCommandLine(cmd, driver, def, net, + qemuCaps, vlan, bootNet, vmop, + standalone, nnicindexes, nicindexes) < 0) + goto error; - last_good_net = i; - /* if this interface is a type='hostdev' interface and we - * haven't yet added a "bootindex" parameter to an - * emulated network device, save the bootindex - hostdev - * interface commandlines will be built later on when we - * cycle through all the hostdevs, and we'll use it then. - */ - if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_HOSTDEV && - bootHostdevNet == 0) { - bootHostdevNet = bootNet; - } - bootNet = 0; + last_good_net = i; + /* if this interface is a type='hostdev' interface and we + * haven't yet added a "bootindex" parameter to an + * emulated network device, save the bootindex - hostdev + * interface commandlines will be built later on when we + * cycle through all the hostdevs, and we'll use it then. + */ + if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_HOSTDEV && + bootHostdevNet == 0) { + bootHostdevNet = bootNet; } + bootNet = 0; } if (def->nsmartcards) {