'Creates a volume.
:param  size: The size of the volume in GB.
:type   size: ``int``
:param  image: The OS image for the volume.
:type   image: :class:`NodeImage`
:param  ex_datacenter: The datacenter you\'re placing
the storage in. (req)
:type   ex_datacenter: :class:`Datacenter`
:param  name: The name to be given to the volume.
:param  name: ``str``
:param  ex_type: The type to be given to the volume (SSD or HDD).
:param  ex_type: ``str``
:param  ex_bus_type: Bus type. Either IDE or VIRTIO (default).
:type   ex_bus_type: ``str``
:param  ex_ssh_keys: Optional SSH keys.
:type   ex_ssh_keys: ``dict``
:param  ex_password: Optional password for root.
:type   ex_password: ``str``
:param  ex_availability_zone: Volume Availability Zone.
:type   ex_availability_zone: ``str``
:return:    Instance of class ``StorageVolume``
:rtype:     :class:`StorageVolume`'

def create_volume(self, size, image, ex_datacenter, name=None, ex_type=None, ex_bus_type=None, ex_ssh_keys=None, ex_password=None, ex_availability_zone=None):

    if (not ex_datacenter):
        raise ValueError('You    need    to    specify    a    data    center    to    attach    this    volume    to.')
    if (not image):
        raise ValueError('You    need    to    specify    an    image    to    create    this    volume    from.')
    if (image.extra['image_type'] != 'HDD'):
        raise ValueError('Invalid    type    of    {image_type}    specified    for    {image_name},    which    needs    to    be    of    type    HDD'.format(image_type=image.extra['image_type'], image_name=image.name))
    if (ex_datacenter.extra['location'] != image.extra['location']):
        raise ValueError('The    image    {image_name}    (location:    {image_location})    you    specified    is    not    available    at    the    data    center    {datacenter_name}    (location:    {datacenter_location}).'.format(image_name=image.extra['name'], datacenter_name=ex_datacenter.extra['name'], image_location=image.extra['location'], datacenter_location=ex_datacenter.extra['location']))
    action = (ex_datacenter.href + '/volumes')
    body = {'properties': {'size': size, 'image': image.id}}
    if (name is not None):
        body['properties']['name'] = name
    if (ex_type is not None):
        body['properties']['type'] = ex_type
    if (ex_bus_type is not None):
        body['properties']['bus'] = ex_bus_type
    if (ex_ssh_keys is not None):
        body['properties']['sshKeys'] = ex_ssh_keys
    if (ex_password is not None):
        body['properties']['imagePassword'] = ex_password
    if (ex_availability_zone is not None):
        body['properties']['availabilityZone'] = ex_availability_zone
    response = self.connection.request(action=action, headers={'Content-Type': 'application/json'}, data=body, method='POST', with_full_url=True)
    return self._to_volume(response.object, response.headers)
