'Create a new volume.
:param size: Size of volume in gigabytes (required)
:type size: ``int``
:param name: Name of the volume to be created
:type name: ``str``
:param location: Which data center to create a volume in. If
empty, undefined behavior will be selected.
(optional)
:type location: :class:`.NodeLocation`
:param snapshot:  Snapshot from which to create the new
volume.  (optional)
:type snapshot:  :class:`.VolumeSnapshot`
:param ex_volume_type: What kind of volume to create.
(optional)
:type ex_volume_type: ``str``
:return: The newly created volume.
:rtype: :class:`StorageVolume`'

def create_volume(self, size, name, location=None, snapshot=None, ex_volume_type=None):

    volume = {'display_name': name, 'display_description': name, 'size': size, 'metadata': {'contents': name}}
    if ex_volume_type:
        volume['volume_type'] = ex_volume_type
    if location:
        volume['availability_zone'] = location
    if snapshot:
        volume['snapshot_id'] = snapshot.id
    resp = self.connection.request('/os-volumes', method='POST', data={'volume': volume})
    return self._to_volume(resp.object)
