Skip to content

Commit

Permalink
[swsscommon] Add c++ version sonic-db-cli from sonic-swss-common (son…
Browse files Browse the repository at this point in the history
…ic-net#10825)

    Fix sonic-db-cli high CPU usage on SONiC startup issue: sonic-net#10218
    ETA of this issue will be 2022/05/31

    Re-write sonic-cli with c++ in sonic-swss-common: sonic-net/sonic-swss-common#607
    Modify swss-common rules and slave.mk to install c++ version sonic-db-cli.

    Pass all E2E test scenario.

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111

    Build and install c++ version sonic-db-cli from swss-common.

<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration.
-->
  • Loading branch information
liuh-80 authored and liuh-80 committed Jun 27, 2022
1 parent e8daeac commit c580a13
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noni
{% endfor %}
{% endif %}

# Install sonic-db-cli
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f

# Install custom-built monit package and SONiC configuration files
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
Expand Down
3 changes: 2 additions & 1 deletion rules/docker-config-engine-buster.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_DEPENDS += $(LIBSWSSCOMMON) \
$(LIBYANG) \
$(LIBYANG_CPP) \
$(LIBYANG_PY3) \
$(PYTHON3_SWSSCOMMON)
$(PYTHON3_SWSSCOMMON) \
$(SONIC_DB_CLI)
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY3)
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \
$(SONIC_YANG_MGMT_PY3) \
Expand Down
4 changes: 3 additions & 1 deletion rules/docker-config-engine-stretch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

DOCKER_CONFIG_ENGINE_STRETCH = docker-config-engine-stretch.gz
$(DOCKER_CONFIG_ENGINE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-config-engine-stretch
$(DOCKER_CONFIG_ENGINE_STRETCH)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON)
$(DOCKER_CONFIG_ENGINE_STRETCH)_DEPENDS += $(LIBSWSSCOMMON) \
$(PYTHON_SWSSCOMMON) \
$(SONIC_DB_CLI)
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SWSSSDK_PY2)
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-config-engine.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

DOCKER_CONFIG_ENGINE = docker-config-engine.gz
$(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine
$(DOCKER_CONFIG_ENGINE)_DEPENDS += $(LIBSWSSCOMMON) \
$(SONIC_DB_CLI)
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SWSSSDK_PY2)
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
Expand Down
3 changes: 3 additions & 0 deletions rules/docker-database.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ DOCKER_DATABASE_STEM = docker-database
DOCKER_DATABASE = $(DOCKER_DATABASE_STEM).gz
DOCKER_DATABASE_DBG = $(DOCKER_DATABASE_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_DATABASE)_DEPENDS += $(LIBSWSSCOMMON) \
$(SONIC_DB_CLI)

$(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/$(DOCKER_DATABASE_STEM)

$(DOCKER_DATABASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS)
Expand Down
3 changes: 3 additions & 0 deletions rules/swss-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ $(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON)
$(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON)
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DBG)))

SONIC_DB_CLI = sonic-db-cli_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(SONIC_DB_CLI)))

# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list}
# are archived into debug one image to facilitate debugging.
#
Expand Down
1 change: 1 addition & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(SMARTMONTOOLS) \
$(PYTHON_SWSSCOMMON) \
$(PYTHON3_SWSSCOMMON) \
$(SONIC_DB_CLI) \
$(SONIC_UTILITIES_DATA) \
$(SONIC_HOST_SERVICES_DATA) \
$(BASH) \
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-swss-common

0 comments on commit c580a13

Please sign in to comment.