概要
OpenStack の REST API v2.1 から Microversion をサポートしています。 Microversion は API のドキュメントされた小さな変更となります。
確認方法
REST API Server でサポートされている Microversion は OpenStack の各エンドポイントの / を GET することで確認ができます。以下は CVIM 3.2.2 で Nova API に対して Microversion の情報 を GET している例です。
1. エンドポイントの情報を「openstack endpoint list」で確認します。
# openstack endpoint list
+----------------------------------+-----------+--------------+-----------------+---------+-----------+-----------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+-----------------+---------+-----------+-----------------------------+
| 51d2e17f27ff4aae949633e9b5ec1261 | RegionOne | nova | compute | True | internal | http://ipaddress:8774/v2.1/%(tenant_id)s |
| 562d7c61886746d2ab029551267df66a | RegionOne | nova | compute | True | admin | http://ipaddress:8774/v2.1/%(tenant_id)s |
| abb69584f4f0473cb2b6cbce43fc5f7b | RegionOne | nova | compute | True | public | http://ipaddress:8774/v2.1/%(tenant_id)s |
| b9b0fd9548d2439d9711e59d93b96c91 | RegionOne | neutron | network | True | internal | http://ipaddress:9696 |
| c5119a57651e48af9ad6ad23b46d7935 | RegionOne | cinderv2 | volumev2 | True | admin | http://ipaddress:8776/v2/%(tenant_id)s |
...省略...
+----------------------------------+-----------+----------+----------+------+-------+-----------------------------------------------+
2. http://ipaddress:8774/ に GET のリクエストを送り、返された結果が以下となります。
{
"versions": [
{
"id": "v2.0",
"links": [
{
"href": "http://ipaddress:8774/v2/",
"rel": "self"
}
],
"status": "SUPPORTED",
"version": "",
"min_version": "",
"updated": "2011-01-21T11:33:21Z"
},
{
"id": "v2.1",
"links": [
{
"href": "http://ipaddress/v2.1/",
"rel": "self"
}
],
"status": "CURRENT",
"version": "2.60",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}
]
※ 「version」がサポートされる maximum の microversion です。「min_version」が minimum microversion です。
つまり本 CVIM バージョンで利用している Nova API v2.1では、microversion 2.1 ~ 2.60 の機能をサポートしています。
応用例
OpenStack のコマンドを実行する際、デフォルトでは min_version を使います。新しい microversion でサポートされている機能を利用される場合、オプションを使って microversion を指定する必要があります。
以下は volume の attachment API が追加された microversion 3.27 を指定してコマンドを実行する例です。
# cinder attachment-create
error: argument <subcommand>: invalid choice: u'attachment-create'
Try 'cinder help ' for more information.
# cinder --os-volume-api-version 3.27 attachment-create
usage: cinder attachment-create [--connect <connect>]
[--initiator <initiator>] [--ip <ip>]
[--host <host>] [--platform <platform>]
[--ostype <ostype>] [--multipath <multipath>]
[--mountpoint <mountpoint>]
<volume> <server_id>
Try 'cinder help attachment-create' for more information.
参考情報
Microversions
https://docs.openstack.org/api-guide/compute/microversions.html