numam-spdk/docker/spdk-app/init
Michal Berger e8ea27f859 docker: Add docker-compose for building basic SPDK containers
This suite can be used to deploy containers with the following
functionality (more details in README.md):

- storage-target
- proxy-container
- traffic-generator

This will run simple fio test as per fio.conf against nvmf controller
provided by initiator-container. Similar task can be performed directly
from initiator-container as well.

Each container includes SPDK installation with most common tools, e.g.
rpc.py, available under $PATH. This allows for something like:

docker-compose exec storage-target rpc.py nvmf_get_subsystems

Note that SPDK environment heavily depends on a running kernel hence all
the containers need to be privileged. That said, to make sure containers
are not affecting the host too much, some tasks must be done prior running
them. This includes:

- loading proper kernel modules (like nvme-fabrics, etc.)
- allocating hugepages and having at least one hugetlbfs mount
available under /dev/hugepages

base_build is created as docker multi-stage build.

This is done in order to decrease the size of the final image. The
SPDK RPMs are built inside a base image and then copied over to the
main image (+ fio binary) - this leaves all the dependencies inside
the intermediate image instead of the final one.

The resulted difference in size may look similar to the following
(it may differ depending on the docker version etc.):

no multi-stage build: spdk_base == 1.04GB
multi-stage build: spdk_base == 261MB

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I825bd0d0bb4071bd9d44b6a0749c033894899ae0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9055
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-10-22 07:02:52 +00:00

33 lines
617 B
Bash
Executable File

#!/usr/bin/env bash
app=spdk_tgt args=() limit_args=()
# Override default app
if [[ -n $SPDK_APP ]]; then
app=$SPDK_APP
fi
# Define extra arguments to the app
if [[ -n $SPDK_ARGS ]]; then
args=($SPDK_ARGS)
fi
# Limit the app with to following options,
# to allow for minimal impact on the host.
limit_args+=("--no-pci")
limit_args+=("--num-trace-entries" 0)
# if set, don't include limit_args[] on the cmdline
if [[ ! -v SPDK_NO_LIMIT ]]; then
args+=("${limit_args[@]}")
fi
if [[ -e /config ]]; then
args+=("--json" "/config")
fi
# Wait a bit to make sure ip is in place
sleep 2s
exec "$app" "${args[@]}"