-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCIe, Slots in pcie-root numbered [1,31] #4729
Conversation
Depends on #4709 |
d4f1d32
to
3143809
Compare
#4709 was merged. Please rebase. Thanks. |
061b796
to
d5ffd30
Compare
New tests pass on RHEL 9.2, with the exception of one:
The exception is caused by avocado-vt issue avocado-framework/avocado-vt#3630 |
d5ffd30
to
de4eb57
Compare
@dzhengfy Please review. |
wipe_devices = "yes" | ||
test_define_only = "yes" | ||
controller_address = '{"type": "pci", "domain": "0x0000", "bus": "0x00", "slot": "0x03", "function":"0x0"}' | ||
- address_slot_max_value: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this test because sata controller now is automatically inserted by libvirt. We need not to test it explicitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? Sata is being set up here to test address slot 0x1f. Because pcie-root-port cannot have slot 0x1f. So we're testing the slot not sata controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the manual case, I saw the test scenario is to test with sata controller attached to pcie-root. Currently this controller is already added by libvirt by default. The pci address is same as you defined. So when I test with your pr, I got double use for that adress. You can check your vm in your environment.
- address_slot_too_high: | ||
wipe_devices = "yes" | ||
test_define_only = "yes" | ||
controller_address = '{"type": "pci", "domain": "0x0000", "bus": "0x02", "slot": "0x20", "function":"0x0"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a checking for failure_message
|
||
if test_define_only: | ||
return | ||
|
||
index = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 34 , and 35, why not directly to use index = 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index should be 1. The line below should be deleted. Fixed.
"controller_index": index, | ||
'controller_target': target, | ||
"controller_addr": str(address)} | ||
print("contr_dict" + str(contr_dict)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line or replace with LOG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
contr_object = libvirt.create_controller_xml(contr_dict) | ||
print(contr_object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line or replace with LOG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
contr_object = libvirt.create_controller_xml(contr_dict) | ||
print(contr_object) | ||
if index == 0: | ||
contr_object.index = 0 # Workaround for non-working avocado-vt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove above 2 lines
Could you please provide all test results for |
if not check_slot_in_controller(vmxml, index, expected_value, | ||
slot_equal_after_define): | ||
test.fail("Controller slot doesn't have the" | ||
"expected value of %s.", expected_value) | ||
else: | ||
libvirt.check_exit_status(cmd_result, status_error) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move line 139 to 147 to Line 150, like:
if failure_message:
libvirt.check_result(cmd_result, [failure_message])
else:
libvirt.check_exit_status(cmd_result, status_error)
if check_slot:
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(
params.get("main_vm", "avocado-vt-vm1"))
expected_value = address["slot"]
if not check_slot_in_controller(vmxml, index, expected_value,
slot_equal_after_define):
test.fail("Controller slot doesn't have the"
"expected value of %s.", expected_value)
# We want to default to None so we can differentiate between None and 0 | ||
controller_index = params.get("controller_index", None) | ||
model = params.get("controller_model") | ||
if controller_index is not None: | ||
if controller_index == "xxx": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xxx? What's this? Did you test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is related to test pcie_root_port_controller.negative_test.controller_index_invalid. It is related to another polarion case. Check the configuration file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is random and customized. So to make it more clear, we can also use some customized value, like test, aaa...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.xxx
seems too inofficial. Usually we use a meaningful value like invalid_index
Test results from RHEL 9.2:
pcie_root_port_controller.negative_test.device_slot_wrong_number fails by virsh define being successful when failure is expected. However when I check the VM XML the related part is set up correctly:
So I think the error is in libvirt and not the script. |
de4eb57
to
9e19bfc
Compare
@vasekhodina For that failed case device_slot_wrong_number, please add for that interface device. |
@@ -125,14 +135,51 @@ def check_define_vm(vmxml, params): | |||
libvirt.check_result(cmd_result, [failure_message]) | |||
else: | |||
libvirt.check_exit_status(cmd_result, status_error) | |||
if check_slot: | |||
libvirt.check_exit_status(cmd_result, status_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this duplcated with line 137?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libvirt.check_exit_status() will be executed twice when check_slot is True.
All tests pass now on RHEL 9.2:
|
aaa4f93
to
63cf311
Compare
63cf311
to
1f57f56
Compare
@@ -190,6 +237,19 @@ def check_vm_start(vm, params, **virsh_options): | |||
libvirt.check_exit_status(cmd_result, status_error) | |||
|
|||
|
|||
def wipe_pcie_root_ports(vmxml): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use wipe_pcie_controllers(vmxml)? Because I think vmxml.remove_all_device_by_type("controller") in this function is to remove all controllers but not pcie-root-port.
index = 0 | ||
contr_dict = {"type": "pci", "model": "pcie-root", "index": index} | ||
libvirt_vmxml.modify_vm_device(vmxml, "controller", contr_dict, index) | ||
wipe_pcie_root_ports(vmxml) | ||
|
||
if test_define_only: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, what does this step do?
# We want to default to None so we can differentiate between None and 0 | ||
controller_index = params.get("controller_index", None) | ||
model = params.get("controller_model") | ||
if controller_index is not None: | ||
if controller_index == "xxx": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is random and customized. So to make it more clear, we can also use some customized value, like test, aaa...
failure_message = "Invalid PCI address .* slot must be <= 0" | ||
- controllers_same_chassis_same_port: | ||
second_controller_model = "pcie-root-port" | ||
second_controller_target = "{'chassis':1,'port':'0x8'}" | ||
index_offset = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here it means we create a pcie controller with "index='3'" in python file, and the "index='2'" will be generated automatically? For controllers_same_chassis_same_port, which codes means it has the same port?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See line 6 controller_target = '{"chassis":1,"port":"0x8"}'
Test results from RHEL 8.8:
|
1f57f56
to
276e4f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others LGTM
@@ -190,6 +238,19 @@ def check_vm_start(vm, params, **virsh_options): | |||
libvirt.check_exit_status(cmd_result, status_error) | |||
|
|||
|
|||
def wipe_pcie_controllers(vmxml): | |||
""" | |||
Function that removes all pcie-root-port devices from VM XML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the docstring also needs update.
# We want to default to None so we can differentiate between None and 0 | ||
controller_index = params.get("controller_index", None) | ||
model = params.get("controller_model") | ||
if controller_index is not None: | ||
if controller_index == "xxx": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.xxx
seems too inofficial. Usually we use a meaningful value like invalid_index
276e4f1
to
b8fd91c
Compare
This commit adds automation of tests where pcie-root-port controllers should have target with slot numbered from 1 to 31 (in hexadecimal numbers). VIRT-55414
b8fd91c
to
ddfebab
Compare
This PR adds automation of tests where pcie-root-port controllers should have target with slot numbered from 1 to 31 (in hexadecimal numbers).
VIRT-55414