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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-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(-)

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) {
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]