Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added volume type to create_volume in openstack #553

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions libcloud/compute/drivers/openstack.py
Expand Up @@ -164,7 +164,8 @@ def list_nodes(self, ex_all_tenants=False):
return self._to_nodes(
self.connection.request('/servers/detail', params=params).object)

def create_volume(self, size, name, location=None, snapshot=None):
def create_volume(self, size, name, location=None, snapshot=None,
volume_type=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.

This is an extension argument (not part of the standard API) so it should be prefixed with ex_ - ex_volume_type.

"""
Create a new volume.

Expand All @@ -183,14 +184,18 @@ def create_volume(self, size, name, location=None, snapshot=None):
volume. (optional)
:type snapshot: :class:`.VolumeSnapshot`

:param volume_type: What kind of volume to create.
(optional)
:type volume_type: ``str``

:return: The newly created volume.
:rtype: :class:`StorageVolume`
"""
volume = {
'display_name': name,
'display_description': name,
'size': size,
'volume_type': None,
'volume_type': volume_type,
'metadata': {
'contents': name,
},
Expand Down