Remove the nw unused boot-index related attributes and the code which is assigning it. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_command.c | 71 ++++++++--------------------------------- src/qemu/qemu_command.h | 2 -- src/qemu/qemu_hotplug.c | 5 ++- 3 files changed, 16 insertions(+), 62 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bb91098c76..75a30f75ff 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3699,7 +3699,6 @@ qemuBuildLegacyNicStr(virDomainNetDef *net) char * qemuBuildNicDevStr(virDomainDef *def, virDomainNetDef *net, - unsigned int bootindex G_GNUC_UNUSED, size_t vhostfdSize, virQEMUCaps *qemuCaps) { @@ -4621,7 +4620,6 @@ qemuBuildVideoCommandLine(virCommand *cmd, char * qemuBuildPCIHostdevDevStr(const virDomainDef *def, virDomainHostdevDef *dev, - unsigned int bootIndex G_GNUC_UNUSED, virQEMUCaps *qemuCaps G_GNUC_UNUSED) { g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; @@ -5389,8 +5387,7 @@ qemuBuildHostdevSCSICommandLine(virCommand *cmd, static int qemuBuildHostdevCommandLine(virCommand *cmd, const virDomainDef *def, - virQEMUCaps *qemuCaps, - unsigned int *bootHostdevNet) + virQEMUCaps *qemuCaps) { size_t i; @@ -5400,7 +5397,6 @@ qemuBuildHostdevCommandLine(virCommand *cmd, virDomainHostdevSubsysMediatedDev *mdevsrc = &subsys->u.mdev; g_autofree char *devstr = NULL; g_autofree char *vhostfdName = NULL; - unsigned int bootIndex = hostdev->info->bootIndex; int vhostfd = -1; if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) @@ -5419,14 +5415,6 @@ qemuBuildHostdevCommandLine(virCommand *cmd, /* PCI */ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - /* bootNet will be non-0 if boot order was set and no other - * net devices were encountered - */ - if (hostdev->parentnet && bootIndex == 0) { - bootIndex = *bootHostdevNet; - *bootHostdevNet = 0; - } - /* Ignore unassigned devices */ if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED) continue; @@ -5435,7 +5423,7 @@ qemuBuildHostdevCommandLine(virCommand *cmd, return -1; virCommandAddArg(cmd, "-device"); - devstr = qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex, qemuCaps); + devstr = qemuBuildPCIHostdevDevStr(def, hostdev, qemuCaps); if (!devstr) return -1; virCommandAddArg(cmd, devstr); @@ -8623,7 +8611,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, virCommand *cmd, virDomainNetDef *net, virQEMUCaps *qemuCaps, - unsigned int bootindex, virNetDevVPortProfileOp vmop, bool standalone, size_t *nnicindexes, @@ -8649,10 +8636,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, size_t i; g_autoptr(virJSONValue) hostnetprops = NULL; - - if (!bootindex) - bootindex = net->info.bootIndex; - if (qemuDomainValidateActualNetDef(net, qemuCaps) < 0) return -1; @@ -8898,8 +8881,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, if (qemuCommandAddExtDevice(cmd, &net->info) < 0) goto cleanup; - if (!(nic = qemuBuildNicDevStr(def, net, bootindex, - net->driver.virtio.queues, qemuCaps))) + if (!(nic = qemuBuildNicDevStr(def, net, net->driver.virtio.queues, qemuCaps))) goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else if (!requireNicdev) { @@ -8959,47 +8941,23 @@ qemuBuildNetCommandLine(virQEMUDriver *driver, virNetDevVPortProfileOp vmop, bool standalone, size_t *nnicindexes, - int **nicindexes, - unsigned int *bootHostdevNet) + int **nicindexes) { size_t i; int last_good_net = -1; virErrorPtr originalError = NULL; virDomainDef *def = vm->def; - if (def->nnets) { - unsigned int bootNet = 0; - - /* 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++) { - virDomainNetDef *net = def->nets[i]; + for (i = 0; i < def->nnets; i++) { + virDomainNetDef *net = def->nets[i]; - if (qemuBuildInterfaceCommandLine(driver, vm, logManager, secManager, cmd, net, - qemuCaps, bootNet, vmop, - standalone, nnicindexes, - nicindexes) < 0) - goto error; + if (qemuBuildInterfaceCommandLine(driver, vm, logManager, secManager, cmd, net, + qemuCaps, 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; } return 0; @@ -10534,7 +10492,6 @@ qemuBuildCommandLine(virQEMUDriver *driver, char uuid[VIR_UUID_STRING_BUFLEN]; g_autoptr(virCommand) cmd = NULL; g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); - unsigned int bootHostdevNet = 0; qemuDomainObjPrivate *priv = vm->privateData; virDomainDef *def = vm->def; virQEMUCaps *qemuCaps = priv->qemuCaps; @@ -10682,7 +10639,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildNetCommandLine(driver, vm, logManager, secManager, cmd, qemuCaps, vmop, standalone, - nnicindexes, nicindexes, &bootHostdevNet) < 0) + nnicindexes, nicindexes) < 0) return NULL; if (qemuBuildSmartcardCommandLine(logManager, secManager, cmd, cfg, def, qemuCaps, @@ -10730,7 +10687,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, chardevStdioLogd) < 0) return NULL; - if (qemuBuildHostdevCommandLine(cmd, def, qemuCaps, &bootHostdevNet) < 0) + if (qemuBuildHostdevCommandLine(cmd, def, qemuCaps) < 0) return NULL; if (migrateURI) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 00efcfd5fd..d59a55e8aa 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -100,7 +100,6 @@ virJSONValue *qemuBuildHostNetStr(virDomainNetDef *net, /* Current, best practice */ char *qemuBuildNicDevStr(virDomainDef *def, virDomainNetDef *net, - unsigned int bootindex, size_t vhostfdSize, virQEMUCaps *qemuCaps); @@ -169,7 +168,6 @@ qemuBuildMemoryDeviceStr(const virDomainDef *def, /* Current, best practice */ char *qemuBuildPCIHostdevDevStr(const virDomainDef *def, virDomainHostdevDef *dev, - unsigned int bootIndex, virQEMUCaps *qemuCaps); char *qemuBuildRNGDevStr(const virDomainDef *def, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1c310249e2..d5f6722d5a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1493,8 +1493,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, for (i = 0; i < vhostfdSize; i++) VIR_FORCE_CLOSE(vhostfd[i]); - if (!(nicstr = qemuBuildNicDevStr(vm->def, net, 0, - queueSize, priv->qemuCaps))) + if (!(nicstr = qemuBuildNicDevStr(vm->def, net, queueSize, priv->qemuCaps))) goto try_remove; qemuDomainObjEnterMonitor(driver, vm); @@ -1716,7 +1715,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, goto error; } - if (!(devstr = qemuBuildPCIHostdevDevStr(vm->def, hostdev, 0, priv->qemuCaps))) + if (!(devstr = qemuBuildPCIHostdevDevStr(vm->def, hostdev, priv->qemuCaps))) goto error; qemuDomainObjEnterMonitor(driver, vm); -- 2.31.1