-
Notifications
You must be signed in to change notification settings - Fork 12
OSv REST API
Tzach Livyatan edited this page Mar 3, 2014
·
4 revisions
On a cloud environment of multiple instances, interacting with each instance via GUI or CLI is non efficient. Instead OS operations should allows easy automation.
OSv REST API allows such remote automation.
First make sure you build an image with the mgmt module.
make image=mgmtOnce built, run the image with external IP access:
./scripts/run.py -nNow you can use the API directly, or access it using GUI. In both cases, you will need the OSv IP first. If you do not have it, you can find the IP by using ifconfig in the OSv shell, as follow
[/]% ifconfig
lo0: flags=37777700111<UP,LOOPBACK,RUNNING,MULTICAST,PPROMISC,MONITOR,STATICARP> mtu 16384
inet 127.0.0.1 netmask 255.0.0.0 broadcast
RX packets 0 bytes 0
Rx errors 0 dropped 0
TX packets 0 bytes 0
Tx errors 0 dropped 0 collisions 0
eth0: flags=103<UP,BROADCAST,RUNNING> mtu 1500
inet 192.168.122.89 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:0:12:34:56
RX packets 34 bytes 2580 (2.6 KiB)
Rx errors 0 dropped 0
TX packets 5 bytes 1219 (1.2 KiB)
Tx errors 0 dropped 0 collisions 0Once you have the IP, you can use the API directly from the shell:
192.168.122.89 is an example, use your OSv ip
curl http://192.168.122.89:8000/os/versionFor an interactive API GUI, base on Swagger, point your browser to http://192.168.122.89:8000/ui/