def _validate_quota_limit(self, resource, limit, minimum, maximum):
        # NOTE: -1 is a flag value for unlimited, maximum value is limited
        # by SQL standard integer type `INT` which is `0x7FFFFFFF`, it's a
        # general value for SQL, using a hardcoded value here is not a
        # `nice` way, but it seems like the only way for now:
        # http://dev.mysql.com/doc/refman/5.0/en/integer-types.html
        # http://www.postgresql.org/docs/9.1/static/datatype-numeric.html
        if limit < -1 or limit > db.MAX_INT:
            msg = (_("Quota limit %(limit)s for %(resource)s "
                     "must be in the range of -1 and %(max)s.") %
                   {'limit': limit, 'resource': resource, 'max': db.MAX_INT})
            raise webob.exc.HTTPBadRequest(explanation=msg)

        def conv_inf(value):
            return float("inf") if value == -1 else value

        if conv_inf(limit) < conv_inf(minimum):
            msg = (_("Quota limit %(limit)s for %(resource)s must "
                     "be greater than or equal to already used and "
                     "reserved %(minimum)s.") %
                   {'limit': limit, 'resource': resource, 'minimum': minimum})
            raise webob.exc.HTTPBadRequest(explanation=msg)
        if conv_inf(limit) > conv_inf(maximum):
            msg = (_("Quota limit %(limit)s for %(resource)s must be "
                     "less than or equal to %(maximum)s.") %
                   {'limit': limit, 'resource': resource, 'maximum': maximum})
            raise webob.exc.HTTPBadRequest(explanation=msg)
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/legacy_v2/contrib/quotas.py/QuotaSetsController._validate_quota_limit/original