X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=nfvbench%2Futils.py;h=94cc11d8ce4b98983876721c9b6d7925467233f2;hb=260a2ad0d1edcba289e019ac8a13706663ed6592;hp=3974fd7ca3b94697d40638668c2224c75a3bde8a;hpb=95f2491ed89ac99b0d8bd006b4a13cbeb1eb96ce;p=nfvbench.git diff --git a/nfvbench/utils.py b/nfvbench/utils.py index 3974fd7..94cc11d 100644 --- a/nfvbench/utils.py +++ b/nfvbench/utils.py @@ -113,8 +113,8 @@ def get_intel_pci(nic_slot=None, nic_ports=None): if nic_slot and nic_ports: dmidecode = subprocess.check_output(['dmidecode', '-t', 'slot']) - regex = r"(?<=SlotID:%s).*?(....:..:..\..)" % nic_slot - match = re.search(regex, dmidecode, flags=re.DOTALL) + regex = r"(?<=SlotID:{}).*?(....:..:..\..)".format(nic_slot) + match = re.search(regex, dmidecode.decode('utf-8'), flags=re.DOTALL) if not match: return None @@ -144,7 +144,7 @@ def get_intel_pci(nic_slot=None, nic_ports=None): devices = '' for driver in ['i40e', 'ixgbe']: - matches = re.findall(regex.format(hx=hx, driver=driver), devices) + matches = re.findall(regex.format(hx=hx, driver=driver), devices.decode("utf-8")) if not matches: continue @@ -160,9 +160,8 @@ def get_intel_pci(nic_slot=None, nic_ports=None): stdout=subprocess.PIPE, stderr=subprocess.PIPE) intf_info, _ = process.communicate() - if not re.search('team_slave|bond_slave', intf_info): + if not re.search('team_slave|bond_slave', intf_info.decode("utf-8")): pcis.append(port[1]) - if len(pcis) == 2: break