From 8bc0e30f62bbb54def0ea911cc7851f4d3ec57a0 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Tue, 14 Nov 2023 11:51:52 +0800 Subject: [PATCH 1/7] Dpu database Signed-off-by: Ze Gan --- .../docker-database/database_config.json.j2 | 2 +- .../docker-database/database_global.json.j2 | 22 +++++++++++++- .../docker-database/docker-database-init.sh | 16 ++++++++-- files/build_templates/docker_image_ctl.j2 | 30 ++++++++++++++----- .../sonic_py_common/device_info.py | 24 +++++++++++++++ 5 files changed, 82 insertions(+), 12 deletions(-) diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index f0807b238375..c8c67c5f1aa7 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -2,7 +2,7 @@ "INSTANCES": { "redis":{ "hostname" : "{{HOST_IP}}", - "port" : 6379, + "port" : {{REDIS_PORT}}, "unix_socket_path" : "/var/run/redis{{NAMESPACE_ID}}/redis.sock", "persistence_for_warm_boot" : "yes" }, diff --git a/dockers/docker-database/database_global.json.j2 b/dockers/docker-database/database_global.json.j2 index 777bce43b324..5f2b5fe310e4 100644 --- a/dockers/docker-database/database_global.json.j2 +++ b/dockers/docker-database/database_global.json.j2 @@ -1,9 +1,15 @@ {% set namespace_cnt = NAMESPACE_COUNT|int %} +{% if NUM_DPU is defined %} +{% set dpu_cnt = NUM_DPU | int %} +{% else %} +{% set dpu_cnt = 0 %} +{% endif %} { "INCLUDES" : [ { "include" : "../../redis/sonic-db/database_config.json" }, + {% if namespace_cnt > 1 %} {% for ns in range(namespace_cnt) %} { @@ -15,7 +21,21 @@ }, {% endif %} {% endfor %} +{% endif %} + +{% if dpu_cnt > 0 %} +{% for dpu in range(dpu_cnt) %} + { + "include" : "../../redisdpu{{dpu}}/sonic-db/database_config.json" +{% if dpu == dpu_cnt-1 %} + } +{% else %} + }, +{% endif %} +{% endfor %} +{% endif %} + ], "VERSION" : "1.0" } -{% endif %} + diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index 8998a161bd3f..2e56d0b21f0b 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -17,6 +17,18 @@ then host_ip=127.0.0.1 fi +redis_port=6379 + +if [[ $DATABASE_TYPE == "dpu" ]]; then + host_ip="169.254.200.254" + if ! ip -4 -o addr | awk '{print $4}' | grep $host_ip; then + host_ip=127.0.0.1 + fi + DPU_ID=`echo $DEV | tr -dc '0-9'` + redis_port=`expr 6381 + $DPU_ID` +fi + + REDIS_DIR=/var/run/redis$NAMESPACE_ID mkdir -p $REDIS_DIR/sonic-db mkdir -p /etc/supervisor/conf.d/ @@ -24,7 +36,7 @@ mkdir -p /etc/supervisor/conf.d/ if [ -f /etc/sonic/database_config$NAMESPACE_ID.json ]; then cp /etc/sonic/database_config$NAMESPACE_ID.json $REDIS_DIR/sonic-db/database_config.json else - HOST_IP=$host_ip j2 /usr/share/sonic/templates/database_config.json.j2 > $REDIS_DIR/sonic-db/database_config.json + HOST_IP=$host_ip REDIS_PORT=$redis_port j2 /usr/share/sonic/templates/database_config.json.j2 > $REDIS_DIR/sonic-db/database_config.json fi # on VoQ system, we only publish redis_chassis instance and CHASSIS_APP_DB when @@ -59,7 +71,7 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then fi # copy/generate the database_global.json file if this is global database service in multi asic platform. -if [[ $NAMESPACE_ID == "" ]] && [[ $NAMESPACE_COUNT -gt 1 ]] +if [[ $NAMESPACE_ID == "" ]] && [[ $NAMESPACE_COUNT -gt 1 || $NUM_DPU -gt 1 ]] then if [ -f /etc/sonic/database_global.json ]; then cp /etc/sonic/database_global.json $REDIS_DIR/sonic-db/database_global.json diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 0b173d3eedb4..76c710c6ed14 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -58,7 +58,7 @@ function updateSyslogConf() } function ebtables_config() { - if [ "$DEV" ]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then # Install ebtables filter in namespaces on multi-asic. ip netns exec $NET_NS ebtables-restore < /etc/ebtables.filter.cfg else @@ -169,7 +169,7 @@ function postStartAction() {%- if docker_container_name == "database" %} CHASSISDB_CONF="/usr/share/sonic/device/$PLATFORM/chassisdb.conf" [ -f $CHASSISDB_CONF ] && source $CHASSISDB_CONF - if [ "$DEV" ]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then # Enable the forwarding on eth0 interface in namespace. SYSCTL_NET_CONFIG="/etc/sysctl.d/sysctl-net.conf" docker exec -i database$DEV sed -i -e "s/^net.ipv4.conf.eth0.forwarding=0/net.ipv4.conf.eth0.forwarding=1/; @@ -503,7 +503,7 @@ start() { fi {%- endif %} - if [ -z "$DEV" ]; then + if [[ -z "$DEV" || $DATABASE_TYPE == "dpu" ]]; then NET="host" # For Multi-ASIC platform we have to mount the redis paths for database instances running in different @@ -528,6 +528,8 @@ start() { DB_OPT=$DB_OPT" --env DATABASE_TYPE=$DATABASE_TYPE" else DB_OPT=$DB_OPT" -v /var/run/redis$DEV:/var/run/redis:rw " + DB_OPT=$DB_OPT" --env DATABASE_TYPE=$DATABASE_TYPE " + DB_OPT=$DB_OPT" --env NUM_DPU=$NUM_DPU " fi {%- endif %} else @@ -557,6 +559,12 @@ start() { fi fi {%- endif %} + + NAMESPACE_ID="$DEV" + if [[ $DATABASE_TYPE == "dpu" ]]; then + NAMESPACE_ID="" + fi + {%- if sonic_asic_platform == "mellanox" %} # TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version {%- endif %} @@ -630,9 +638,10 @@ start() { {%- if mount_default_tmpfs|default("n") == "y" %} --tmpfs /var/tmp \ {%- endif %} - --env "NAMESPACE_ID"="$DEV" \ + --env "NAMESPACE_ID"="$NAMESPACE_ID" \ --env "NAMESPACE_PREFIX"="$NAMESPACE_PREFIX" \ - --env "NAMESPACE_COUNT"=$NUM_ASIC \ + --env "NAMESPACE_COUNT"="$NUM_ASIC" \ + --env "DEV"="$DEV" \ --env "CONTAINER_NAME"=$DOCKERNAME \ --name=$DOCKERNAME \ {%- if docker_container_name == "gbsyncd" %} @@ -668,7 +677,7 @@ wait() { stop() { {%- if docker_container_name == "database" %} docker stop $DOCKERNAME - if [ "$DEV" ]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then ip netns delete "$NET_NS" fi {%- elif docker_container_name == "teamd" %} @@ -684,7 +693,7 @@ stop() { kill() { {%- if docker_container_name == "database" %} docker kill $DOCKERNAME - if [ "$DEV" ]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then ip netns delete "$NET_NS" fi {%- else %} @@ -701,11 +710,16 @@ if [ "$DEV" == "chassisdb" ]; then DOCKERNAME=$DOCKERNAME"-chassis" unset DEV fi + +if [[ "$DEV" == *"dpu"* ]]; then + DATABASE_TYPE="dpu" +fi + {%- endif %} NAMESPACE_PREFIX="asic" DOCKERNAME=$DOCKERNAME$DEV CONTAINER_EXISTS="no" -if [ "$DEV" ]; then +if [ "$DEV" && $DATABASE_TYPE != "dpu" ]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace SONIC_CFGGEN="sonic-cfggen -n $NET_NS" diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index 4e18af6331fa..530913def5f4 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -45,6 +45,9 @@ CHASSIS_INFO_MODEL_FIELD = 'model' CHASSIS_INFO_REV_FIELD = 'revision' +# DPU constants +DPU_NAME_PREFIX = "dpu" + # Cacheable Objects sonic_ver_info = {} hw_info_dict = {} @@ -841,3 +844,24 @@ def is_frontend_port_present_in_host(): if not namespace_id: return False return True + + +def get_num_dpus(): + num_dpus = 0 + platform_env_conf_file_path = get_platform_env_conf_file_path() + + # platform_env.conf file not present for platform + if platform_env_conf_file_path is None: + return num_dpus + + # Else open the file check for keyword - num_dpu - + with open(platform_env_conf_file_path) as platform_env_conf_file: + for line in platform_env_conf_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + if tokens[0].lower() == 'num_dpu': + num_dpus = tokens[1].strip() + break + return int(num_dpus) + From 9d7e6aa9bf9e408147bc9006104dee622bd9c380 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Tue, 14 Nov 2023 12:30:57 +0800 Subject: [PATCH 2/7] Add yang module Signed-off-by: Ze Gan --- src/sonic-yang-models/yang-models/sonic-feature.yang | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sonic-yang-models/yang-models/sonic-feature.yang b/src/sonic-yang-models/yang-models/sonic-feature.yang index 410710a82f69..6f23135b609e 100644 --- a/src/sonic-yang-models/yang-models/sonic-feature.yang +++ b/src/sonic-yang-models/yang-models/sonic-feature.yang @@ -78,6 +78,13 @@ module sonic-feature{ default "false"; } + leaf has_per_dpu_scope { + description "This configuration identicates there will only one service + spawned per DPU"; + type feature-scope-status; + default "false"; + } + leaf high_mem_alert { description "This configuration controls the trigger to generate alert on high memory utilization"; From 307b8c81fbca85e8635d44e94b811169b0d7cabf Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Wed, 15 Nov 2023 16:39:05 +0800 Subject: [PATCH 3/7] Fix bugs Signed-off-by: Ze Gan --- .../docker-database/database_config.json.j2 | 28 +++++++++++++++++-- .../docker-database/database_global.json.j2 | 1 + .../docker-database/docker-database-init.sh | 4 +-- files/build_templates/docker_image_ctl.j2 | 16 +++++------ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index c8c67c5f1aa7..5acb30e9c5a5 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -3,8 +3,9 @@ "redis":{ "hostname" : "{{HOST_IP}}", "port" : {{REDIS_PORT}}, - "unix_socket_path" : "/var/run/redis{{NAMESPACE_ID}}/redis.sock", - "persistence_for_warm_boot" : "yes" + "unix_socket_path" : "/var/run/redis{{DEV}}/redis.sock", + "persistence_for_warm_boot" : "yes", + "database_type": "{{DATABASE_TYPE}}" }, "redis_chassis":{ "hostname" : "redis_chassis.server", @@ -94,6 +95,29 @@ "separator": ":", "instance" : "redis" } +{% if DATABASE_TYPE is defined and DATABASE_TYPE == "dpudb" %} + , + "DPU_APPL_DB" : { + "id" : 15, + "separator": ":", + "instance" : "redis" + }, + "DPU_APPL_STATE_DB" : { + "id" : 16, + "separator": "|", + "instance" : "redis" + }, + "DPU_STATE_DB" : { + "id" : 17, + "separator": "|", + "instance" : "redis" + }, + "DPU_COUNTERS_DB" : { + "id" : 18, + "separator": ":", + "instance" : "redis" + } +{% endif %} }, "VERSION" : "1.0" } diff --git a/dockers/docker-database/database_global.json.j2 b/dockers/docker-database/database_global.json.j2 index 5f2b5fe310e4..535b71446203 100644 --- a/dockers/docker-database/database_global.json.j2 +++ b/dockers/docker-database/database_global.json.j2 @@ -26,6 +26,7 @@ {% if dpu_cnt > 0 %} {% for dpu in range(dpu_cnt) %} { + "database_type" : "dpudb", "include" : "../../redisdpu{{dpu}}/sonic-db/database_config.json" {% if dpu == dpu_cnt-1 %} } diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index 2e56d0b21f0b..7e13cfe5dcd8 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -19,7 +19,7 @@ fi redis_port=6379 -if [[ $DATABASE_TYPE == "dpu" ]]; then +if [[ $DATABASE_TYPE == "dpudb" ]]; then host_ip="169.254.200.254" if ! ip -4 -o addr | awk '{print $4}' | grep $host_ip; then host_ip=127.0.0.1 @@ -36,7 +36,7 @@ mkdir -p /etc/supervisor/conf.d/ if [ -f /etc/sonic/database_config$NAMESPACE_ID.json ]; then cp /etc/sonic/database_config$NAMESPACE_ID.json $REDIS_DIR/sonic-db/database_config.json else - HOST_IP=$host_ip REDIS_PORT=$redis_port j2 /usr/share/sonic/templates/database_config.json.j2 > $REDIS_DIR/sonic-db/database_config.json + HOST_IP=$host_ip REDIS_PORT=$redis_port DATABASE_TYPE=$DATABASE_TYPE j2 /usr/share/sonic/templates/database_config.json.j2 > $REDIS_DIR/sonic-db/database_config.json fi # on VoQ system, we only publish redis_chassis instance and CHASSIS_APP_DB when diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 76c710c6ed14..d0c4ad2e576d 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -58,7 +58,7 @@ function updateSyslogConf() } function ebtables_config() { - if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then # Install ebtables filter in namespaces on multi-asic. ip netns exec $NET_NS ebtables-restore < /etc/ebtables.filter.cfg else @@ -169,7 +169,7 @@ function postStartAction() {%- if docker_container_name == "database" %} CHASSISDB_CONF="/usr/share/sonic/device/$PLATFORM/chassisdb.conf" [ -f $CHASSISDB_CONF ] && source $CHASSISDB_CONF - if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then # Enable the forwarding on eth0 interface in namespace. SYSCTL_NET_CONFIG="/etc/sysctl.d/sysctl-net.conf" docker exec -i database$DEV sed -i -e "s/^net.ipv4.conf.eth0.forwarding=0/net.ipv4.conf.eth0.forwarding=1/; @@ -503,7 +503,7 @@ start() { fi {%- endif %} - if [[ -z "$DEV" || $DATABASE_TYPE == "dpu" ]]; then + if [[ -z "$DEV" || $DATABASE_TYPE == "dpudb" ]]; then NET="host" # For Multi-ASIC platform we have to mount the redis paths for database instances running in different @@ -561,7 +561,7 @@ start() { {%- endif %} NAMESPACE_ID="$DEV" - if [[ $DATABASE_TYPE == "dpu" ]]; then + if [[ $DATABASE_TYPE == "dpudb" ]]; then NAMESPACE_ID="" fi @@ -677,7 +677,7 @@ wait() { stop() { {%- if docker_container_name == "database" %} docker stop $DOCKERNAME - if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then ip netns delete "$NET_NS" fi {%- elif docker_container_name == "teamd" %} @@ -693,7 +693,7 @@ stop() { kill() { {%- if docker_container_name == "database" %} docker kill $DOCKERNAME - if [[ "$DEV" && $DATABASE_TYPE != "dpu" ]]; then + if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then ip netns delete "$NET_NS" fi {%- else %} @@ -712,14 +712,14 @@ if [ "$DEV" == "chassisdb" ]; then fi if [[ "$DEV" == *"dpu"* ]]; then - DATABASE_TYPE="dpu" + DATABASE_TYPE="dpudb" fi {%- endif %} NAMESPACE_PREFIX="asic" DOCKERNAME=$DOCKERNAME$DEV CONTAINER_EXISTS="no" -if [ "$DEV" && $DATABASE_TYPE != "dpu" ]; then +if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace SONIC_CFGGEN="sonic-cfggen -n $NET_NS" From 7aa84c978f681031b49d4d34b1aaceeb13caf945 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Wed, 15 Nov 2023 16:45:11 +0800 Subject: [PATCH 4/7] Fix comments Signed-off-by: Ze Gan --- dockers/docker-database/docker-database-init.sh | 2 +- files/build_templates/docker_image_ctl.j2 | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index 7e13cfe5dcd8..1aa8b5e5a15d 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -71,7 +71,7 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then fi # copy/generate the database_global.json file if this is global database service in multi asic platform. -if [[ $NAMESPACE_ID == "" ]] && [[ $NAMESPACE_COUNT -gt 1 || $NUM_DPU -gt 1 ]] +if [[ $DATABASE_TYPE == "" ]] && [[ $NAMESPACE_COUNT -gt 1 || $NUM_DPU -gt 1 ]] then if [ -f /etc/sonic/database_global.json ]; then cp /etc/sonic/database_global.json $REDIS_DIR/sonic-db/database_global.json diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index d0c4ad2e576d..10fbc49cf799 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -223,7 +223,7 @@ function postStartAction() # databases are not availbale until database container is ready. # also chassisdb doesn't support warm/fast reboot, its dump.rdb is deleted # at service startup time, nothing need to be done here. - if [ "$DATABASE_TYPE" != "chassisdb" ]; then + if [[ "$DATABASE_TYPE" != "chassisdb" ]]; then # Wait until supervisord and redis starts. This change is needed # because now database_config.json is jinja2 templated based # and by the time file gets generated if we do redis ping @@ -235,7 +235,7 @@ function postStartAction() # database-config.json files are not ready yet, it will generate the sonic-db-cli core files. waitForAllInstanceDatabaseConfigJsonFilesReady until [[ ($(docker exec -i database$DEV pgrep -x -c supervisord) -gt 0) && ($($SONIC_DB_CLI PING | grep -c PONG) -gt 0) && - ($(docker exec -i database$DEV sonic-db-cli PING | grep -c PONG) -gt 0) ]]; do + ( "$DATABASE_TYPE" == "dpudb" || $(docker exec -i database$DEV sonic-db-cli PING | grep -c PONG) -gt 0) ]]; do sleep 1; done @@ -530,6 +530,9 @@ start() { DB_OPT=$DB_OPT" -v /var/run/redis$DEV:/var/run/redis:rw " DB_OPT=$DB_OPT" --env DATABASE_TYPE=$DATABASE_TYPE " DB_OPT=$DB_OPT" --env NUM_DPU=$NUM_DPU " + if [[ "$DEV" ]]; then + DB_OPT=$DB_OPT" -v /var/run/redis$DEV:/var/run/redis$DEV:rw " + fi fi {%- endif %} else From d8ea2bd670d5b0f4aed78b85a63b0911dc8a632d Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Thu, 16 Nov 2023 11:39:24 +0800 Subject: [PATCH 5/7] Remove yang Signed-off-by: Ze Gan --- dockers/docker-database/database_config.json.j2 | 3 ++- src/sonic-yang-models/yang-models/sonic-feature.yang | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index 5acb30e9c5a5..f697f02d7cfb 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -100,7 +100,8 @@ "DPU_APPL_DB" : { "id" : 15, "separator": ":", - "instance" : "redis" + "instance" : "redis", + "format": "proto" }, "DPU_APPL_STATE_DB" : { "id" : 16, diff --git a/src/sonic-yang-models/yang-models/sonic-feature.yang b/src/sonic-yang-models/yang-models/sonic-feature.yang index 6f23135b609e..410710a82f69 100644 --- a/src/sonic-yang-models/yang-models/sonic-feature.yang +++ b/src/sonic-yang-models/yang-models/sonic-feature.yang @@ -78,13 +78,6 @@ module sonic-feature{ default "false"; } - leaf has_per_dpu_scope { - description "This configuration identicates there will only one service - spawned per DPU"; - type feature-scope-status; - default "false"; - } - leaf high_mem_alert { description "This configuration controls the trigger to generate alert on high memory utilization"; From b30999963e8f67ed49d1a686c03a7a72246b73f4 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Thu, 16 Nov 2023 18:46:47 +0800 Subject: [PATCH 6/7] Increase databasenum Signed-off-by: Ze Gan --- dockers/docker-database/Dockerfile.j2 | 3 ++- files/build_templates/docker_image_ctl.j2 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index f5a8ec083675..22e88275e261 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -32,7 +32,8 @@ RUN apt-get clean -y && \ s/^# unixsocket/unixsocket/; \ s/redis-server.sock/redis.sock/g; \ s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/; \ - s/^notify-keyspace-events ""$/notify-keyspace-events AKE/ \ + s/^notify-keyspace-events ""$/notify-keyspace-events AKE/; \ + s/^databases [0-9]+$/databases 100/ \ ' /etc/redis/redis.conf COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 10fbc49cf799..924fc36dc9e8 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -235,7 +235,7 @@ function postStartAction() # database-config.json files are not ready yet, it will generate the sonic-db-cli core files. waitForAllInstanceDatabaseConfigJsonFilesReady until [[ ($(docker exec -i database$DEV pgrep -x -c supervisord) -gt 0) && ($($SONIC_DB_CLI PING | grep -c PONG) -gt 0) && - ( "$DATABASE_TYPE" == "dpudb" || $(docker exec -i database$DEV sonic-db-cli PING | grep -c PONG) -gt 0) ]]; do + ($(docker exec -i database$DEV sonic-db-cli PING | grep -c PONG) -gt 0) ]]; do sleep 1; done From d26601f8ae788866668947a9cfce6d615be82635 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Fri, 17 Nov 2023 17:06:19 +0800 Subject: [PATCH 7/7] Fix comment Signed-off-by: Ze Gan --- dockers/docker-database/database_config.json.j2 | 6 ++++-- src/sonic-py-common/sonic_py_common/device_info.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index f697f02d7cfb..bacc1d356649 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -4,8 +4,10 @@ "hostname" : "{{HOST_IP}}", "port" : {{REDIS_PORT}}, "unix_socket_path" : "/var/run/redis{{DEV}}/redis.sock", - "persistence_for_warm_boot" : "yes", - "database_type": "{{DATABASE_TYPE}}" + "persistence_for_warm_boot" : "yes" + {% if DATABASE_TYPE is defined and DATABASE_TYPE != "" %} + ,"database_type": "{{DATABASE_TYPE}}" + {% endif %} }, "redis_chassis":{ "hostname" : "redis_chassis.server", diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index 530913def5f4..43af72c014a5 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -847,6 +847,8 @@ def is_frontend_port_present_in_host(): def get_num_dpus(): + # Todo: we should use platform api to get the dpu number + # instead of rely on the platform env config. num_dpus = 0 platform_env_conf_file_path = get_platform_env_conf_file_path()