'Creates a volume.'

@cinder_utils.trace
def create_volume(self, volume):

    client = self._login()
    try:
        volume_extra_specs = self._get_volume_extra_specs(volume)
        extra_specs = self._get_lh_extra_specs(volume_extra_specs, extra_specs_key_map.keys())
        optional = self._map_extra_specs(extra_specs)
        if ('isThinProvisioned' not in optional):
            optional['isThinProvisioned'] = True
        if optional.get('isAdaptiveOptimizationEnabled'):
            del optional['isAdaptiveOptimizationEnabled']
        clusterName = self._client_conf['hpelefthand_clustername']
        optional['clusterName'] = clusterName
        volume_info = client.createVolume(volume['name'], self.cluster_id, (volume['size'] * units.Gi), optional)
        model_update = self._update_provider(volume_info)
        if (self._volume_of_replicated_type(volume) and self._do_volume_replication_setup(volume, client, optional)):
            model_update['replication_status'] = 'enabled'
            model_update['replication_driver_data'] = json.dumps({'location': self._client_conf['hpelefthand_api_url']})
        return model_update
    except Exception as ex:
        raise exception.VolumeBackendAPIException(data=ex)
    finally:
        self._logout(client)
