Skip to content
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

test_setup: provide option to check VF count on cleanup #2167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions virttest/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,13 +1489,17 @@ def assign_static_ip(self):
ip_addr += 1
return True

def check_vfs_count(self):
def check_vfs_count(self, count=''):
"""
Check VFs count number according to the parameter driver_options.

:param count: no of expected vf count in string
"""
# The VF count should be multiplied with the total no.of PF's
# present, rather than fixed number of network interfaces.
expected_count = int((re.findall("(\d+)", self.driver_option)[0])) * len(self.get_pf_ids())
if not count:
count = self.driver_option
expected_count = int((re.findall("(\d+)", count)[0])) * len(self.get_pf_ids())
return (self.get_vfs_count() == expected_count)

def get_controller_type(self):
Expand Down Expand Up @@ -1578,7 +1582,7 @@ def set_vf(self, pci_pf, vf_no="0"):
# CmdError: Command 'ifconfig -a' failed (rc=1)
if int(vf_no) > 10:
time.sleep(60)
return True
return self.check_vfs_count(count=vf_no)

def remove_driver(self, driver=None):
"""
Expand Down