VolumesΒΆ

Volume interface (1.1 extension).

class novaclient.v2.volumes.Volume(manager, info, loaded=False, resp=None)

Bases: novaclient.base.Resource

A volume is an extra block level storage to the OpenStack instances.

Populate and bind to a manager.

Parameters:
  • manager – BaseManager object
  • info – dictionary representing resource attributes
  • loaded – prevent lazy-loading if set to True
  • resp – Response or list of Response objects
NAME_ATTR = 'display_name'
class novaclient.v2.volumes.VolumeManager(api)

Bases: novaclient.base.Manager

Manage Volume resources. This is really about volume attachments.

create_server_volume(server_id, volume_id, device=None)

Attach a volume identified by the volume ID to the given server ID

Parameters:
  • server_id – The ID of the server
  • volume_id – The ID of the volume to attach.
  • device – The device name (optional)
Return type:

Volume

delete_server_volume(server_id, attachment_id)

Detach a volume identified by the attachment ID from the given server

Parameters:
  • server_id – The ID of the server
  • attachment_id – The ID of the attachment
Returns:

An instance of novaclient.base.TupleWithMeta

get_server_volume(server_id, attachment_id)

Get the volume identified by the attachment ID, that is attached to the given server ID

Parameters:
  • server_id – The ID of the server
  • attachment_id – The ID of the attachment
Return type:

Volume

get_server_volumes(server_id)

Get a list of all the attached volumes for the given server ID

Parameters:server_id – The ID of the server
Return type:list of Volume
resource_class

alias of Volume

update_server_volume(server_id, attachment_id, new_volume_id)

Update the volume identified by the attachment ID, that is attached to the given server ID

Parameters:
  • server_id – The ID of the server
  • attachment_id – The ID of the attachment
  • new_volume_id – The ID of the new volume to attach
Return type:

Volume