1*26184ad6SJim Harris# spdkcli {#spdkcli} 283795a16SKarol Latecki 3*26184ad6SJim Harrisspdkcli is a command-line management application for SPDK. 4*26184ad6SJim Harrisspdkcli has support for most transport protocols and 5*26184ad6SJim Harrisbdev modules. 683795a16SKarol Latecki 7*26184ad6SJim Harris## Dependencies 883795a16SKarol Latecki 9*26184ad6SJim HarrisDependencies are installed by scripts/pkgdep.sh. 1083795a16SKarol LateckiPackage dependencies at the moment include: 113d8a0b19SKarol Latecki 1283795a16SKarol Latecki- configshell 1383795a16SKarol Latecki 14*26184ad6SJim HarrisSome distributions name the package configshell_fb. 15*26184ad6SJim Harris 16*26184ad6SJim Harris## Example usage 17*26184ad6SJim Harris 18*26184ad6SJim Harris### Start SPDK application 1983795a16SKarol Latecki 2083795a16SKarol Latecki~~~{.sh} 2183795a16SKarol Latecki./scripts/setup.sh 222903c655STomasz Zawadzki./build/bin/vhost -c vhost.json 2383795a16SKarol Latecki~~~ 2483795a16SKarol Latecki 25*26184ad6SJim Harris### Run spdkcli 2683795a16SKarol Latecki 27*26184ad6SJim Harrisspdkcli should be run with the same privileges as SPDK application. 28*26184ad6SJim Harris 29*26184ad6SJim HarrisTo use spdkcli in interactive mode: 3083795a16SKarol Latecki~~~{.sh} 3183795a16SKarol Lateckiscripts/spdkcli.py 3283795a16SKarol Latecki~~~ 3383795a16SKarol LateckiUse "help" command to get a list of available commands for each tree node. 3483795a16SKarol Latecki 35*26184ad6SJim HarrisIt is also possible to use spdkcli to run just a single command, 3683795a16SKarol Lateckijust use the command as an argument to the application. 3783795a16SKarol LateckiFor example, to view current configuration and immediately exit: 3883795a16SKarol Latecki~~~{.sh} 3983795a16SKarol Lateckiscripts/spdkcli.py ls 4083795a16SKarol Latecki~~~ 4183795a16SKarol Latecki 423f944e49Swawryk## Optional - create Python virtual environment 4383795a16SKarol Latecki 4483795a16SKarol LateckiYou can use Python virtual environment if you don't want to litter your 4583795a16SKarol Lateckisystem Python installation. 4683795a16SKarol Latecki 4783795a16SKarol LateckiFirst create the virtual environment: 4883795a16SKarol Latecki~~~{.sh} 4983795a16SKarol Lateckicd spdk 5083795a16SKarol Lateckimkdir venv 5183795a16SKarol Lateckivirtualenv-3 ./venv 5283795a16SKarol Lateckisource ./venv/bin/activate 5383795a16SKarol Latecki~~~ 5483795a16SKarol Latecki 551f813ec3SChen WangThen install the dependencies using pip. That way dependencies will be 5683795a16SKarol Lateckiinstalled only inside the virtual environment. 5783795a16SKarol Latecki~~~{.sh} 5883795a16SKarol Latecki(venv) pip install configshell-fb 5983795a16SKarol Latecki~~~ 6083795a16SKarol Latecki 6183795a16SKarol LateckiTip: if you are using "sudo" instead of root account, it is suggested to do 6283795a16SKarol Latecki"sudo -s" before activating the environment. This is because venv might not work 6383795a16SKarol Lateckicorrectly when calling spdkcli with sudo, like "sudo python spdkcli.py" - 6483795a16SKarol Lateckisome environment variables might not be passed and you will experience errors. 65