附加卷失败,如何 post `os-initialize_connection`
Attach volume failed, how to post `os-initialize_connection`
在官方文档https://developer.openstack.org/api-ref/block-storage/v2/index.html中,只有一个步骤可以将卷附加到服务器:
POST /v2/{tenant_id}/volumes/{volume_id}/action
{
"os-attach": {
"instance_uuid": "95D9EF50-507D-11E5-B970-0800200C9A66",
"mountpoint": "/dev/vdc"
}
}
但是如果我只调用这个API来附加一个卷到服务器,附加将会失败,因为服务器并没有真正附加这个卷。
所以我通过Horizon/CLI测试了附件,发现在附件之前还有两个步骤需要完成:
POST http://172.21.128.196:8776/v2/1237920e0dff49e380c03db9eb5dac7a/volumes/68a66368-4ec3-46cc-b65c-6fbc30fa1c15/action
Action body: {"os-reserve": null} from (pid=1986) get_method /opt/stack/cinder/cinder/api/openstack/wsgi.py:985
POST http://172.21.128.196:8776/v2/1237920e0dff49e380c03db9eb5dac7a/volumes/68a66368-4ec3-46cc-b65c-6fbc30fa1c15/action
Action body: {"os-initialize_connection": {"connector": {"platform": "x86_64", "host": "bogon", "do_local_attach": false, "ip": "172.21.128.196", "os_type": "linux2", "multipath": false, "initiator": "iqn.1993-08.org.debian:01:8144b0ddeab"}}} from (pid=1986) get_method /opt/stack/cinder/cinder/api/openstack/wsgi.py:985
POST http://172.21.128.196:8776/v2/1237920e0dff49e380c03db9eb5dac7a/volumes/68a66368-4ec3-46cc-b65c-6fbc30fa1c15/action
Action body: {"os-attach": {"instance_uuid": "a68806a6-b67d-4c48-9bc1-7af018d8f81b", "mountpoint": "/dev/vdb", "mode": "rw"}} from (pid=1986) get_method /opt/stack/cinder/cinder/api/openstack/wsgi.py:985
我找不到关于 POST os-initialize_connection
的文档,那么如何构造这个 POST?
感谢任何帮助!
好的,我自己回答这个问题。
上面询问的 Cinder API 是针对 Nova 的。 Horizon/CLI 可以调用的附加卷的端点来自 Nova:
POST nova/os-volume_attachments
在官方文档https://developer.openstack.org/api-ref/block-storage/v2/index.html中,只有一个步骤可以将卷附加到服务器:
POST /v2/{tenant_id}/volumes/{volume_id}/action
{
"os-attach": {
"instance_uuid": "95D9EF50-507D-11E5-B970-0800200C9A66",
"mountpoint": "/dev/vdc"
}
}
但是如果我只调用这个API来附加一个卷到服务器,附加将会失败,因为服务器并没有真正附加这个卷。
所以我通过Horizon/CLI测试了附件,发现在附件之前还有两个步骤需要完成:
POST http://172.21.128.196:8776/v2/1237920e0dff49e380c03db9eb5dac7a/volumes/68a66368-4ec3-46cc-b65c-6fbc30fa1c15/action
Action body: {"os-reserve": null} from (pid=1986) get_method /opt/stack/cinder/cinder/api/openstack/wsgi.py:985
POST http://172.21.128.196:8776/v2/1237920e0dff49e380c03db9eb5dac7a/volumes/68a66368-4ec3-46cc-b65c-6fbc30fa1c15/action
Action body: {"os-initialize_connection": {"connector": {"platform": "x86_64", "host": "bogon", "do_local_attach": false, "ip": "172.21.128.196", "os_type": "linux2", "multipath": false, "initiator": "iqn.1993-08.org.debian:01:8144b0ddeab"}}} from (pid=1986) get_method /opt/stack/cinder/cinder/api/openstack/wsgi.py:985
POST http://172.21.128.196:8776/v2/1237920e0dff49e380c03db9eb5dac7a/volumes/68a66368-4ec3-46cc-b65c-6fbc30fa1c15/action
Action body: {"os-attach": {"instance_uuid": "a68806a6-b67d-4c48-9bc1-7af018d8f81b", "mountpoint": "/dev/vdb", "mode": "rw"}} from (pid=1986) get_method /opt/stack/cinder/cinder/api/openstack/wsgi.py:985
我找不到关于 POST os-initialize_connection
的文档,那么如何构造这个 POST?
感谢任何帮助!
好的,我自己回答这个问题。
上面询问的 Cinder API 是针对 Nova 的。 Horizon/CLI 可以调用的附加卷的端点来自 Nova:
POST nova/os-volume_attachments