Gris Ge
2014-01-06 05:32:55 UTC
Hey Guys,
I have drafted out a REST API demo for LSM, attached.
It could be count as my first C program is academy work does not count.
Any criticism or comments are well appreciated.
Thanks in advance.
Best regards.
========================
Compile:
yum install libmicrohttpd-devel json-c-devel uriparser-devel -y [1]
gcc lsm_rest.c -lmicrohttpd -ljson-c -luriparser -o lsm_restd
Run:
LSM_UDS_PATH=/tmp/lsm/ipc ./lsm_restd
# Change LSM_UDS_PATH to meet your dev environment.
# If you are using my lsmenv script, you can call:
# lsmenv sim ./lsm_restd
Query:
* curl http://localhost:8888/v0.1/systems?uri=sim://
* curl http://localhost:8888/v0.1/pools?uri=sim://
* curl http://localhost:8888/v0.1/volumes?uri=ontap://***@host&pass=pass
TODO:
* Need better handling of URI and password, http auth?
* Https support.
* Support /etc/lsm_restd.conf like:
[general]
interface = eth0, lo
port = 8888
ipv6 = yes
* Use the REST compliant way of handling errors. Like http 404 and etc.
* Use POST for create and modify.
* Use DELETE for delete.
Issues:
* Will timeout if you call 100 thread of curl at the same time.
* No idea why recv() buffer cannot be 4096.
Good to have:
* With config support, the alarm support could be config as:
[ontap_01]
uri=ontap://***@host
pass=pass # we can steal the way of wpa_passphrase for
# password saving.
alarm =yes
alarm_level = INFO
alarm_syslog = yes
alarm_mail = yes
alarm_mailto = ***@localhost
alarm_exec = notify-send "%level -- %subject" "%content"
[1] For RHEL 6, they are in EPEL6, EPEL6 report it has uriparser, but
actually does not exist:
https://admin.fedoraproject.org/pkgdb/acls/name/uriparser
For RHEL 7, they are in optional repo.
For fedora, all in official repo.
I have drafted out a REST API demo for LSM, attached.
It could be count as my first C program is academy work does not count.
Any criticism or comments are well appreciated.
Thanks in advance.
Best regards.
========================
Compile:
yum install libmicrohttpd-devel json-c-devel uriparser-devel -y [1]
gcc lsm_rest.c -lmicrohttpd -ljson-c -luriparser -o lsm_restd
Run:
LSM_UDS_PATH=/tmp/lsm/ipc ./lsm_restd
# Change LSM_UDS_PATH to meet your dev environment.
# If you are using my lsmenv script, you can call:
# lsmenv sim ./lsm_restd
Query:
* curl http://localhost:8888/v0.1/systems?uri=sim://
* curl http://localhost:8888/v0.1/pools?uri=sim://
* curl http://localhost:8888/v0.1/volumes?uri=ontap://***@host&pass=pass
TODO:
* Need better handling of URI and password, http auth?
* Https support.
* Support /etc/lsm_restd.conf like:
[general]
interface = eth0, lo
port = 8888
ipv6 = yes
* Use the REST compliant way of handling errors. Like http 404 and etc.
* Use POST for create and modify.
* Use DELETE for delete.
Issues:
* Will timeout if you call 100 thread of curl at the same time.
* No idea why recv() buffer cannot be 4096.
Good to have:
* With config support, the alarm support could be config as:
[ontap_01]
uri=ontap://***@host
pass=pass # we can steal the way of wpa_passphrase for
# password saving.
alarm =yes
alarm_level = INFO
alarm_syslog = yes
alarm_mail = yes
alarm_mailto = ***@localhost
alarm_exec = notify-send "%level -- %subject" "%content"
[1] For RHEL 6, they are in EPEL6, EPEL6 report it has uriparser, but
actually does not exist:
https://admin.fedoraproject.org/pkgdb/acls/name/uriparser
For RHEL 7, they are in optional repo.
For fedora, all in official repo.
--
Gris Ge
Gris Ge