2014/8/1 に Oracle ZFS Storage ZS3 シリーズに関する下記リリースを発表させて頂きました。
その中で気になったのが下記の一文です。
「Oracle ZFS Storage OS 8.2」のクラウド機能の拡張により、「OpenStack Cinder *3」対応のドライバーが追加され、REST対応APIも提供されました。
なんとか試してみたいなぁというわけで、Oracle ZFS Storage Simulator を確認すると、OS 8.2 版に更新されていました。
これは、VirtualBox が動作する環境であれば Oracle ZFS Storage の機能を評価できる優れもの。
クラスタなどの機能は専用の機構を利用しているため評価できませんが、ハードウェアに依存しないストレージの機能や Analytics などのほぼ全ての機能評価することが可能という素晴らしい Simulator です。
これを利用することで、RESTfull API の動作確認はできるはず。
また、ZFS Storage Appliance の RESTfull API については、下記のマニュアルに情報が記載されています。
ストレージのほとんどの操作が API 経由で可能なようです。
Oracle® ZFS Storage Appliance RESTful Application Programming Interface
http://docs.oracle.com/cd/E51475_01/html/E52433/index.html
早速、Simulator をダウンロードし、VBox 上で起動。
デフォルトでは REST サービスが disable になっていますので、これを enable にします。
手っ取り早く確認したいので、VIrtualBox のポートフォワーディング機能を使い、Simulator VM の Port: 215 をホスト OS の Port: 10215 にマッピングし、https://localhost:10215 経由でのアクセスしています。
さっそく、curl を使ってアクセスしてみます。
これは、/api/system/v1/version から ZFS Storage Appliance 環境のバージョン情報を取り出したものです。
$ curl --user root:password -k -i https://localhost:10215/api/system/v1/version HTTP/1.1 200 OK Date: Sun, 10 Aug 2014 00:07:36 GMT Server: TwistedWeb/10.1.0 Content-Length: 814 X-Zfssa-Version: ak/generic@2013.06.05.2.0,1-1.10 X-Zfssa-Api-Version: 1.0 X-Zfssa-System-Api: 1.0 Content-Type: application/json; charset=utf-8 {"version": {"href": "/api/system/v1/version", "nodename": "unknown", "mkt_product": "Oracle ZFS Storage VirtualBox", "product": "Sun Storage 7000", "version": "2013.06.05.2.0,1-1.10", "install_time": "Mon Jun 23 2014 09:33:16 GMT+0000 (UTC)", "update_time": "Mon Jun 23 2014 09:33:16 GMT+0000 (UTC)", "boot_time": "Sat Aug 09 2014 23:24:29 GMT+0000 (UTC)", "asn": "de217be8-104f-6106-db7f-9c9f7789faf6", "csn": "unknown", "part": "Oracle 000-0000", "urn": "urn:uuid:11da4018-a79e-11dd-a2a2-080020a9ed93", "navname": "aksh 1.0", "navagent": "aksh", "http": "Apache/2.2.24 (Unix)", "ssl": "OpenSSL 1.0.0k 5 Feb 2013", "ak_version": "ak/SUNW,ankimo@2013.06.05.2.0,1-1.10", "os_version": "SunOS 5.11 ak/generic@2013.06.05.2.0,1-1.10 64-bit", "bios_version": "innotek GmbH VirtualBox 12/01/2006", "sp_version": "-" }} |
もう少し出力を見やすく整形できればと調べたところ、python 2.6 から含まれる json.tool module を利用することで、ぐっと見易くなりました。
curl の -i オプションで出力される protocol header がふくまれると解析に失敗してしまいますので、-i オプションを外し、パイプで python -m json.tool に渡してあげるおとで、先ほどの出力よりもさらに見易くなった結果を手に入れることができます。
$ curl --user root:password -k https://localhost:10215/api/system/v1/version | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 814 100 814 0 0 507 0 0:00:01 0:00:01 --:--:-- 507 { "version": { "ak_version": "ak/SUNW,ankimo@2013.06.05.2.0,1-1.10", "asn": "de217be8-104f-6106-db7f-9c9f7789faf6", "bios_version": "innotek GmbH VirtualBox 12/01/2006", "boot_time": "Sat Aug 09 2014 23:24:29 GMT+0000 (UTC)", "csn": "unknown", "href": "/api/system/v1/version", "http": "Apache/2.2.24 (Unix)", "install_time": "Mon Jun 23 2014 09:33:16 GMT+0000 (UTC)", "mkt_product": "Oracle ZFS Storage VirtualBox", "navagent": "aksh", "navname": "aksh 1.0", "nodename": "unknown", "os_version": "SunOS 5.11 ak/generic@2013.06.05.2.0,1-1.10 64-bit", "part": "Oracle 000-0000", "product": "Sun Storage 7000", "sp_version": "-", "ssl": "OpenSSL 1.0.0k 5 Feb 2013", "update_time": "Mon Jun 23 2014 09:33:16 GMT+0000 (UTC)", "urn": "urn:uuid:11da4018-a79e-11dd-a2a2-080020a9ed93", "version": "2013.06.05.2.0,1-1.10" } } |
さらにさらに、jq なる json processor が色付けしてくれたり整形してくれたり色々加工できるということで試してみた。
jq
http://stedolan.github.io/jq/
今回は出力を得るのは Mac OS X 環境となりますので、Mac OS X binary を利用してみました。
バージョン情報の他、pool の情報や、プロジェクトの情報も取ってみましたがキレイに出力されますね。
python -m json.tool と jq があることを覚えておくと良いようです。
$ curl --user root:password -k https://localhost:10215/api/system/v1/version | ~/opt/bin/jq '.' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 814 100 814 0 0 548 0 0:00:01 0:00:01 --:--:-- 548 { "version": { "href": "/api/system/v1/version", "nodename": "unknown", "mkt_product": "Oracle ZFS Storage VirtualBox", "product": "Sun Storage 7000", "version": "2013.06.05.2.0,1-1.10", "install_time": "Mon Jun 23 2014 09:33:16 GMT+0000 (UTC)", "update_time": "Mon Jun 23 2014 09:33:16 GMT+0000 (UTC)", "boot_time": "Sat Aug 09 2014 23:24:29 GMT+0000 (UTC)", "asn": "de217be8-104f-6106-db7f-9c9f7789faf6", "csn": "unknown", "part": "Oracle 000-0000", "urn": "urn:uuid:11da4018-a79e-11dd-a2a2-080020a9ed93", "navname": "aksh 1.0", "navagent": "aksh", "http": "Apache/2.2.24 (Unix)", "ssl": "OpenSSL 1.0.0k 5 Feb 2013", "ak_version": "ak/SUNW,ankimo@2013.06.05.2.0,1-1.10", "os_version": "SunOS 5.11 ak/generic@2013.06.05.2.0,1-1.10 64-bit", "bios_version": "innotek GmbH VirtualBox 12/01/2006", "sp_version": "-" } } $ curl --user root:password -k https://localhost:10215/api/storage/v1/pools/vboxpool | ~/opt/bin/jq '.' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2308 100 2308 0 0 22349 0 --:--:-- --:--:-- --:--:-- 22407 { "pool": { "status": "online", "profile": "stripe", "errors": [], "scrub": { "errors": 0, "repaired": 0, "complete": true }, "name": "vboxpool", "usage": { "available": 80026824704, "total": 80027320320, "dedupratio": 100, "used": 495616 }, "peer": "00000000-0000-0000-0000-000000000000", "vdev": [ { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 1" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 2" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 3" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 4" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 5" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 6" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 7" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 8" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 9" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 10" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 11" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 12" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 13" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 14" }, { "size": 5368709120, "state": "healthy", "chassis": "00a62383-eb97-c48c-f88b-ea9afe7b89a5", "type": "disk", "label": "HDD 15" } ], "owner": "unknown", "asn": "de217be8-104f-6106-db7f-9c9f7789faf6" } } $ curl --user root:password -k https://localhost:10215/api/storage/v1/pools/vboxpool/projects | ~/opt/bin/jq '.' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1765 0 1765 0 0 39935 0 --:--:-- --:--:-- --:--:-- 40113 { "projects": [ { "default_volblocksize": 8192, "logbias": "latency", "creation": "20140809T23:28:30", "nodestroy": false, "dedup": false, "sharenfs": "on", "href": "/api/storage/v1/pools/vboxpool/projects/default", "sharesmb": "off", "default_permissions": "700", "mountpoint": "/export", "snaplabel": "", "id": "f4c572c1-20d9-400a-0000-000000000000", "readonly": false, "space_data": 31744, "compression": "off", "sharetftp": "", "source": { "logbias": "inherited", "dedup": "inherited", "sharenfs": "local", "sharesmb": "local", "mountpoint": "local", "rrsrc_actions": "local", "compression": "inherited", "sharetftp": "local", "snapdir": "inherited", "sharedav": "local", "copies": "inherited", "aclinherit": "inherited", "shareftp": "local", "readonly": "inherited", "secondarycache": "inherited", "maxblocksize": "inherited", "exported": "local", "vscan": "inherited", "reservation": "local", "atime": "inherited", "recordsize": "inherited", "checksum": "inherited", "sharesftp": "local", "nbmand": "inherited", "aclmode": "inherited", "rstchown": "inherited" }, "default_sparse": false, "snapdir": "hidden", "aclmode": "discard", "copies": 1, "aclinherit": "restricted", "compressratio": 100, "shareftp": "", "canonical_name": "vboxpool/local/default", "recordsize": 131072, "space_available": 78776401920, "secondarycache": "all", "space_snapshots": 0, "space_unused_res": 0, "quota": 0, "maxblocksize": 1048576, "exported": true, "default_volsize": 0, "vscan": false, "reservation": 0, "atime": true, "pool": "vboxpool", "default_user": "nobody", "space_unused_res_shares": 0, "name": "default", "checksum": "fletcher4", "space_total": 31744, "default_group": "other", "sharesftp": "", "nbmand": false, "sharedav": "", "rstchown": true } ] } |
curl を使った参照のみによる簡単な RESTfull API の動作確認でしたが、Oracle ZFS Storage Appliance も OS 8.2 によりおもしろくなってきました。
Oracle ZFS Storage Appliance は、この RESTfull API を利用することで、OpenStack のブロックストレージリソース (Cinder) として利用することができるようになっています。(Cinder Host に ZFS Storage Appliance 用の driver を別途インストールが必要)
このへんも整理できたらまとめてみたいと思います。