44 */
55
66#include < cloysterhpc/functions.h>
7+ #include < cloysterhpc/services/repos.h>
78#include < cloysterhpc/ofed.h>
89#include < utility>
910
@@ -48,47 +49,16 @@ std::string headnodeDistroName()
4849 std::unreachable ();
4950}
5051
51- void installMellanoxDoca (cloyster::services::repos::RepoManager& repoManager, const OFED& ofed)
52+ void installMellanoxDoca (const OFED& ofed)
5253{
53- auto runner = cloyster::Singleton<cloyster::services::BaseRunner>::get ();
54-
55- if (runner->executeCommand (" modprobe mlx5_core" ) == 0 ) {
56- LOG_WARN (" mlx5_core module loaded, skiping DOCA setup" );
57- return ;
58- }
59-
60- // @FIMXE deduce "rockylinux9.2"
61- auto repoData = docaRepoTemplate (ofed.getVersion (), headnodeDistroName ());
62- std::filesystem::path path = " /etc/yum.repos.d/mlx-doca.repo" ;
63-
64- // Install the repository and enable it
65- cloyster::installFile (path, repoData);
66- repoManager.install (path);
67- repoManager.enable (" doca" );
68-
69- // Install the required packages
70- runner->executeCommand (" dnf makecache" );
71- runner->executeCommand (" dnf install –y kernel kernel-devel doca-extra" );
72-
73- // Run the Mellanox script, this generates an RPM at tmp
74- assert (runner->executeCommand (" /opt/mellanox/doca/tools/doca-kernel-support -k $(rpm -q --qf \" %{VERSION}-%{RELEASE}.%{ARCH}\n\" kernel-devel" ) == 0 );
75-
76- // Install the generated rpm
77- runner->executeCommand (" rpm -ivh $(find /tmp/DOCA.*/ -name '*.rpm' -printf \" %T@ %p\n\" | sort -nrk1 | tail -1 | awk '{print $2}')" );
78-
79- runner->executeCommand (" dnf makecache" );
80- runner->executeCommand (" dnf install –y kernel kernel-devel doca-extra" );
81- if (runner->executeCommand (" lsmod | grep mlx5_core" ) != 0 ) {
82- runner->executeCommand (" modprobe mlx_core" );
83- }
8454}
8555};
8656
8757void OFED::setKind (Kind kind) { m_kind = kind; }
8858
8959OFED::Kind OFED::getKind () const { return m_kind; }
9060
91- void OFED::install (cloyster::services::repos::RepoManager& repoManager ) const
61+ void OFED::install () const
9262{
9363 switch (m_kind) {
9464 case OFED::Kind::Inbox:
@@ -97,8 +67,40 @@ void OFED::install(cloyster::services::repos::RepoManager& repoManager) const
9767 break ;
9868
9969 case OFED::Kind::Mellanox:
100- installMellanoxDoca (repoManager, *this );
70+ {
71+ auto runner = cloyster::Singleton<cloyster::services::BaseRunner>::get ();
72+ auto repoManager = cloyster::Singleton<cloyster::services::repos::RepoManager>::get ();
73+
74+ if (runner->executeCommand (" modprobe mlx5_core" ) == 0 ) {
75+ LOG_WARN (" mlx5_core module loaded, skiping DOCA setup" );
76+ return ;
77+ }
78+
79+ auto repoData = docaRepoTemplate (getVersion (), headnodeDistroName ());
80+ std::filesystem::path path = " /etc/yum.repos.d/mlx-doca.repo" ;
81+
82+ // Install the repository and enable it
83+ cloyster::installFile (path, repoData);
84+ repoManager->install (path);
85+ repoManager->enable (" doca" );
86+
87+ // Install the required packages
88+ runner->executeCommand (" dnf makecache" );
89+ runner->executeCommand (" dnf install –y kernel kernel-devel doca-extra" );
90+
91+ // Run the Mellanox script, this generates an RPM at tmp
92+ assert (runner->executeCommand (" /opt/mellanox/doca/tools/doca-kernel-support -k $(rpm -q --qf \" %{VERSION}-%{RELEASE}.%{ARCH}\n\" kernel-devel" ) == 0 );
93+
94+ // Install the (last) generated rpm
95+ runner->executeCommand (" rpm -ivh $(find /tmp/DOCA.*/ -name '*.rpm' -printf \" %T@ %p\n\" | sort -nrk1 | tail -1 | awk '{print $2}')" );
96+
97+ runner->executeCommand (" dnf makecache" );
98+ runner->executeCommand (" dnf install –y kernel kernel-devel doca-extra" );
99+ if (runner->executeCommand (" lsmod | grep mlx5_core" ) != 0 ) {
100+ runner->executeCommand (" modprobe mlx_core" );
101+ }
101102
103+ }
102104 break ;
103105
104106 case OFED::Kind::Oracle:
0 commit comments