From 514b38f348f396737901c51e8b6d2f5b32d05ab6 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 19 Sep 2018 23:14:10 +0300 Subject: [PATCH] [mellanox]: Integrate CRIU tool to SYNCD docker container (#2061) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/criu.mk | 8 ++++++++ platform/mellanox/criu/Makefile | 14 ++++++++++++++ platform/mellanox/docker-syncd-mlnx.mk | 3 ++- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- sonic-slave/Dockerfile | 15 ++++++++++++++- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 platform/mellanox/criu.mk create mode 100644 platform/mellanox/criu/Makefile diff --git a/platform/mellanox/criu.mk b/platform/mellanox/criu.mk new file mode 100644 index 000000000000..01a425bb2a8a --- /dev/null +++ b/platform/mellanox/criu.mk @@ -0,0 +1,8 @@ +CRIU_VERSION = 3.10 + +export CRIU_VERSION + +CRIU = criu_$(CRIU_VERSION)-1_amd64.deb +$(CRIU)_SRC_PATH = $(PLATFORM_PATH)/criu +$(CRIU)_DEPENDS += $(LIBNL3_DEV) +SONIC_MAKE_DEBS += $(CRIU) diff --git a/platform/mellanox/criu/Makefile b/platform/mellanox/criu/Makefile new file mode 100644 index 000000000000..e9d49b569042 --- /dev/null +++ b/platform/mellanox/criu/Makefile @@ -0,0 +1,14 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = criu_$(CRIU_VERSION)-1_amd64.deb + +CRIU_DEPS = iptables,protobuf-c-compiler,protobuf-compiler,python-protobuf,libprotobuf-c1,python-future,python-ipaddr,libnet1,pkg-config,asciidoc,xmlto + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf criu + git clone -b v$(CRIU_VERSION) https://github.com/checkpoint-restore/criu.git + pushd criu + RUNDIR=/run/criu make + sudo checkinstall --default --install=no --fstrans=no --pkgversion=$(CRIU_VERSION) --maintainer='@' --requires=$(CRIU_DEPS) --pakdir=$(DEST) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 6ac895d2eb9c..5ad6f6dccf1c 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz $(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx -$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) $(CRIU) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) ifneq ($(ENABLE_SYNCD_RPC),y) @@ -13,3 +13,4 @@ $(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_MLNX)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_MLNX)_RUN_OPT += --tmpfs /run/criu diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 971602a212f0..bf301f179a42 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -14,7 +14,7 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN apt-get install -y libxml2 +RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python-protobuf libprotobuf-c1 python-future python-ipaddr libnet1 pkg-config asciidoc xmlto RUN dpkg -i \ {% for deb in docker_syncd_mlnx_debs.split(' ') -%} diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 32218b44d1df..c284161c7edd 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -230,7 +230,20 @@ RUN apt-get update && apt-get install -y \ # For bash texi2html \ # For initramfs - bash-completion + bash-completion \ +#For Mellanox CRIU build + libprotobuf-dev \ + libprotobuf-c0-dev \ + protobuf-c-compiler \ + protobuf-compiler \ + python-protobuf \ + pkg-config \ + libnet1-dev \ + libnet-dev \ + libaio-dev \ + asciidoc \ + xmlto \ + checkinstall # For linux build RUN apt-get -y build-dep linux