Skip to content

Commit 1545698

Browse files
committed
Switch from /tmp to /run to DP_CONF default path
On modern debian-based systems files may be cleared from /tmp after some time. The recommended location for files which should be kept as long as the system is running is the /run directory. This commit changes the relevant references to load the config file from /run/dpservice/dpservice.conf by default instead of /tmp/dp_service.conf. The old behavior can be restored by setting DP_CONF to /tmp/dp_service.conf. The hack/prepare.sh was updated to respect the DP_CONF environemnt variable as well. Resolves: #717
1 parent 786ca5e commit 1545698

File tree

7 files changed

+8
-7
lines changed

7 files changed

+8
-7
lines changed

docs/deployment/commandline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ For more information on EAL options, please see [the official docs](https://doc.
88
All options are described in `dpservice-bin --help`, see [the markdown version of it](help_dpservice-bin.md)
99

1010
## Configuration file
11-
Unless an environment variable `DP_CONF` is set to override the path, `dpservice-bin` uses `/tmp/dp_service.conf` to read configuration before processing any arguments.
11+
Unless an environment variable `DP_CONF` is set to override the path, `dpservice-bin` uses `/run/dpservice/dpservice.conf` to read configuration before processing any arguments.
1212
This way you can provide any arguments via such file and simplify the commandline use. The helper script `prepare.sh` generates such a file for Mellanox users.

docs/testing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ When running `pytest` directly in the `test/` directory, only a specific set of
3232
If one should want to instead run your own `dpservice-bin` instance (e.g. for running under a debugger), the `--attach` argument connects to an already running service instead of starting its own (which in turn can be started via a helper `dp_service.py` script). This comes with the caveat of ensuring the right arguments are passed to the service at startup.
3333

3434
#### Pytest on Mellanox
35-
By default, `pytest` runs using virtual intefaces (TAPs). By providing `--hw` command-line option, it can instead use real NIC based on the contents of `/tmp/dp_service.conf`. For more information [see Mellanox testing guide](mellanox.md#two-machine-setup).
35+
By default, `pytest` runs using virtual intefaces (TAPs). By providing `--hw` command-line option, it can instead use real NIC based on the contents of `/run/dpservice/dpservice.conf`. For more information [see Mellanox testing guide](mellanox.md#two-machine-setup).
3636

3737
## Docker
3838
There is a tester image provided by this repo, simply build it using this repo's `Dockerfile` and use `--target tester`. For fully working images a GitHub PAT is needed: `docker build --secret=id=github_token,src=<path/to/github_token> --target tester .`

docs/testing/automated_benchmark_test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The most commonly used commands to run the provision script are as follows.
8080
It is possible to login into the provisioned VMs with the user name `root` and password `test123`, using the libvirt's console.
8181

8282
# Execution of test script
83-
This test suite is invoked by executing the script `runtest.py` under the repository `/test/benchmark_test`. In oder to run dpservice either natively or via container, please make sure that a valid dp_service.conf file is created under `/tmp`.
83+
This test suite is invoked by executing the script `runtest.py` under the repository `/test/benchmark_test`. In oder to run dpservice either natively or via container, please make sure that a valid dpservice.conf file is created under `/run/dpservice`.
8484

8585
## dpservice-cli
8686
The testing script assumes that dpservice-cli exists under '/tmp' on hypervisors. If you have never run this test suite before, please first compile your local dpservice project by using `meson` and `ninja` commands. Because dpservice-cli is already included in the dpservice repository, the compiled dpservice-cli binary will be transferred to hypervisors automatically.

docs/testing/mellanox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ As dp-service is intended as a virtual router for hosting VMs, testing on real h
44
It is also possible to run the whole set of tests that `runtest.py` runs using `pytest`. See below for details.
55

66
## Hardware setup
7-
To simplify starting `dpservice-bin`, it accepts a configuration file (currently hardcoded `/tmp/dp_service.conf`) so that most command-line arguments concerning hardware options are not needed.
7+
To simplify starting `dpservice-bin`, it accepts a configuration file (currently hardcoded `/run/dpservice/dpservice.conf`) so that most command-line arguments concerning hardware options are not needed.
88

99
This file is generated for you by calling a shell script, `hack/prepare.sh`.
1010

hack/prepare.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ OPT_MULTIPORT=false
1414
BLUEFIELD_IDENTIFIERS=("MT_0000000543" "MT_0000000541")
1515
MAX_NUMVFS_POSSIBLE=126
1616
NUMVFS_DESIRED=126
17-
CONFIG="/tmp/dp_service.conf"
17+
CONFIG="${DP_CONF:-/run/dpservice/dpservice.conf}"
1818
IS_X86_WITH_BLUEFIELD=false
1919
IS_ARM_WITH_BLUEFIELD=false
2020
IS_X86_WITH_MLX=false
@@ -330,6 +330,7 @@ function make_config() {
330330
conf_vf_pattern="$(get_pattern "${devs[0]}")"
331331
conf_ipv6="$(get_ipv6)"
332332

333+
mkdir -p "$(dirname "$CONFIG")"
333334
{ echo "# This has been generated by prepare.sh"
334335
echo "no-stats"
335336
echo "pf0 $conf_pf0"

src/dp_conf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "nodes/common_node.h" // graphtrace level limit
1919
#include "dpdk_layer.h" // underlay conf struct
2020

21-
#define DP_CONF_DEFAULT_CONF_FILE "/tmp/dp_service.conf"
21+
#define DP_CONF_DEFAULT_CONF_FILE "/run/dpservice/dpservice.conf"
2222

2323
// magic number, hopefully large enough to hold the full '-a' EAL argument
2424
#define DP_EAL_A_MAXLEN 128

test/local/dp_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class DpService:
1717

18-
DP_SERVICE_CONF = "/tmp/dp_service.conf"
18+
DP_SERVICE_CONF = "/run/dpservice/dpservice.conf"
1919

2020
def __init__(self, build_path, port_redundancy, fast_flow_timeout,
2121
gdb=False, test_virtsvc=False, hardware=False, offloading=False, graphtrace=False):

0 commit comments

Comments
 (0)