diff --git a/virttest/test_setup.py b/virttest/test_setup.py index c7c224d34f..b68bb2163c 100644 --- a/virttest/test_setup.py +++ b/virttest/test_setup.py @@ -1467,7 +1467,7 @@ def sr_iov_setup(self): time.sleep(3) re_probe = False # If driver not available after modprobe try to remove it and reprobe - if process.system("lsmod | grep %s" % self.driver, ignore_status=True, + if process.system("lsmod | grep -w %s" % self.driver, ignore_status=True, shell=True): re_probe = True # If driver is available then set VFs for ppc64le @@ -1488,7 +1488,7 @@ def sr_iov_setup(self): # Re-probe driver with proper number of VFs once more and raise # exception if re_probe: - if not self.remove_driver() and not self.modprobe_driver(): + if not self.remove_driver() or not self.modprobe_driver(): return False if ARCH == 'ppc64le' and self.driver == 'mlx5_core': set_ip = 0