未验证 提交 47f96e3f 编写于 作者: C chunfu wen 提交者: GitHub

Merge pull request #2990 from chunfuwen/fix_no_more_pci_slots_in_some_cases

Fix new merged no more pci slots issue
......@@ -240,6 +240,20 @@ def run(test, params, env):
else:
device_source = device_source_name
# Add more pci controllers to avoid error: No more available PCI slots
if test_twice and params.get("add_more_pci_controllers", "yes") == "yes":
vm_dump_xml.remove_all_device_by_type('controller')
machine_list = vm_dump_xml.os.machine.split("-")
vm_dump_xml.set_os_attrs(**{"machine": machine_list[0] + "-q35-" + machine_list[2]})
q35_pcie_dict0 = {'controller_model': 'pcie-root', 'controller_type': 'pci', 'controller_index': 0}
q35_pcie_dict1 = {'controller_model': 'pcie-root-port', 'controller_type': 'pci'}
vm_dump_xml.add_device(libvirt.create_controller_xml(q35_pcie_dict0))
# Add enough controllers to match multiple times disk attaching requirements
for i in list(range(1, 15)):
q35_pcie_dict1.update({'controller_index': "%d" % i})
vm_dump_xml.add_device(libvirt.create_controller_xml(q35_pcie_dict1))
vm_dump_xml.sync()
# if we are testing audit, we need to start audit servcie first.
if test_audit:
auditd_service = Factory.create_service("auditd")
......@@ -275,20 +289,6 @@ def run(test, params, env):
device_source = libvirt.create_local_disk(
"file", path=device_source_path,
size="1", disk_format=device_source_format)
if params.get("add_more_pci_controllers", "yes") == "yes":
vm_dump_xml.remove_all_device_by_type('controller')
machine_list = vm_dump_xml.os.machine.split("-")
vm_dump_xml.set_os_attrs(**{"machine": machine_list[0] + "-q35-" + machine_list[2]})
q35_pcie_dict0 = {'controller_model': 'pcie-root', 'controller_type': 'pci', 'controller_index': 0}
q35_pcie_dict1 = {'controller_model': 'pcie-root-port', 'controller_type': 'pci'}
vm_dump_xml.add_device(libvirt.create_controller_xml(q35_pcie_dict0))
# Add enough controllers to match multiple times disk attaching requirements
for i in list(range(1, 15)):
q35_pcie_dict1.update({'controller_index': "%d" % i})
vm_dump_xml.add_device(libvirt.create_controller_xml(q35_pcie_dict1))
vm_dump_xml.sync()
s_attach = virsh.attach_disk(vm_name, device_source, device_target2,
s_at_options).exit_status
if s_attach != 0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册