xref: /spdk/docker/spdk-app/init (revision 0f57273a578706b63281d885ff4c82e665719b76)
1#!/usr/bin/env bash
2#  SPDX-License-Identifier: BSD-3-Clause
3#  Copyright (C) 2021 Intel Corporation
4#  All rights reserved.
5#
6
7app=spdk_tgt args=() limit_args=()
8
9# Override default app
10if [[ -n $SPDK_APP ]]; then
11	app=$SPDK_APP
12fi
13
14# Define extra arguments to the app
15if [[ -n $SPDK_ARGS ]]; then
16	args=($SPDK_ARGS)
17fi
18
19# Limit the app with to following options,
20# to allow for minimal impact on the host.
21limit_args+=("--no-pci")
22limit_args+=("--num-trace-entries" 0)
23
24# if set, don't include limit_args[] on the cmdline
25if [[ ! -v SPDK_NO_LIMIT ]]; then
26	args+=("${limit_args[@]}")
27fi
28
29if [[ -e /config ]]; then
30	args+=("--json" "/config")
31fi
32
33# Wait a bit to make sure ip is in place
34sleep 2s
35
36if [[ -n $SPDK_HTTP_PROXY ]]; then
37	rpc_http_proxy.py $SPDK_HTTP_PROXY &
38fi
39
40exec "$app" "${args[@]}"
41