mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-02 08:05:14 +03:00
Revert merged changes from 2.2 introduced by PR #2607
This commit is contained in:
parent
c5b9f379fe
commit
60abbade27
@ -2438,31 +2438,13 @@ 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
|
||||
# Count PCI devices: 4 default + disks (virtio/sata/nvme/scsi) + network adapters
|
||||
pci_disk_devices = 0
|
||||
for drive in ["a", "b", "c", "d"]:
|
||||
# config disk replaces hdd when enabled
|
||||
if drive == "d" and self._create_config_disk:
|
||||
continue
|
||||
if getattr(self, "_hd{}_disk_image".format(drive)):
|
||||
interface = getattr(self, "_hd{}_disk_interface".format(drive))
|
||||
# virtio, sata, nvme, and scsi each consume 1 PCI slot; ide and none don't
|
||||
if interface not in ("none", "ide"):
|
||||
pci_disk_devices += 1
|
||||
# config disk (replaces hdd) also consumes a PCI slot if created
|
||||
if self._create_config_disk and self.config_disk_image:
|
||||
interface = self.hdd_disk_interface if self.hdd_disk_interface != "none" else self.hda_disk_interface
|
||||
if interface not in ("none", "ide"):
|
||||
pci_disk_devices += 1
|
||||
|
||||
pci_devices = 4 + pci_disk_devices + len(self._ethernet_adapters)
|
||||
pci_bridges = math.floor(pci_devices / 32)
|
||||
# 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_bridges_created = 0
|
||||
if pci_bridges >= 1:
|
||||
if self._qemu_version and parse_version(self._qemu_version) < parse_version("2.4.0"):
|
||||
raise QemuError("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 + pci_disk_devices # Bridges and disks 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…
x
Reference in New Issue
Block a user