Skip to content

Commit

Permalink
Dpdk/Rdma Installer: ensure installer runs and asset_path is set
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgov committed Oct 14, 2024
1 parent 4c0fd46 commit 951605e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
13 changes: 5 additions & 8 deletions microsoft/testsuites/dpdk/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def download(self) -> PurePath:
self._git_repo,
cwd=self._node.get_working_path(),
ref=self._git_ref,
fail_on_exists=True,
fail_on_exists=False,
)
return self.asset_path

Expand Down Expand Up @@ -139,7 +139,6 @@ def download(self) -> PurePath:
self._tar_url,
file_path=str(work_path),
overwrite=False,
force_run=True,
)
remote_path = node.get_pure_path(tarfile)
self.tar_filename = remote_path.name
Expand Down Expand Up @@ -171,8 +170,10 @@ class Installer:

# setup the node before starting
# ex: updating the kernel, enabling features, checking drivers, etc.
# First we download the assets to ensure asset_path is set
# even if we end up skipping re-installation
def _setup_node(self) -> None:
raise NotImplementedError(f"_setup_node {self._err_msg}")
self._download_assets()

# check if the package is already installed:
# Is the package installed from source? Or from the package manager?
Expand All @@ -189,7 +190,7 @@ def _download_assets(self) -> None:

# do the build and installation
def _install(self) -> None:
self._download_assets()
...

# remove an installation
def _uninstall(self) -> None:
Expand Down Expand Up @@ -269,10 +270,6 @@ def _check_if_installed(self) -> bool:
break
return True

# installing dependencies is the installation in this case, so just return
def _install(self) -> None:
return


def force_dpdk_default_source(variables: Dict[str, Any]) -> None:
if not variables.get("dpdk_source", None):
Expand Down
7 changes: 6 additions & 1 deletion microsoft/testsuites/dpdk/dpdktestpmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def _setup_node(self) -> None:
elif isinstance(self._os, Fedora):
self._os.install_epel()

# super setup node last in this case, since we must set
# repo args before download/install
super()._setup_node()

def get_installed_version(self) -> VersionInfo:
return self._os.get_package_information("dpdk", use_cached=False)

Expand Down Expand Up @@ -197,6 +201,7 @@ def _check_if_installed(self) -> bool:
return False

def _setup_node(self) -> None:
super()._setup_node()
if isinstance(self._os, Debian):
self._package_manager_extra_args = get_debian_backport_repo_args(self._os)
if isinstance(self._os, Ubuntu) and self._os.information.version < "22.4.0":
Expand Down Expand Up @@ -299,7 +304,7 @@ def download(self) -> PurePath:
self._git_ref = git.get_tag(
self.asset_path, filter_=r"^v.*" # starts w 'v'
)
git.checkout(self._git_ref, cwd=self.asset_path)
git.checkout(self._git_ref, cwd=self.asset_path, force_run=False)
return self.asset_path


Expand Down
5 changes: 5 additions & 0 deletions microsoft/testsuites/dpdk/dpdkutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ def initialize_node_resources(
sample_apps=sample_apps,
force_net_failsafe_pmd=force_net_failsafe_pmd,
)
# Tools will skip installation if the binary is present, so
# force invoke install. Installer will skip if the correct
# *type* of installation is already installed,
# taking it's creation arguments into account.
testpmd.install()

# init and enable hugepages (required by dpdk)
hugepages = node.tools[Hugepages]
Expand Down
5 changes: 2 additions & 3 deletions microsoft/testsuites/dpdk/rdmacore.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def _setup_node(self) -> None:
self._os.install_epel()
if isinstance(self._os, Debian):
self._package_manager_extra_args = get_debian_backport_repo_args(self._os)
super()._setup_node()

def get_installed_version(self) -> VersionInfo:
return self._os.get_package_information("rdma-core", use_cached=False)
Expand All @@ -131,9 +132,6 @@ def _check_if_installed(self) -> bool:

# implement SourceInstall for DPDK
class RdmaCoreSourceInstaller(Installer):
def _download_assets(self) -> None:
super()._download_assets()

def _check_if_installed(self) -> bool:
try:
package_manager_install = self._os.package_exists("rdma-core")
Expand All @@ -154,6 +152,7 @@ def _setup_node(self) -> None:
self._os.uninstall_packages("rdma-core")
if isinstance(self._os, Fedora):
self._os.group_install_packages("Development Tools")
super()._setup_node()

def _uninstall(self) -> None:
# undo source installation (thanks ninja)
Expand Down

0 comments on commit 951605e

Please sign in to comment.