diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 4b0bf80231..c14bedfd6f 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -157,9 +157,9 @@ function waitForAllInstanceDatabaseConfigJsonFilesReady() done fi # Delay a second to allow all instance database_config.json files to be completely generated and fully accessible. - # This delay is needed to make sure that the database_config.json files are correctly rendered from j2 template + # This delay is needed to make sure that the database_config.json files are correctly rendered from j2 template # files ( renderning takes some time ) - sleep 1 + sleep 1 fi } {%- endif %} @@ -240,7 +240,7 @@ function postStartAction() mv $WARM_DIR/dump.rdb $WARM_DIR/dump.rdb.old else # If there is a config_db.json dump file, load it. - if [ -r /etc/sonic/config_db$DEV.json ]; then + if [ -r /etc/sonic/config_db$DEV.json ]; then if [ -r /etc/sonic/init_cfg.json ]; then $SONIC_CFGGEN -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db$DEV.json --write-to-db @@ -323,7 +323,7 @@ start() { {%- if sonic_asic_platform == "broadcom" %} {%- if docker_container_name == "syncd" %} - # Set the SYNCD_SHM_SIZE if this variable not defined + # Set the SYNCD_SHM_SIZE if this variable not defined BRCM_PLATFORM_COMMON_DIR=/usr/share/sonic/device/x86_64-broadcom_common SYNCD_SHM_INI=$BRCM_PLATFORM_COMMON_DIR/syncd_shm.ini @@ -545,14 +545,15 @@ start() { {%- if docker_container_name == "syncd" %} -v /var/log/mellanox:/var/log/mellanox:rw \ -v mlnx_sdk_socket:/var/run/sx_sdk \ - -v mlnx_sdk_ready:/tmp \ + -v /tmp/nv-syncd-shared/:/tmp \ -v /dev/shm:/dev/shm:rw \ -v /var/log/sai_failure_dump:/var/log/sai_failure_dump:rw \ -e SX_API_SOCKET_FILE=/var/run/sx_sdk/sx_api.sock \ {%- elif docker_container_name == "pmon" %} -v /var/run/hw-management:/var/run/hw-management:rw \ -v mlnx_sdk_socket:/var/run/sx_sdk \ - -v mlnx_sdk_ready:/tmp \ + -v /tmp/nv-syncd-shared/:/tmp \ + -v /dev/shm:/dev/shm:rw \ -e SX_API_SOCKET_FILE=/var/run/sx_sdk/sx_api.sock \ -v /dev/shm:/dev/shm:rw \ {%- else %} diff --git a/files/build_templates/per_namespace/syncd.service.j2 b/files/build_templates/per_namespace/syncd.service.j2 index b509e7732c..1fb803390a 100644 --- a/files/build_templates/per_namespace/syncd.service.j2 +++ b/files/build_templates/per_namespace/syncd.service.j2 @@ -19,6 +19,10 @@ After=updategraph.service BindsTo=sonic.target After=sonic.target Before=ntp-config.service +{% if sonic_asic_platform == 'mellanox' %} +Requires=nv-syncd-shared.service +After=nv-syncd-shared.service +{% endif %} [Service] User=root diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index fee4939908..2849437ad8 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -946,6 +946,10 @@ MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME=$(basename {{mlnx_platform_api_py3_wheel_path sudo cp {{mlnx_platform_api_py3_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME + +# Install service that manages Nvidia specific shared storage +sudo cp platform/mellanox/nv-syncd-shared/nv-syncd-shared.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable nv-syncd-shared {% endif %} {%- if SONIC_ROUTING_STACK == "frr" %} diff --git a/platform/mellanox/nv-syncd-shared/nv-syncd-shared.service b/platform/mellanox/nv-syncd-shared/nv-syncd-shared.service new file mode 100644 index 0000000000..a298b4fae9 --- /dev/null +++ b/platform/mellanox/nv-syncd-shared/nv-syncd-shared.service @@ -0,0 +1,17 @@ +[Unit] +Description=Manage Nvidia specific syncd shared volume +Requires=docker.service +After=docker.service +BindsTo=sonic.target +After=sonic.target +PartOf=syncd.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=rm -rf /tmp/nv-syncd-shared/ +ExecStart=mkdir -p /tmp/nv-syncd-shared/ + +[Install] +WantedBy=sonic.target +