diff mbox

[09/17] qemu: command: drop QEMU_CAPS_DEVICE for net cli

Message ID 887ffa9d39399d2692697570ce93dcb0079d7a6a.1453489952.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Jan. 22, 2016, 7:30 p.m. UTC
-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

Comments

Cole Robinson Jan. 22, 2016, 7:33 p.m. UTC | #1
On 01/22/2016 02:30 PM, Cole Robinson wrote:
> -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.


Whitespace-less diff attached

- Cole
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

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 <boot dev='network'/> 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 <boot dev='network'/> 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) {