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