Ask Your Question
0

attach volume, how to post `os-initialize_connection`

asked 2017-03-15 09:42:01 -0600

Honghe gravatar image

In the Official Document https://developer.openstack.org/api-ref/block-storage/v2/index.html (https://developer.openstack.org/api-r...) , there is only one step to attach a volume to server:

POST /v2/{tenant_id}/volumes/{volume_id}/action
{
    "os-attach": {
        "instance_uuid": "95D9EF50-507D-11E5-B970-0800200C9A66",
        "mountpoint": "/dev/vdc"
    }
}

But if I only call this API to attach a volume to server, the attachment will be failed, cause the server does not really attach the volume.

So I test the attachment via Horizon/CLI, find that there are two more steps need to be done before attachment:

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

I can't find document about the POST os-initialize_connection, so how to construct this POST?

Any help appreciated!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-22 06:31:55 -0600

Honghe gravatar image

updated 2017-03-22 06:49:36 -0600

OK, I answer this question myself.
The Cinder APIs asked above is for Nova. And the endpoint of attaching volume which Horizon/CLI can call is from Nova:

POST /os-volume_attachments

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-03-15 09:42:01 -0600

Seen: 193 times

Last updated: Mar 22 '17