Remove circular import to fix config generation
Patch https://review.openstack.org/278354 created a circular import when added an "import cinder.db" line to cinder/api/common.py since cinder/db/api.py imports cinder.api.common back, which breaks genconfig. Change-Id: Ic60866822e74687101a3885f6000f89d901bb17a Closes-Bug: #1556889
This commit is contained in:
parent
d428d9bc84
commit
3623ec3c58
cinder
@ -25,7 +25,7 @@ import webob
|
||||
|
||||
from cinder.api.openstack import wsgi
|
||||
from cinder.api import xmlutil
|
||||
import cinder.db
|
||||
from cinder.common import constants
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
import cinder.policy
|
||||
@ -139,7 +139,7 @@ def _get_marker_param(params):
|
||||
def _get_offset_param(params):
|
||||
"""Extract offset id from request's dictionary (defaults to 0) or fail."""
|
||||
offset = params.pop('offset', 0)
|
||||
return utils.validate_integer(offset, 'offset', 0, cinder.db.MAX_INT)
|
||||
return utils.validate_integer(offset, 'offset', 0, constants.DB_MAX_INT)
|
||||
|
||||
|
||||
def limited(items, request, max_limit=None):
|
||||
|
18
cinder/common/constants.py
Normal file
18
cinder/common/constants.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright 2016 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
# The maximum value a signed INT type may have
|
||||
DB_MAX_INT = 0x7FFFFFFF
|
@ -41,6 +41,7 @@ from oslo_db import concurrency as db_concurrency
|
||||
from oslo_db import options as db_options
|
||||
|
||||
from cinder.api import common
|
||||
from cinder.common import constants
|
||||
from cinder.i18n import _
|
||||
|
||||
db_opts = [
|
||||
@ -69,7 +70,7 @@ _BACKEND_MAPPING = {'sqlalchemy': 'cinder.db.sqlalchemy.api'}
|
||||
IMPL = db_concurrency.TpoolDbapiWrapper(CONF, _BACKEND_MAPPING)
|
||||
|
||||
# The maximum value a signed INT type may have
|
||||
MAX_INT = 0x7FFFFFFF
|
||||
MAX_INT = constants.DB_MAX_INT
|
||||
|
||||
|
||||
###################
|
||||
|
Loading…
x
Reference in New Issue
Block a user