xref: /spdk/doc/spdkcli.md (revision a1dfa7ec92a6c49538482c8bb73f0b1ce040441f)
1# spdkcli {#spdkcli}
2
3spdkcli is a command-line management application for SPDK.
4spdkcli has support for most transport protocols and
5bdev modules.
6
7## Dependencies
8
9Dependencies are installed by scripts/pkgdep.sh.
10Package dependencies at the moment include:
11
12- configshell
13
14Some distributions name the package configshell_fb.
15
16## Example usage
17
18### Start SPDK application
19
20~~~{.sh}
21./scripts/setup.sh
22./build/bin/vhost -c vhost.json
23~~~
24
25### Run spdkcli
26
27spdkcli should be run with the same privileges as SPDK application.
28
29To use spdkcli in interactive mode:
30~~~{.sh}
31scripts/spdkcli.py
32~~~
33Use "help" command to get a list of available commands for each tree node.
34
35It is also possible to use spdkcli to run just a single command,
36just use the command as an argument to the application.
37For example, to view current configuration and immediately exit:
38~~~{.sh}
39scripts/spdkcli.py ls
40~~~
41
42## Optional - create Python virtual environment
43
44You can use Python virtual environment if you don't want to litter your
45system Python installation.
46
47First create the virtual environment:
48~~~{.sh}
49cd spdk
50mkdir venv
51virtualenv-3 ./venv
52source ./venv/bin/activate
53~~~
54
55Then install the dependencies using pip. That way dependencies will be
56installed only inside the virtual environment.
57~~~{.sh}
58(venv) pip install configshell-fb
59~~~
60
61Tip: if you are using "sudo" instead of root account, it is suggested to do
62"sudo -s" before activating the environment. This is because venv might not work
63correctly when calling spdkcli with sudo, like "sudo python spdkcli.py" -
64some environment variables might not be passed and you will experience errors.
65