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 15 - configshell 16 17### Run SPDK application instance 18 19~~~{.sh} 20./scripts/setup.sh 21./build/bin/vhost -c vhost.json 22~~~ 23 24### Run SPDK CLI 25 26Spdkcli should be run with the same privileges as SPDK application. 27In order to use SPDK CLI in interactive mode please use: 28~~~{.sh} 29scripts/spdkcli.py 30~~~ 31Use "help" command to get a list of available commands for each tree node. 32 33It is also possible to use SPDK CLI to run just a single command, 34just use the command as an argument to the application. 35For example, to view current configuration and immediately exit: 36 ~~~{.sh} 37scripts/spdkcli.py ls 38~~~ 39 40### Optional - create Python virtual environment 41 42You can use Python virtual environment if you don't want to litter your 43system Python installation. 44 45First create the virtual environment: 46~~~{.sh} 47cd spdk 48mkdir venv 49virtualenv-3 ./venv 50source ./venv/bin/activate 51~~~ 52 53Then install the dependencies using pip. That way dependencies will be 54installed only inside the virtual environment. 55~~~{.sh} 56(venv) pip install configshell-fb 57~~~ 58 59Tip: if you are using "sudo" instead of root account, it is suggested to do 60"sudo -s" before activating the environment. This is because venv might not work 61correctly when calling spdkcli with sudo, like "sudo python spdkcli.py" - 62some environment variables might not be passed and you will experience errors. 63