Getting volumes IDs attached to instance

asked 2015-10-15 03:08:23 -0600

Dambre gravatar image

updated 2015-10-16 03:27:14 -0600

Hi, I am testing the openstack and what I need is to detach all attached volumes to instance. How do I find all attached volumes to instance? Code example:

I am using this command to attach volumes:

cinder.volumes.attach(vol, vm.id, "/dev/vdb")

These commands to get info about attached volumes:

>>> vm = nova.servers.get(vm.id)
>>> vm._info['os-extended-volumes:volumes_attached']
[]

I know that if would use nova.volumes.create_server_volume I would have volume IDs in _info['os-extended-volumes:volumes_attached'] but the problem is that I don't want to mix up components and use cinder for attaching, detaching and nova for getting info about volumes attached. Any Ideas how I could get info about attached volumes?

edit retag flag offensive close merge delete

Comments

I don't know about the SDK, but the Nova API does have a volume attach request http://developer.openstack.org/api-re....

Bernd Bausch gravatar imageBernd Bausch ( 2015-10-16 06:09:09 -0600 )edit