'Internal implementation to create a volume.'

@proxy._trace_time
def _create_volume(self, volume):

    size = storage.gigabytes_to_blocks(float(volume['size']))
    pool = self.storage_info[storage.FLAG_KEYS['storage_pool']]
    try:
        self._call_xiv_xcli('vol_create', vol=volume['name'], size_blocks=size, pool=pool)
    except errors.SystemOutOfSpaceError:
        msg = _('Unable    to    create    volume:    System    is    out    of    space.')
        LOG.error(msg)
        raise self._get_exception()(msg)
    except errors.PoolOutOfSpaceError:
        msg = (_("Unable    to    create    volume:    pool    '%(pool)s'    is    out    of    space.") % {'pool': pool})
        LOG.error(msg)
        raise self._get_exception()(msg)
    except errors.XCLIError as e:
        details = self._get_code_and_status_or_message(e)
        msg = (CREATE_VOLUME_BASE_ERROR, {'details': details})
        LOG.error(msg)
        raise self.meta['exception'].VolumeBackendAPIException(data=msg)
