'Return the size in gigabytes of the given volume.
Raises exception.InvalidParameterValue if volume size is 0.'

def _get_volume_size_gb(self, volume):

    if (int(volume['size']) == 0):
        errmsg = _('Need    non-zero    volume    size')
        raise exception.InvalidParameterValue(errmsg)
    return (int(volume['size']) * units.Gi)
