RDC:Move rdc deamon to rocm path.

Installing files to standard path across each version and using
ldconfig has issues with side-by-side install.

Usage of RUNPATH/RPATH for ROCm to ensure all ROCm libraries are
picked without the need for ldconfig.

For RDC server to be picked up by systemctl, service config file
shall be a symlink from /lib/systemctl/system/rdc.service to
corresponding RDC file path in a given version of ROCm

For side-by-side install packages of RDC post install scripts
will be removed. Hence Use will have to set the symlink explicitly
for now.

Change-Id: I916da7cf132f0f9c667e2470fac2b0875e3db9d0
This commit is contained in:
Freddy Paul
2020-11-13 16:13:25 -08:00
committato da Freddy Paul
parent 81ad23343c
commit fe1593dda5
10 ha cambiato i file con 94 aggiunte e 38 eliminazioni
+15
Vedi File
@@ -193,12 +193,27 @@ set(CPACK_PACKAGE_VERSION ${VERSION_STRING})
# This is used by configure_file for *_postinit.in
set(RDC_CLIENT_ROOT_PATH "${RDC_SERVER_ROOT_PATH}/${RDC_CLIENT_INSTALL_PREFIX}")
#Identify between SLES and Centos for setting symlink for rdc.service
#SLES need serice file in /usr/lib/systemd/system/rdc.service
#CENTOS/RHEL Require file in /lib/systemd/system/rdc.service
file(STRINGS /etc/os-release LINUX_DISTRO LIMIT_COUNT 1 REGEX "NAME=")
message ( "Using Linux Distro: ${LINUX_DISTRO}" )
if(LINUX_DISTRO MATCHES "SLES")
set(DISTRO_ROOT "/usr/lib/systemd/system")
else()
set(DISTRO_ROOT "/lib/systemd/system")
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/src/DEBIAN_postinst.in"
"${PROJECT_SOURCE_DIR}/DEBIAN/postinst")
configure_file(
"${PROJECT_SOURCE_DIR}/src/RPM_rpm_post.in"
"${PROJECT_SOURCE_DIR}/RPM/rpm_post")
configure_file(
"${PROJECT_SOURCE_DIR}/src/RPM_postun.in"
"${PROJECT_SOURCE_DIR}/RPM/rpm_postun")
if ( DEFINED ENV{ROCM_LIBPATCH_VERSION} )
set ( CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.$ENV{ROCM_LIBPATCH_VERSION}" )
+13 -6
Vedi File
@@ -1,14 +1,21 @@
#!/bin/bash
set -e
rm_ldconfig() {
rm -f /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig
stop_rdc() {
#stop RDC if running
systemctl stop rdc
return 0
}
reload_systemd() {
systemctl daemon-reload
return 0
}
set -e
case "$1" in
remove)
rm_ldconfig
stop_rdc
unlink /lib/systemd/system/rdc.service
reload_systemd
;;
purge)
;;
+8 -5
Vedi File
@@ -100,12 +100,14 @@ When *rdcd* is started from a command-line the *capabilities* are determined by
$ cd rdc_install_prefix ## If specified in Building RDC section
## To run with authentication. Ensure SSL keys are setup properly
$ ./usr/sbin/rdcd ## rdcd is started with monitor-only capabilities
$ sudo ./usr/sbin/rdcd ## rdcd is started will full-capabilities
## version will be the version number(ex:3.10.0) of ROCm where RDC was pacakged with
$ /opt/rocm-<version>/rdc/bin/rdcd ## rdcd is started with monitor-only capabilities
$ sudo /opt/rocm-<version>/rdc/bin/rdcd ## rdcd is started will full-capabilities
## To run without authentication. SSL key & certificates are not required.
$ ./usr/sbin/rdcd -u ## rdcd is started with monitor-only capabilities
$ sudo ./usr/sbin/rdcd -u ## rdcd is started will full-capabilities
## version will be the version number(ex:3.10.0) of ROCm where RDC was pacakged with
$ /opt/rocm-<version>/rdc/bin/rdcd -u ## rdcd is started with monitor-only capabilities
$ sudo /opt/rocm-<version>/rdc/bin/rdcd -u ## rdcd is started will full-capabilities
### Start RDCD using systemd
*rdcd* can be started by using the systemctl command. systemctl will read /lib/systemd/system/rdc.service, which is installed with rdc. This file has 2 lines that control what *capabilities* with which *rdcd* will run. If left uncommented, rdcd will run with full-capabilities.
@@ -137,6 +139,7 @@ Log messages that can provide useful debug information.
journalctl -u rdc
## To run rdcd with debug log from command-line use
RDC_LOG=DEBUG ./usr/sbin/rdcd
## version will be the version number(ex:3.10.0) of ROCm where RDC was pacakged with
RDC_LOG=DEBUG /opt/rocm-<version>/rdc/bin/rdcd
-3
Vedi File
@@ -1,3 +0,0 @@
if [ $1 -eq 0 ]; then
rm -f /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig
fi
+8
Vedi File
@@ -89,6 +89,14 @@ link_directories(${LIB_BOOSTRAP_DIR})
add_executable(${RDCI_EXE} "${RDCI_SRC_LIST}")
## RUNPATH should help to run "rdci" without the usage of ldconfig
set(RDC_RUNPATH "\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/../lib64")
set(GRPC_RUNPATH "\$ORIGIN/../../grpc/lib:\$ORIGIN/../../grpc/lib64")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags -Wl,--rpath,${RDC_RUNPATH}:${GRPC_RUNPATH}")
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_SKIP_RPATH TRUE)
target_link_libraries(${RDCI_EXE} pthread dl rdc_bootstrap)
+14 -3
Vedi File
@@ -81,10 +81,21 @@ set(SERVER_SRC_LIST ${SERVER_SRC_LIST} "${RDC_SRC_ROOT}/common/rdc_utils.cc")
message("SERVER_SRC_LIST=${SERVER_SRC_LIST}")
set(SERVER_DAEMON_EXE "rdcd")
configure_file("rdc.service.in" "${PROJECT_BINARY_DIR}/rdc.service" @ONLY)
set(SERVICE_FILE_NAME "rdc.service")
link_directories(${RSMI_LIB_DIR} "${GRPC_ROOT}/lib" "${GRPC_ROOT}/lib64")
## Set RUNPATH if ROCM_RPATH is defined and passed by the environment
## RUNPATH should help to run "rdcd" without the usage of ldconfig
if (DEFINED ENV{ROCM_RPATH})
set (GRPC_RUNPATH "\$ORIGIN/../../grpc/lib:\$ORIGIN/../../grpc/lib64")
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags")
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${GRPC_RUNPATH}")
set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set (CMAKE_SKIP_BUILD_RPATH TRUE)
endif ()
add_executable(${SERVER_DAEMON_EXE} "${SERVER_SRC_LIST}")
# target_include_directories(${SERVER_DAEMON_EXE} PUBLIC ${RSMI_INC_DIR})
@@ -94,10 +105,10 @@ target_link_libraries(${SERVER_DAEMON_EXE} pthread rt grpc grpc++
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SERVER_DAEMON_EXE}
PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION usr/sbin
DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/rdc/bin
COMPONENT ${SERVER_COMPONENT})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SERVICE_FILE_NAME}
DESTINATION lib/systemd/system
install(FILES ${PROJECT_BINARY_DIR}/${SERVICE_FILE_NAME}
DESTINATION ${RDC_CLIENT_INSTALL_PREFIX}/rdc/lib
COMPONENT ${SERVER_COMPONENT})
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
@@ -24,7 +24,7 @@ AmbientCapabilities=CAP_DAC_OVERRIDE
# If we need to start anything before rdcd, use this
# ExecStartPre=
ExecStart=/usr/sbin/rdcd
ExecStart=/@RDC_CLIENT_INSTALL_PREFIX@/rdc/bin/rdcd
# If we need to start anything after rdcd use this
# ExecStartPost=
+8 -12
Vedi File
@@ -1,28 +1,24 @@
#/bin/bash
RDC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/rdc/lib
GRPC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/grpc/lib
# This will return 0 if an id is created and non-zero if
# it already exists
do_create_rdc_user() {
useradd -r -s /bin/nologin rdc
# Make sure this doesn't return non-zero if an id already exists
return 0
}
# librdc_client.so
do_ldconfig() {
echo "$RDC_LIB_DIR" > /etc/ld.so.conf.d/x86_64-librdc_client.conf
echo "$GRPC_LIB_DIR" >> /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig
do_create_rdc_user
# Make sure this doesn't return non-zero if an id already exists
reload_systemd() {
systemctl daemon-reload
return 0
}
case "$1" in
configure)
do_ldconfig
do_create_rdc_user
#Symlink RDC Service
ln -s -f -r /@RDC_CLIENT_INSTALL_PREFIX@/rdc/lib/rdc.service /lib/systemd/system/rdc.service
reload_systemd
exit 0
;;
abort-upgrade|abort-remove|abort-deconfigure)
+16
Vedi File
@@ -0,0 +1,16 @@
stop_rdc() {
#stop RDC if running
systemctl stop rdc
return 0
}
reload_systemd() {
systemctl daemon-reload
return 0
}
if [ $1 -eq 0 ]; then
stop_rdc
unlink @DISTRO_ROOT@/rdc.service
reload_systemd
fi
+11 -8
Vedi File
@@ -1,16 +1,19 @@
#!/bin/bash
RDC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/rdc/lib
GRPC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/grpc/lib
do_create_rdc_user() {
useradd -r -s /bin/nologin rdc
# Make sure this doesn't return non-zero if an id already exists
return 0
}
reload_systemd() {
systemctl daemon-reload
return 0
}
do_create_rdc_user
echo "$GRPC_LIB_DIR" > /etc/ld.so.conf.d/x86_64-librdc_client.conf
echo "$GRPC_LIB_DIR"64 >> /etc/ld.so.conf.d/x86_64-librdc_client.conf
echo "$RDC_LIB_DIR" >> /etc/ld.so.conf.d/x86_64-librdc_client.conf
echo "$RDC_LIB_DIR"64 >> /etc/ld.so.conf.d/x86_64-librdc_client.conf
ldconfig
#Symlink RDC Service
ln -s -f -r /@RDC_CLIENT_INSTALL_PREFIX@/rdc/lib/rdc.service @DISTRO_ROOT@/rdc.service
#Request systemctl to reload file since RDC is adding new file/service
reload_systemd