xref: /spdk/doc/spdkcli.md (revision a83f91c29a4740e4bea5f9509b7036e9e7dc2788)
1# SPDK CLI {#spdkcli}
2
3Spdkcli is a command-line management application for SPDK.
4Spdkcli has support for a limited number of applications and bdev modules,
5and should be considered experimental for the v18.04 release.
6This experimental version was added for v18.04 to get early feedback
7that can be incorporated as spdkcli becomes more fully-featured
8for the next SPDK release.
9
10### Install needed dependencies
11
12All dependencies should be handled by scripts/pkgdep.sh script.
13Package dependencies at the moment include:
14 - configshell
15
16### Run SPDK application instance
17
18~~~{.sh}
19./scripts/setup.sh
20./app/vhost/vhost -c vhost.conf
21~~~
22
23### Run SPDK CLI
24
25Spdkcli should be run with the same priviliges as SPDK application.
26In order to use SPDK CLI in interactive mode please use:
27~~~{.sh}
28scripts/spdkcli.py
29~~~
30Use "help" command to get a list of available commands for each tree node.
31
32It is also possible to use SPDK CLI to run just a single command,
33just use the command as an argument to the application.
34For example, to view current configuration and immediately exit:
35 ~~~{.sh}
36scripts/spdkcli.py ls
37~~~
38
39### Optional - create Python virtual environment
40
41You can use Python virtual environment if you don't want to litter your
42system Python installation.
43
44First create the virtual environment:
45~~~{.sh}
46cd spdk
47mkdir venv
48virtualenv-3 ./venv
49source ./venv/bin/activate
50~~~
51
52Then install the dependencies using pip. That way depedencies will be
53installed only inside the virtual environment.
54~~~{.sh}
55(venv) pip install configshell-fb
56~~~
57
58Tip: if you are using "sudo" instead of root account, it is suggested to do
59"sudo -s" before activating the environment. This is because venv might not work
60correctly when calling spdkcli with sudo, like "sudo python spdkcli.py" -
61some environment variables might not be passed and you will experience errors.
62