mirror of
https://github.com/GNS3/gns3-server
synced 2025-05-22 00:38:50 +00:00
Fix adding pci_bridges to qemu vms
* Offset pci_device_id for network devices by 32 (formerly 4) to reserve first 32 IDs for non-netdev devices * This implies a new pci_bridge for the netdevs and the pci_device_ids starting at 0 (using modulo) * Fixes a bug in the creation of the qemu command when the number of qemu pcie devices (storage_controller, disks, …) was greater than 4 and the number of network devices saturated the 32 pcie ids of the root bridge causing qemu not to start.
This commit is contained in:
parent
d9dcc2738d
commit
cdf819f820
@ -2445,7 +2445,12 @@ class QemuVM(BaseNode):
|
||||
) # we do not want any user networking back-end if no adapter is connected.
|
||||
|
||||
# Each 32 PCI device we need to add a PCI bridge with max 9 bridges
|
||||
pci_devices = 4 + len(self._ethernet_adapters) # 4 PCI devices are use by default by qemu
|
||||
# Reserve 32 devices on root pci_bridge,
|
||||
# since the number of devices used by templates may differ significantly
|
||||
# and pci_bridges also consume IDs.
|
||||
# Move network devices to their own bridge
|
||||
pci_devices_reserved = 32
|
||||
pci_devices = pci_devices_reserved + len(self._ethernet_adapters)
|
||||
pci_bridges = math.floor(pci_devices / 32)
|
||||
pci_bridges_created = 0
|
||||
if pci_bridges >= 1:
|
||||
@ -2454,7 +2459,7 @@ class QemuVM(BaseNode):
|
||||
"Qemu version 2.4 or later is required to run this VM with a large number of network adapters"
|
||||
)
|
||||
|
||||
pci_device_id = 4 + pci_bridges # Bridge consume PCI ports
|
||||
pci_device_id = pci_devices_reserved
|
||||
for adapter_number, adapter in enumerate(self._ethernet_adapters):
|
||||
mac = int_to_macaddress(macaddress_to_int(self._mac_address) + adapter_number)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user