附加卷失败,如何发布`os-initialize_connection`

时间:2017-03-15 14:46:00

标签: openstack openstack-cinder

在官方文档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将卷附加到服务器,附件将失败,导致服务器没有真正附加卷。

所以我通过Horizo​​n / 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?

任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:0)

好的,我自己回答这个问题 上面提到的Cinder API适用于Nova。 Horizo​​n / CLI可以调用的附加卷的端点来自Nova:

POST nova/os-volume_attachments

enter image description here