[virt-tools-list] [virt-manager] [PATCH 2/2] domain: Remove the pcie-root and ports for i440fx in customized dialog
Lin Ma
lma at suse.com
Thu Sep 22 07:56:45 UTC 2022
The commit db8305ad explicitly adds pcie-root and pcie root ports for q35.
If the user selects i440FX chipset instead of Q35(default) from customize
dialog, The pre-defined pcie-root and ports cause failure when starting
i440fx VM installation because they're not applicable to i440fx..
It fails with below error message:
summary=Unable to complete install: 'XML error: The PCI controller with index='0'
must be model='pci-root' for this machine type, but model='pcie-root' was found instead'
details=Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/createvm.py", line 2088, in _do_async_install
installer.start_install(guest, meter=meter)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 737, in start_install
domain = self._create_guest(
File "/usr/share/virt-manager/virtinst/install/installer.py", line 679, in _create_guest
domain = self.conn.createXML(initial_xml or final_xml, 0)
File "/usr/lib64/python3.10/site-packages/libvirt.py", line 4442, in createXML
raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: XML error: The PCI controller with index='0' must be
model='pci-root' for this machine type, but model='pcie-root' was found instead
This patch fixes it by removing the pcie-root and ports for i440fx in
apply_overview.
Signed-off-by: Lin Ma <lma at suse.com>
---
virtManager/object/domain.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index 2d6f5bca..859f7694 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -751,6 +751,18 @@ class vmmDomain(vmmLibvirtObject):
if nvram != _SENTINEL:
guest.os.nvram = nvram
+ if guest.os.machine == "q35":
+ pcie_controllers_already_created = False
+ for dev in guest.devices.controller:
+ if dev.model in ["pcie-root", "pcie-root-port"]:
+ pcie_controllers_already_created = True
+ break
+ if not pcie_controllers_already_created:
+ guest.add_q35_pcie_controllers()
+ elif guest.os.machine == "pc":
+ for dev in guest.devices.controller:
+ if dev.model in ["pcie-root", "pcie-root-port"]:
+ guest.remove_device(dev)
self._redefine_xmlobj(guest)
def define_os(self, os_name=_SENTINEL):
--
2.37.3
More information about the virt-tools-list
mailing list