Remove the import pathing for the old structure
This commit is the result of running the following search and replace across the project. s/nova\.api\.openstack\.?//g Change-Id: I4974a28de541aace043504f788cf0d100f778cae
This commit is contained in:
parent
a3f8272300
commit
1dca56f58e
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from nova.api.openstack.placement import handler
|
from placement import handler
|
||||||
|
|
||||||
# A humane ordering of HTTP methods for sorted output.
|
# A humane ordering of HTTP methods for sorted output.
|
||||||
ORDERED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
|
ORDERED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
|
||||||
|
@ -70,17 +70,17 @@ near the surface. The goal of this is to make things easy to trace when
|
|||||||
debugging or adding functionality.
|
debugging or adding functionality.
|
||||||
|
|
||||||
Functionality which is required for every request is handled in raw WSGI
|
Functionality which is required for every request is handled in raw WSGI
|
||||||
middleware that is composed in the `nova.api.openstack.placement.deploy`
|
middleware that is composed in the `placement.deploy`
|
||||||
module. Dispatch or routing is handled declaratively via the
|
module. Dispatch or routing is handled declaratively via the
|
||||||
``ROUTE_DECLARATIONS`` map defined in the
|
``ROUTE_DECLARATIONS`` map defined in the
|
||||||
`nova.api.openstack.placement.handler` module.
|
`placement.handler` module.
|
||||||
|
|
||||||
Mapping is by URL plus request method. The destination is a complete WSGI
|
Mapping is by URL plus request method. The destination is a complete WSGI
|
||||||
application, using a subclass of the `wsgify`_ method from `WebOb`_ to provide
|
application, using a subclass of the `wsgify`_ method from `WebOb`_ to provide
|
||||||
a `Request`_ object that provides convenience methods for accessing request
|
a `Request`_ object that provides convenience methods for accessing request
|
||||||
headers, bodies, and query parameters and for generating responses. In the
|
headers, bodies, and query parameters and for generating responses. In the
|
||||||
placement API these mini-applications are called `handlers`. The `wsgify`
|
placement API these mini-applications are called `handlers`. The `wsgify`
|
||||||
subclass is provided in `nova.api.openstack.placement.wsgi_wrapper` as
|
subclass is provided in `placement.wsgi_wrapper` as
|
||||||
`PlacementWsgify`. It is used to make sure that JSON formatted error responses
|
`PlacementWsgify`. It is used to make sure that JSON formatted error responses
|
||||||
are structured according to the API-WG `errors`_ guideline.
|
are structured according to the API-WG `errors`_ guideline.
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ lower microversion should return a ``404``. When adding a new method to an
|
|||||||
existing URL a request for a lower microversion should return a ``405``.
|
existing URL a request for a lower microversion should return a ``405``.
|
||||||
|
|
||||||
In either case, the ``ROUTE_DECLARATIONS`` dictionary in the
|
In either case, the ``ROUTE_DECLARATIONS`` dictionary in the
|
||||||
`nova.api.openstack.placement.handler` module should be updated to point to a
|
`placement.handler` module should be updated to point to a
|
||||||
function within a module that contains handlers for the type of entity
|
function within a module that contains handlers for the type of entity
|
||||||
identified by the URL. Collection and individual entity handlers of the same
|
identified by the URL. Collection and individual entity handlers of the same
|
||||||
type should be in the same module.
|
type should be in the same module.
|
||||||
@ -241,7 +241,7 @@ request, the caller is responsible for selecting the right one before calling
|
|||||||
|
|
||||||
When a handler needs to read or write the data store it should use methods on
|
When a handler needs to read or write the data store it should use methods on
|
||||||
the objects found in the
|
the objects found in the
|
||||||
`nova.api.openstack.placement.objects.resource_provider` package. Doing so
|
`placement.objects.resource_provider` package. Doing so
|
||||||
requires a context which is provided to the handler method via the WSGI
|
requires a context which is provided to the handler method via the WSGI
|
||||||
environment. It can be retrieved as follows::
|
environment. It can be retrieved as follows::
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ response. This can be used to distinguish different errors with the same HTTP
|
|||||||
response status code (a common case is a generation conflict versus an
|
response status code (a common case is a generation conflict versus an
|
||||||
inventory in use conflict). Error codes are simple namespaced strings (e.g.,
|
inventory in use conflict). Error codes are simple namespaced strings (e.g.,
|
||||||
``placement.inventory.inuse``) for which symbols are maintained in
|
``placement.inventory.inuse``) for which symbols are maintained in
|
||||||
``nova.api.openstack.placement.errors``. Adding a symbol to a response is done
|
``placement.errors``. Adding a symbol to a response is done
|
||||||
by using the ``comment`` kwarg to a WebOb exception, like this::
|
by using the ``comment`` kwarg to a WebOb exception, like this::
|
||||||
|
|
||||||
except exception.InventoryInUse as exc:
|
except exception.InventoryInUse as exc:
|
||||||
@ -269,7 +269,7 @@ by using the ``comment`` kwarg to a WebOb exception, like this::
|
|||||||
|
|
||||||
Code that adds newly raised exceptions should include an error code. Find
|
Code that adds newly raised exceptions should include an error code. Find
|
||||||
additional guidelines on use in the docs for
|
additional guidelines on use in the docs for
|
||||||
``nova.api.openstack.placement.errors``.
|
``placement.errors``.
|
||||||
|
|
||||||
Testing of handler code is described in the next section.
|
Testing of handler code is described in the next section.
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ from oslo_middleware import request_id
|
|||||||
import webob.dec
|
import webob.dec
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
from nova.api.openstack.placement import context
|
from placement import context
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
from oslo_context import context
|
from oslo_context import context
|
||||||
from oslo_db.sqlalchemy import enginefacade
|
from oslo_db.sqlalchemy import enginefacade
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import policy
|
from placement import policy
|
||||||
|
|
||||||
|
|
||||||
@enginefacade.transaction_context_provider
|
@enginefacade.transaction_context_provider
|
||||||
@ -36,7 +36,7 @@ class RequestContext(context.RequestContext):
|
|||||||
{'project_id': self.project_id, 'user_id': self.user_id}
|
{'project_id': self.project_id, 'user_id': self.user_id}
|
||||||
:param fatal: if False, will return False when an
|
:param fatal: if False, will return False when an
|
||||||
exception.PolicyNotAuthorized occurs.
|
exception.PolicyNotAuthorized occurs.
|
||||||
:raises nova.api.openstack.placement.exception.PolicyNotAuthorized:
|
:raises placement.exception.PolicyNotAuthorized:
|
||||||
if verification fails and fatal is True.
|
if verification fails and fatal is True.
|
||||||
:return: returns a non-False value (not necessarily "True") if
|
:return: returns a non-False value (not necessarily "True") if
|
||||||
authorized and False if not authorized and fatal is False.
|
authorized and False if not authorized and fatal is False.
|
||||||
|
@ -24,7 +24,7 @@ from oslo_log import log as logging
|
|||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from sqlalchemy.sql import null
|
from sqlalchemy.sql import null
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api as placement_db
|
from placement import db_api as placement_db
|
||||||
from nova.db.sqlalchemy import api as db_session
|
from nova.db.sqlalchemy import api as db_session
|
||||||
from nova import exception
|
from nova import exception
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
@ -15,14 +15,14 @@ from microversion_parse import middleware as mp_middleware
|
|||||||
import oslo_middleware
|
import oslo_middleware
|
||||||
from oslo_middleware import cors
|
from oslo_middleware import cors
|
||||||
|
|
||||||
from nova.api.openstack.placement import auth
|
from placement import auth
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import fault_wrap
|
from placement import fault_wrap
|
||||||
from nova.api.openstack.placement import handler
|
from placement import handler
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider
|
from placement.objects import resource_provider
|
||||||
from nova.api.openstack.placement import requestlog
|
from placement import requestlog
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
|
|
||||||
|
|
||||||
# TODO(cdent): NAME points to the config project being used, so for
|
# TODO(cdent): NAME points to the config project being used, so for
|
||||||
|
@ -25,7 +25,7 @@ from oslo_utils import uuidutils
|
|||||||
import requests
|
import requests
|
||||||
from wsgi_intercept import interceptor
|
from wsgi_intercept import interceptor
|
||||||
|
|
||||||
from nova.api.openstack.placement import deploy
|
from placement import deploy
|
||||||
|
|
||||||
|
|
||||||
class PlacementDirect(interceptor.RequestsInterceptor):
|
class PlacementDirect(interceptor.RequestsInterceptor):
|
||||||
|
@ -19,7 +19,7 @@ from oslo_log import log as logging
|
|||||||
import six
|
import six
|
||||||
from webob import exc
|
from webob import exc
|
||||||
|
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -28,18 +28,18 @@ import webob
|
|||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.handlers import aggregate
|
from placement.handlers import aggregate
|
||||||
from nova.api.openstack.placement.handlers import allocation
|
from placement.handlers import allocation
|
||||||
from nova.api.openstack.placement.handlers import allocation_candidate
|
from placement.handlers import allocation_candidate
|
||||||
from nova.api.openstack.placement.handlers import inventory
|
from placement.handlers import inventory
|
||||||
from nova.api.openstack.placement.handlers import reshaper
|
from placement.handlers import reshaper
|
||||||
from nova.api.openstack.placement.handlers import resource_class
|
from placement.handlers import resource_class
|
||||||
from nova.api.openstack.placement.handlers import resource_provider
|
from placement.handlers import resource_provider
|
||||||
from nova.api.openstack.placement.handlers import root
|
from placement.handlers import root
|
||||||
from nova.api.openstack.placement.handlers import trait
|
from placement.handlers import trait
|
||||||
from nova.api.openstack.placement.handlers import usage
|
from placement.handlers import usage
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -17,14 +17,14 @@ from oslo_utils import encodeutils
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import aggregate as policies
|
from placement.policies import aggregate as policies
|
||||||
from nova.api.openstack.placement.schemas import aggregate as schema
|
from placement.schemas import aggregate as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,14 +22,14 @@ from oslo_utils import timeutils
|
|||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import allocation as policies
|
from placement.policies import allocation as policies
|
||||||
from nova.api.openstack.placement.schemas import allocation as schema
|
from placement.schemas import allocation as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ from oslo_utils import timeutils
|
|||||||
import six
|
import six
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import allocation_candidate as \
|
from placement.policies import allocation_candidate as \
|
||||||
policies
|
policies
|
||||||
from nova.api.openstack.placement.schemas import allocation_candidate as schema
|
from placement.schemas import allocation_candidate as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@ from oslo_serialization import jsonutils
|
|||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import inventory as policies
|
from placement.policies import inventory as policies
|
||||||
from nova.api.openstack.placement.schemas import inventory as schema
|
from placement.schemas import inventory as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.db import constants as db_const
|
from nova.db import constants as db_const
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
@ -22,18 +22,18 @@ import copy
|
|||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
# TODO(cdent): That we are doing this suggests that there's stuff to be
|
# TODO(cdent): That we are doing this suggests that there's stuff to be
|
||||||
# extracted from the handler to a shared module.
|
# extracted from the handler to a shared module.
|
||||||
from nova.api.openstack.placement.handlers import allocation
|
from placement.handlers import allocation
|
||||||
from nova.api.openstack.placement.handlers import inventory
|
from placement.handlers import inventory
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import reshaper as policies
|
from placement.policies import reshaper as policies
|
||||||
from nova.api.openstack.placement.schemas import reshaper as schema
|
from placement.schemas import reshaper as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
# TODO(cdent): placement needs its own version of this
|
# TODO(cdent): placement needs its own version of this
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@ from oslo_utils import encodeutils
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import resource_class as policies
|
from placement.policies import resource_class as policies
|
||||||
from nova.api.openstack.placement.schemas import resource_class as schema
|
from placement.schemas import resource_class as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ from oslo_utils import timeutils
|
|||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import resource_provider as policies
|
from placement.policies import resource_provider as policies
|
||||||
from nova.api.openstack.placement.schemas import resource_provider as rp_schema
|
from placement.schemas import resource_provider as rp_schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ from oslo_utils import encodeutils
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
|
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
|
|
||||||
|
|
||||||
@wsgi_wrapper.PlacementWsgify
|
@wsgi_wrapper.PlacementWsgify
|
||||||
|
@ -17,14 +17,14 @@ from oslo_utils import encodeutils
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import trait as policies
|
from placement.policies import trait as policies
|
||||||
from nova.api.openstack.placement.schemas import trait as schema
|
from placement.schemas import trait as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@ from oslo_utils import encodeutils
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.policies import usage as policies
|
from placement.policies import usage as policies
|
||||||
from nova.api.openstack.placement.schemas import usage as schema
|
from placement.schemas import usage as schema
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.api.openstack.placement import wsgi_wrapper
|
from placement import wsgi_wrapper
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ from oslo_versionedobjects import base
|
|||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.db.sqlalchemy import api_models as models
|
from nova.db.sqlalchemy import api_models as models
|
||||||
|
|
||||||
CONSUMER_TBL = models.Consumer.__table__
|
CONSUMER_TBL = models.Consumer.__table__
|
||||||
@ -67,7 +67,7 @@ def delete_consumers_if_no_allocations(ctx, consumer_uuids):
|
|||||||
"""Looks to see if any of the supplied consumers has any allocations and if
|
"""Looks to see if any of the supplied consumers has any allocations and if
|
||||||
not, deletes the consumer record entirely.
|
not, deletes the consumer record entirely.
|
||||||
|
|
||||||
:param ctx: `nova.api.openstack.placement.context.RequestContext` that
|
:param ctx: `placement.context.RequestContext` that
|
||||||
contains an oslo_db Session
|
contains an oslo_db Session
|
||||||
:param consumer_uuids: UUIDs of the consumers to check and maybe delete
|
:param consumer_uuids: UUIDs of the consumers to check and maybe delete
|
||||||
"""
|
"""
|
||||||
|
@ -16,8 +16,8 @@ from oslo_versionedobjects import base
|
|||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.db.sqlalchemy import api_models as models
|
from nova.db.sqlalchemy import api_models as models
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
@ -37,12 +37,12 @@ from sqlalchemy import func
|
|||||||
from sqlalchemy import sql
|
from sqlalchemy import sql
|
||||||
from sqlalchemy.sql import null
|
from sqlalchemy.sql import null
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.api.openstack.placement import resource_class_cache as rc_cache
|
from placement import resource_class_cache as rc_cache
|
||||||
from nova.db.sqlalchemy import api_models as models
|
from nova.db.sqlalchemy import api_models as models
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
from nova import rc_fields
|
from nova import rc_fields
|
||||||
@ -3976,7 +3976,7 @@ class AllocationCandidates(base.VersionedObject):
|
|||||||
|
|
||||||
:param context: Nova RequestContext.
|
:param context: Nova RequestContext.
|
||||||
:param requests: Dict, keyed by suffix, of
|
:param requests: Dict, keyed by suffix, of
|
||||||
nova.api.openstack.placement.util.RequestGroup
|
placement.util.RequestGroup
|
||||||
:param limit: An integer, N, representing the maximum number of
|
:param limit: An integer, N, representing the maximum number of
|
||||||
allocation candidates to return. If
|
allocation candidates to return. If
|
||||||
CONF.placement.randomize_allocation_candidates is True
|
CONF.placement.randomize_allocation_candidates is True
|
||||||
@ -4010,7 +4010,7 @@ class AllocationCandidates(base.VersionedObject):
|
|||||||
(or writer) context.
|
(or writer) context.
|
||||||
|
|
||||||
:param context: Nova RequestContext.
|
:param context: Nova RequestContext.
|
||||||
:param request: One nova.api.openstack.placement.util.RequestGroup
|
:param request: One placement.util.RequestGroup
|
||||||
:param sharing_providers: dict, keyed by resource class internal ID, of
|
:param sharing_providers: dict, keyed by resource class internal ID, of
|
||||||
the set of provider IDs containing shared
|
the set of provider IDs containing shared
|
||||||
inventory of that resource class
|
inventory of that resource class
|
||||||
@ -4169,7 +4169,7 @@ def reshape(ctx, inventories, allocations):
|
|||||||
with the transaction context manager if we want all changes involved
|
with the transaction context manager if we want all changes involved
|
||||||
in the sub-functions to operate within a single DB transaction.
|
in the sub-functions to operate within a single DB transaction.
|
||||||
|
|
||||||
:param ctx: `nova.api.openstack.placement.context.RequestContext` object
|
:param ctx: `placement.context.RequestContext` object
|
||||||
containing the DB transaction context.
|
containing the DB transaction context.
|
||||||
:param inventories: dict, keyed by ResourceProvider, of `InventoryList`
|
:param inventories: dict, keyed by ResourceProvider, of `InventoryList`
|
||||||
objects representing the replaced inventory information
|
objects representing the replaced inventory information
|
||||||
|
@ -16,8 +16,8 @@ from oslo_versionedobjects import base
|
|||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.db.sqlalchemy import api_models as models
|
from nova.db.sqlalchemy import api_models as models
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
@ -12,16 +12,16 @@
|
|||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import aggregate
|
from placement.policies import aggregate
|
||||||
from nova.api.openstack.placement.policies import allocation
|
from placement.policies import allocation
|
||||||
from nova.api.openstack.placement.policies import allocation_candidate
|
from placement.policies import allocation_candidate
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
from nova.api.openstack.placement.policies import inventory
|
from placement.policies import inventory
|
||||||
from nova.api.openstack.placement.policies import reshaper
|
from placement.policies import reshaper
|
||||||
from nova.api.openstack.placement.policies import resource_class
|
from placement.policies import resource_class
|
||||||
from nova.api.openstack.placement.policies import resource_provider
|
from placement.policies import resource_provider
|
||||||
from nova.api.openstack.placement.policies import trait
|
from placement.policies import trait
|
||||||
from nova.api.openstack.placement.policies import usage
|
from placement.policies import usage
|
||||||
|
|
||||||
|
|
||||||
def list_rules():
|
def list_rules():
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
PREFIX = 'placement:resource_providers:aggregates:%s'
|
PREFIX = 'placement:resource_providers:aggregates:%s'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
RP_ALLOC_LIST = 'placement:resource_providers:allocations:list'
|
RP_ALLOC_LIST = 'placement:resource_providers:allocations:list'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
LIST = 'placement:allocation_candidates:list'
|
LIST = 'placement:allocation_candidates:list'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
PREFIX = 'placement:resource_providers:inventories:%s'
|
PREFIX = 'placement:resource_providers:inventories:%s'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
PREFIX = 'placement:reshaper:%s'
|
PREFIX = 'placement:reshaper:%s'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
PREFIX = 'placement:resource_classes:%s'
|
PREFIX = 'placement:resource_classes:%s'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
PREFIX = 'placement:resource_providers:%s'
|
PREFIX = 'placement:resource_providers:%s'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
RP_TRAIT_PREFIX = 'placement:resource_providers:traits:%s'
|
RP_TRAIT_PREFIX = 'placement:resource_providers:traits:%s'
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
|
|
||||||
from nova.api.openstack.placement.policies import base
|
from placement.policies import base
|
||||||
|
|
||||||
|
|
||||||
PROVIDER_USAGES = 'placement:resource_providers:usages'
|
PROVIDER_USAGES = 'placement:resource_providers:usages'
|
||||||
|
@ -16,8 +16,8 @@ from oslo_log import log as logging
|
|||||||
from oslo_policy import policy
|
from oslo_policy import policy
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import policies
|
from placement import policies
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
@ -63,7 +63,7 @@ def authorize(context, action, target, do_raise=True):
|
|||||||
"""Verifies that the action is valid on the target in this context.
|
"""Verifies that the action is valid on the target in this context.
|
||||||
|
|
||||||
:param context: instance of
|
:param context: instance of
|
||||||
nova.api.openstack.placement.context.RequestContext
|
placement.context.RequestContext
|
||||||
:param action: string representing the action to be checked
|
:param action: string representing the action to be checked
|
||||||
this should be colon separated for clarity, i.e.
|
this should be colon separated for clarity, i.e.
|
||||||
``placement:resource_providers:list``
|
``placement:resource_providers:list``
|
||||||
@ -72,7 +72,7 @@ def authorize(context, action, target, do_raise=True):
|
|||||||
owner of the object e.g. ``{'project_id': context.project_id}``.
|
owner of the object e.g. ``{'project_id': context.project_id}``.
|
||||||
:param do_raise: if True (the default), raises PolicyNotAuthorized;
|
:param do_raise: if True (the default), raises PolicyNotAuthorized;
|
||||||
if False, returns False
|
if False, returns False
|
||||||
:raises nova.api.openstack.placement.exception.PolicyNotAuthorized: if
|
:raises placement.exception.PolicyNotAuthorized: if
|
||||||
verification fails and do_raise is True.
|
verification fails and do_raise is True.
|
||||||
:returns: non-False value (not necessarily "True") if authorized, and the
|
:returns: non-False value (not necessarily "True") if authorized, and the
|
||||||
exact value False if not authorized and do_raise is False.
|
exact value False if not authorized and do_raise is False.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
from oslo_concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.db.sqlalchemy import api_models as models
|
from nova.db.sqlalchemy import api_models as models
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from nova.api.openstack.placement.schemas import common
|
from placement.schemas import common
|
||||||
|
|
||||||
|
|
||||||
ALLOCATION_SCHEMA = {
|
ALLOCATION_SCHEMA = {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from nova.api.openstack.placement.schemas import common
|
from placement.schemas import common
|
||||||
from nova.db import constants as db_const
|
from nova.db import constants as db_const
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from nova.api.openstack.placement.schemas import allocation
|
from placement.schemas import allocation
|
||||||
from nova.api.openstack.placement.schemas import common
|
from placement.schemas import common
|
||||||
from nova.api.openstack.placement.schemas import inventory
|
from placement.schemas import inventory
|
||||||
|
|
||||||
|
|
||||||
ALLOCATIONS = copy.deepcopy(allocation.POST_ALLOCATIONS_V1_28)
|
ALLOCATIONS = copy.deepcopy(allocation.POST_ALLOCATIONS_V1_28)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from nova.api.openstack.placement.schemas import common
|
from placement.schemas import common
|
||||||
|
|
||||||
|
|
||||||
POST_RC_SCHEMA_V1_2 = {
|
POST_RC_SCHEMA_V1_2 = {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from nova.api.openstack.placement.schemas import common
|
from placement.schemas import common
|
||||||
|
|
||||||
|
|
||||||
TRAIT = {
|
TRAIT = {
|
||||||
|
@ -49,7 +49,7 @@ from oslotest import moxstubout
|
|||||||
import six
|
import six
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from nova.api.openstack.placement.objects import resource_provider
|
from placement.objects import resource_provider
|
||||||
from nova import context
|
from nova import context
|
||||||
from nova.db import api as db
|
from nova.db import api as db
|
||||||
from nova import exception
|
from nova import exception
|
||||||
|
@ -39,9 +39,9 @@ from oslo_utils import uuidutils
|
|||||||
from requests import adapters
|
from requests import adapters
|
||||||
from wsgi_intercept import interceptor
|
from wsgi_intercept import interceptor
|
||||||
|
|
||||||
from nova.api.openstack.compute import tenant_networks
|
from compute import tenant_networks
|
||||||
from nova.api.openstack.placement import db_api as placement_db
|
from placement import db_api as placement_db
|
||||||
from nova.api.openstack import wsgi_app
|
from import wsgi_app
|
||||||
from nova.api import wsgi
|
from nova.api import wsgi
|
||||||
from nova.compute import rpcapi as compute_rpcapi
|
from nova.compute import rpcapi as compute_rpcapi
|
||||||
from nova import context
|
from nova import context
|
||||||
@ -257,7 +257,7 @@ class DatabasePoisonFixture(fixtures.Fixture):
|
|||||||
# nova.db.instance_get
|
# nova.db.instance_get
|
||||||
#
|
#
|
||||||
# - mock at the api layer rather than the object layer, for example:
|
# - mock at the api layer rather than the object layer, for example:
|
||||||
# nova.api.openstack.common.get_instance
|
# common.get_instance
|
||||||
# vs.
|
# vs.
|
||||||
# nova.objects.instance.Instance.get
|
# nova.objects.instance.Instance.get
|
||||||
#
|
#
|
||||||
|
@ -15,9 +15,9 @@ from oslo_config import fixture as config_fixture
|
|||||||
from oslotest import output
|
from oslotest import output
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from nova.api.openstack.placement import context
|
from placement import context
|
||||||
from nova.api.openstack.placement import deploy
|
from placement import deploy
|
||||||
from nova.api.openstack.placement.objects import resource_provider
|
from placement.objects import resource_provider
|
||||||
from nova.tests import fixtures
|
from nova.tests import fixtures
|
||||||
from nova.tests.functional.fixtures import capture
|
from nova.tests.functional.fixtures import capture
|
||||||
from nova.tests.unit import policy_fixture
|
from nova.tests.unit import policy_fixture
|
||||||
|
@ -14,9 +14,9 @@ from oslo_config import cfg
|
|||||||
import six
|
import six
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import lib as placement_lib
|
from placement import lib as placement_lib
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
from nova.tests import uuidsentinel as uuids
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
|
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.tests.functional.api.openstack.placement import base
|
from nova.tests.functional.api.openstack.placement import base
|
||||||
from nova.tests import uuidsentinel as uuids
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
from nova.tests.functional.api.openstack.placement import base
|
from nova.tests.functional.api.openstack.placement import base
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
from nova.tests import uuidsentinel as uuids
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
from nova.tests import uuidsentinel as uuids
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ import mock
|
|||||||
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import resource_class_cache as rc_cache
|
from placement import resource_class_cache as rc_cache
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
from nova.tests.functional.api.openstack.placement import base
|
from nova.tests.functional.api.openstack.placement import base
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ from oslo_db import exception as db_exc
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
import nova
|
import nova
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.db.sqlalchemy import api_models as models
|
from nova.db.sqlalchemy import api_models as models
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
@ -414,7 +414,7 @@ class ResourceProviderTestCase(tb.PlacementDbBaseTestCase):
|
|||||||
# NOTE(jaypipes): This is just disabling the online data migration that
|
# NOTE(jaypipes): This is just disabling the online data migration that
|
||||||
# occurs in _from_db_object() that sets root provider ID to ensure we
|
# occurs in _from_db_object() that sets root provider ID to ensure we
|
||||||
# don't have any migrations messing with the end result.
|
# don't have any migrations messing with the end result.
|
||||||
with mock.patch('nova.api.openstack.placement.objects.'
|
with mock.patch('placement.objects.'
|
||||||
'resource_provider._set_root_provider_id'):
|
'resource_provider._set_root_provider_id'):
|
||||||
rps = rp_obj.ResourceProviderList.get_all_by_filters(
|
rps = rp_obj.ResourceProviderList.get_all_by_filters(
|
||||||
self.ctx,
|
self.ctx,
|
||||||
@ -553,7 +553,7 @@ class ResourceProviderTestCase(tb.PlacementDbBaseTestCase):
|
|||||||
rp.set_inventory,
|
rp.set_inventory,
|
||||||
inv_list)
|
inv_list)
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.LOG')
|
@mock.patch('placement.objects.resource_provider.LOG')
|
||||||
def test_set_inventory_over_capacity(self, mock_log):
|
def test_set_inventory_over_capacity(self, mock_log):
|
||||||
rp = self._create_provider(uuidsentinel.rp_name)
|
rp = self._create_provider(uuidsentinel.rp_name)
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ class ResourceProviderTestCase(tb.PlacementDbBaseTestCase):
|
|||||||
self.assertIn('No inventory of class DISK_GB found',
|
self.assertIn('No inventory of class DISK_GB found',
|
||||||
str(error))
|
str(error))
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.LOG')
|
@mock.patch('placement.objects.resource_provider.LOG')
|
||||||
def test_update_inventory_violates_allocation(self, mock_log):
|
def test_update_inventory_violates_allocation(self, mock_log):
|
||||||
# Compute nodes that are reconfigured have to be able to set
|
# Compute nodes that are reconfigured have to be able to set
|
||||||
# their inventory to something that violates allocations so
|
# their inventory to something that violates allocations so
|
||||||
@ -1708,7 +1708,7 @@ class TestAllocationListCreateDelete(tb.PlacementDbBaseTestCase):
|
|||||||
self.ctx, empty_rp)
|
self.ctx, empty_rp)
|
||||||
self.assertEqual(0, len(allocations))
|
self.assertEqual(0, len(allocations))
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.LOG')
|
@mock.patch('placement.objects.resource_provider.LOG')
|
||||||
def test_set_allocations_retry(self, mock_log):
|
def test_set_allocations_retry(self, mock_log):
|
||||||
"""Test server side allocation write retry handling."""
|
"""Test server side allocation write retry handling."""
|
||||||
|
|
||||||
@ -1766,7 +1766,7 @@ class TestAllocationListCreateDelete(tb.PlacementDbBaseTestCase):
|
|||||||
unmocked_set = functools.partial(
|
unmocked_set = functools.partial(
|
||||||
rp_obj.AllocationList._set_allocations, alloc_list)
|
rp_obj.AllocationList._set_allocations, alloc_list)
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'nova.api.openstack.placement.objects.resource_provider.'
|
'placement.objects.resource_provider.'
|
||||||
'AllocationList._set_allocations') as mock_set:
|
'AllocationList._set_allocations') as mock_set:
|
||||||
exceptions = iter([
|
exceptions = iter([
|
||||||
exception.ResourceProviderConcurrentUpdateDetected(),
|
exception.ResourceProviderConcurrentUpdateDetected(),
|
||||||
@ -1935,7 +1935,7 @@ class ResourceClassTestCase(tb.PlacementDbBaseTestCase):
|
|||||||
self.assertEqual(min_id + 1, rc.id)
|
self.assertEqual(min_id + 1, rc.id)
|
||||||
|
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
nova.api.openstack.placement.objects.resource_provider.ResourceClass,
|
placement.objects.resource_provider.ResourceClass,
|
||||||
"_get_next_id")
|
"_get_next_id")
|
||||||
def test_create_duplicate_id_retry(self, mock_get):
|
def test_create_duplicate_id_retry(self, mock_get):
|
||||||
# This order of ID generation will create rc1 with an ID of 42, try to
|
# This order of ID generation will create rc1 with an ID of 42, try to
|
||||||
@ -1955,7 +1955,7 @@ class ResourceClassTestCase(tb.PlacementDbBaseTestCase):
|
|||||||
self.assertEqual(rc2.id, 43)
|
self.assertEqual(rc2.id, 43)
|
||||||
|
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
nova.api.openstack.placement.objects.resource_provider.ResourceClass,
|
placement.objects.resource_provider.ResourceClass,
|
||||||
"_get_next_id")
|
"_get_next_id")
|
||||||
def test_create_duplicate_id_retry_failing(self, mock_get):
|
def test_create_duplicate_id_retry_failing(self, mock_get):
|
||||||
"""negative case for test_create_duplicate_id_retry"""
|
"""negative case for test_create_duplicate_id_retry"""
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
from nova.tests import uuidsentinel as uuids
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
|
||||||
|
@ -20,12 +20,12 @@ from oslo_policy import opts as policy_opts
|
|||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
from oslotest import output
|
from oslotest import output
|
||||||
|
|
||||||
from nova.api.openstack.placement import context
|
from placement import context
|
||||||
from nova.api.openstack.placement import deploy
|
from placement import deploy
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.api.openstack.placement import policies
|
from placement import policies
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
from nova.tests import fixtures
|
from nova.tests import fixtures
|
||||||
from nova.tests.functional.db import test_base as tb
|
from nova.tests.functional.db import test_base as tb
|
||||||
|
@ -16,7 +16,7 @@ from oslo_config import fixture as config_fixture
|
|||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
from wsgi_intercept import interceptor
|
from wsgi_intercept import interceptor
|
||||||
|
|
||||||
from nova.api.openstack.placement import deploy
|
from placement import deploy
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from nova.api.openstack.placement import direct
|
from placement import direct
|
||||||
from nova.tests.functional.api.openstack.placement import base
|
from nova.tests.functional.api.openstack.placement import base
|
||||||
from nova.tests import uuidsentinel
|
from nova.tests import uuidsentinel
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from nova.api.openstack.placement import direct
|
from placement import direct
|
||||||
from nova.api.openstack.placement import handler
|
from placement import handler
|
||||||
from nova.tests.functional.api.openstack.placement import base
|
from nova.tests.functional.api.openstack.placement import base
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ import six
|
|||||||
import testtools
|
import testtools
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.handlers import aggregate
|
from placement.handlers import aggregate
|
||||||
from nova.api.openstack.placement.objects import resource_provider
|
from placement.objects import resource_provider
|
||||||
|
|
||||||
|
|
||||||
class TestAggregateHandlerErrors(testtools.TestCase):
|
class TestAggregateHandlerErrors(testtools.TestCase):
|
||||||
|
@ -15,9 +15,9 @@ from oslo_utils import timeutils
|
|||||||
import six
|
import six
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from nova.api.openstack.placement import context
|
from placement import context
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement.objects import resource_provider
|
from placement.objects import resource_provider
|
||||||
from nova import rc_fields as fields
|
from nova import rc_fields as fields
|
||||||
from nova.tests import uuidsentinel as uuids
|
from nova.tests import uuidsentinel as uuids
|
||||||
|
|
||||||
@ -160,9 +160,9 @@ class TestProviderSummaryNoDB(_TestCase):
|
|||||||
|
|
||||||
class TestInventoryNoDB(_TestCase):
|
class TestInventoryNoDB(_TestCase):
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'ensure_rc_cache', side_effect=_fake_ensure_cache)
|
'ensure_rc_cache', side_effect=_fake_ensure_cache)
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'_get_inventory_by_provider_id')
|
'_get_inventory_by_provider_id')
|
||||||
def test_get_all_by_resource_provider(self, mock_get, mock_ensure_cache):
|
def test_get_all_by_resource_provider(self, mock_get, mock_ensure_cache):
|
||||||
mock_ensure_cache(self.context)
|
mock_ensure_cache(self.context)
|
||||||
@ -264,12 +264,12 @@ class TestInventoryList(_TestCase):
|
|||||||
|
|
||||||
class TestAllocationListNoDB(_TestCase):
|
class TestAllocationListNoDB(_TestCase):
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'_create_incomplete_consumers_for_provider')
|
'_create_incomplete_consumers_for_provider')
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'ensure_rc_cache',
|
'ensure_rc_cache',
|
||||||
side_effect=_fake_ensure_cache)
|
side_effect=_fake_ensure_cache)
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'_get_allocations_by_provider_id',
|
'_get_allocations_by_provider_id',
|
||||||
return_value=[_ALLOCATION_DB])
|
return_value=[_ALLOCATION_DB])
|
||||||
def test_get_allocations(self, mock_get_allocations_from_db,
|
def test_get_allocations(self, mock_get_allocations_from_db,
|
||||||
@ -305,7 +305,7 @@ class TestResourceClass(_TestCase):
|
|||||||
|
|
||||||
class TestTraits(_TestCase):
|
class TestTraits(_TestCase):
|
||||||
|
|
||||||
@mock.patch("nova.api.openstack.placement.objects.resource_provider."
|
@mock.patch("placement.objects.resource_provider."
|
||||||
"_trait_sync")
|
"_trait_sync")
|
||||||
def test_sync_flag(self, mock_sync):
|
def test_sync_flag(self, mock_sync):
|
||||||
synced = resource_provider._TRAITS_SYNCED
|
synced = resource_provider._TRAITS_SYNCED
|
||||||
@ -315,9 +315,9 @@ class TestTraits(_TestCase):
|
|||||||
synced = resource_provider._TRAITS_SYNCED
|
synced = resource_provider._TRAITS_SYNCED
|
||||||
self.assertTrue(synced)
|
self.assertTrue(synced)
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'ResourceProvider.obj_reset_changes')
|
'ResourceProvider.obj_reset_changes')
|
||||||
@mock.patch('nova.api.openstack.placement.objects.resource_provider.'
|
@mock.patch('placement.objects.resource_provider.'
|
||||||
'_set_traits')
|
'_set_traits')
|
||||||
def test_set_traits_resets_changes(self, mock_set_traits, mock_reset):
|
def test_set_traits_resets_changes(self, mock_set_traits, mock_reset):
|
||||||
trait = resource_provider.Trait(name="HW_CPU_X86_AVX2")
|
trait = resource_provider.Trait(name="HW_CPU_X86_AVX2")
|
||||||
|
@ -18,7 +18,7 @@ import fixtures
|
|||||||
from oslo_policy import policy as oslo_policy
|
from oslo_policy import policy as oslo_policy
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from nova.api.openstack.placement import policy as placement_policy
|
from placement import policy as placement_policy
|
||||||
import nova.conf
|
import nova.conf
|
||||||
from nova.conf import paths
|
from nova.conf import paths
|
||||||
from nova import policies
|
from nova import policies
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
import mock
|
import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from nova.api.openstack.placement import context
|
from placement import context
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
|
|
||||||
|
|
||||||
class TestPlacementRequestContext(testtools.TestCase):
|
class TestPlacementRequestContext(testtools.TestCase):
|
||||||
@ -26,7 +26,7 @@ class TestPlacementRequestContext(testtools.TestCase):
|
|||||||
self.default_target = {'user_id': self.ctxt.user_id,
|
self.default_target = {'user_id': self.ctxt.user_id,
|
||||||
'project_id': self.ctxt.project_id}
|
'project_id': self.ctxt.project_id}
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.policy.authorize',
|
@mock.patch('placement.policy.authorize',
|
||||||
return_value=True)
|
return_value=True)
|
||||||
def test_can_target_none_fatal_true_accept(self, mock_authorize):
|
def test_can_target_none_fatal_true_accept(self, mock_authorize):
|
||||||
self.assertTrue(self.ctxt.can('placement:resource_providers:list'))
|
self.assertTrue(self.ctxt.can('placement:resource_providers:list'))
|
||||||
@ -34,7 +34,7 @@ class TestPlacementRequestContext(testtools.TestCase):
|
|||||||
self.ctxt, 'placement:resource_providers:list',
|
self.ctxt, 'placement:resource_providers:list',
|
||||||
self.default_target)
|
self.default_target)
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.policy.authorize',
|
@mock.patch('placement.policy.authorize',
|
||||||
side_effect=exception.PolicyNotAuthorized(
|
side_effect=exception.PolicyNotAuthorized(
|
||||||
action='placement:resource_providers:list'))
|
action='placement:resource_providers:list'))
|
||||||
def test_can_target_none_fatal_true_reject(self, mock_authorize):
|
def test_can_target_none_fatal_true_reject(self, mock_authorize):
|
||||||
@ -44,7 +44,7 @@ class TestPlacementRequestContext(testtools.TestCase):
|
|||||||
self.ctxt, 'placement:resource_providers:list',
|
self.ctxt, 'placement:resource_providers:list',
|
||||||
self.default_target)
|
self.default_target)
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.policy.authorize',
|
@mock.patch('placement.policy.authorize',
|
||||||
side_effect=exception.PolicyNotAuthorized(
|
side_effect=exception.PolicyNotAuthorized(
|
||||||
action='placement:resource_providers:list'))
|
action='placement:resource_providers:list'))
|
||||||
def test_can_target_none_fatal_false_reject(self, mock_authorize):
|
def test_can_target_none_fatal_false_reject(self, mock_authorize):
|
||||||
@ -54,7 +54,7 @@ class TestPlacementRequestContext(testtools.TestCase):
|
|||||||
self.ctxt, 'placement:resource_providers:list',
|
self.ctxt, 'placement:resource_providers:list',
|
||||||
self.default_target)
|
self.default_target)
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.policy.authorize',
|
@mock.patch('placement.policy.authorize',
|
||||||
return_value=True)
|
return_value=True)
|
||||||
def test_can_target_none_fatal_true_accept_custom_target(
|
def test_can_target_none_fatal_true_accept_custom_target(
|
||||||
self, mock_authorize):
|
self, mock_authorize):
|
||||||
|
@ -18,7 +18,7 @@ from oslo_policy import opts as policy_opts
|
|||||||
import testtools
|
import testtools
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import deploy
|
from placement import deploy
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
@ -18,7 +18,7 @@ from oslo_serialization import jsonutils
|
|||||||
import testtools
|
import testtools
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import fault_wrap
|
from placement import fault_wrap
|
||||||
|
|
||||||
|
|
||||||
ERROR_MESSAGE = 'that was not supposed to happen'
|
ERROR_MESSAGE = 'that was not supposed to happen'
|
||||||
@ -58,7 +58,7 @@ class TestFaultWrapper(testtools.TestCase):
|
|||||||
call_args = self.start_response_mock.call_args
|
call_args = self.start_response_mock.call_args
|
||||||
self.assertEqual('500 Internal Server Error', call_args[0][0])
|
self.assertEqual('500 Internal Server Error', call_args[0][0])
|
||||||
|
|
||||||
@mock.patch("nova.api.openstack.placement.fault_wrap.LOG")
|
@mock.patch("placement.fault_wrap.LOG")
|
||||||
def test_fault_log(self, mocked_log):
|
def test_fault_log(self, mocked_log):
|
||||||
self.fail_app(self.environ, self.start_response_mock)
|
self.fail_app(self.environ, self.start_response_mock)
|
||||||
mocked_log.exception.assert_called_once_with(
|
mocked_log.exception.assert_called_once_with(
|
||||||
|
@ -19,9 +19,9 @@ import routes
|
|||||||
import testtools
|
import testtools
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import handler
|
from placement import handler
|
||||||
from nova.api.openstack.placement.handlers import root
|
from placement.handlers import root
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.tests import uuidsentinel
|
from nova.tests import uuidsentinel
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ class MapperTest(testtools.TestCase):
|
|||||||
|
|
||||||
class PlacementLoggingTest(testtools.TestCase):
|
class PlacementLoggingTest(testtools.TestCase):
|
||||||
|
|
||||||
@mock.patch("nova.api.openstack.placement.handler.LOG")
|
@mock.patch("placement.handler.LOG")
|
||||||
def test_404_no_error_log(self, mocked_log):
|
def test_404_no_error_log(self, mocked_log):
|
||||||
environ = _environ(path='/hello', method='GET')
|
environ = _environ(path='/hello', method='GET')
|
||||||
context_mock = mock.Mock()
|
context_mock = mock.Mock()
|
||||||
|
@ -21,8 +21,8 @@ import microversion_parse
|
|||||||
import mock
|
import mock
|
||||||
|
|
||||||
# import the handlers to load up handler decorators
|
# import the handlers to load up handler decorators
|
||||||
import nova.api.openstack.placement.handler # noqa
|
import placement.handler # noqa
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
|
|
||||||
|
|
||||||
def handler():
|
def handler():
|
||||||
@ -41,7 +41,7 @@ class TestMicroversionFindMethod(testtools.TestCase):
|
|||||||
|
|
||||||
class TestMicroversionDecoration(testtools.TestCase):
|
class TestMicroversionDecoration(testtools.TestCase):
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.microversion.VERSIONED_METHODS',
|
@mock.patch('placement.microversion.VERSIONED_METHODS',
|
||||||
new=collections.defaultdict(list))
|
new=collections.defaultdict(list))
|
||||||
def test_methods_structure(self):
|
def test_methods_structure(self):
|
||||||
"""Test that VERSIONED_METHODS gets data as expected."""
|
"""Test that VERSIONED_METHODS gets data as expected."""
|
||||||
@ -97,7 +97,7 @@ class TestMicroversionIntersection(testtools.TestCase):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _check_intersection(method_info):
|
def _check_intersection(method_info):
|
||||||
# See check_for_versions_intersection in
|
# See check_for_versions_intersection in
|
||||||
# nova.api.openstack.wsgi.
|
# wsgi.
|
||||||
pairs = []
|
pairs = []
|
||||||
counter = 0
|
counter = 0
|
||||||
for min_ver, max_ver, func in method_info:
|
for min_ver, max_ver, func in method_info:
|
||||||
@ -112,7 +112,7 @@ class TestMicroversionIntersection(testtools.TestCase):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.microversion.VERSIONED_METHODS',
|
@mock.patch('placement.microversion.VERSIONED_METHODS',
|
||||||
new=collections.defaultdict(list))
|
new=collections.defaultdict(list))
|
||||||
def test_faked_intersection(self):
|
def test_faked_intersection(self):
|
||||||
microversion.version_handler('1.0', '1.9')(handler)
|
microversion.version_handler('1.0', '1.9')(handler)
|
||||||
@ -121,7 +121,7 @@ class TestMicroversionIntersection(testtools.TestCase):
|
|||||||
for method_info in microversion.VERSIONED_METHODS.values():
|
for method_info in microversion.VERSIONED_METHODS.values():
|
||||||
self.assertTrue(self._check_intersection(method_info))
|
self.assertTrue(self._check_intersection(method_info))
|
||||||
|
|
||||||
@mock.patch('nova.api.openstack.placement.microversion.VERSIONED_METHODS',
|
@mock.patch('placement.microversion.VERSIONED_METHODS',
|
||||||
new=collections.defaultdict(list))
|
new=collections.defaultdict(list))
|
||||||
def test_faked_non_intersection(self):
|
def test_faked_non_intersection(self):
|
||||||
microversion.version_handler('1.0', '1.8')(handler)
|
microversion.version_handler('1.0', '1.8')(handler)
|
||||||
|
@ -15,9 +15,9 @@ import os
|
|||||||
from oslo_policy import policy as oslo_policy
|
from oslo_policy import policy as oslo_policy
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from nova.api.openstack.placement import context
|
from placement import context
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import policy
|
from placement import policy
|
||||||
from nova.tests.unit import conf_fixture
|
from nova.tests.unit import conf_fixture
|
||||||
from nova.tests.unit import policy_fixture
|
from nova.tests.unit import policy_fixture
|
||||||
from nova import utils
|
from nova import utils
|
||||||
|
@ -16,7 +16,7 @@ import mock
|
|||||||
import testtools
|
import testtools
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import requestlog
|
from placement import requestlog
|
||||||
|
|
||||||
|
|
||||||
class TestRequestLog(testtools.TestCase):
|
class TestRequestLog(testtools.TestCase):
|
||||||
@ -45,7 +45,7 @@ class TestRequestLog(testtools.TestCase):
|
|||||||
req_uri = requestlog.RequestLog._get_uri(self.environ)
|
req_uri = requestlog.RequestLog._get_uri(self.environ)
|
||||||
self.assertEqual('/placement/resource_providers?name=myrp', req_uri)
|
self.assertEqual('/placement/resource_providers?name=myrp', req_uri)
|
||||||
|
|
||||||
@mock.patch("nova.api.openstack.placement.requestlog.RequestLog.write_log")
|
@mock.patch("placement.requestlog.RequestLog.write_log")
|
||||||
def test_middleware_writes_logs(self, write_log):
|
def test_middleware_writes_logs(self, write_log):
|
||||||
start_response_mock = mock.MagicMock()
|
start_response_mock = mock.MagicMock()
|
||||||
app = requestlog.RequestLog(self.application)
|
app = requestlog.RequestLog(self.application)
|
||||||
@ -53,7 +53,7 @@ class TestRequestLog(testtools.TestCase):
|
|||||||
write_log.assert_called_once_with(
|
write_log.assert_called_once_with(
|
||||||
self.environ, '/resource_providers?name=myrp', '200 OK', '0')
|
self.environ, '/resource_providers?name=myrp', '200 OK', '0')
|
||||||
|
|
||||||
@mock.patch("nova.api.openstack.placement.requestlog.LOG")
|
@mock.patch("placement.requestlog.LOG")
|
||||||
def test_middleware_sends_message(self, mocked_log):
|
def test_middleware_sends_message(self, mocked_log):
|
||||||
start_response_mock = mock.MagicMock()
|
start_response_mock = mock.MagicMock()
|
||||||
app = requestlog.RequestLog(self.application)
|
app = requestlog.RequestLog(self.application)
|
||||||
|
@ -26,14 +26,14 @@ import webob
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import lib as pl
|
from placement import lib as pl
|
||||||
from nova.api.openstack.placement import microversion
|
from placement import microversion
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import resource_provider as rp_obj
|
from placement.objects import resource_provider as rp_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
from nova.tests import uuidsentinel
|
from nova.tests import uuidsentinel
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
@ -182,7 +182,7 @@ class TestJSONErrorFormatter(testtools.TestCase):
|
|||||||
'1.0',
|
'1.0',
|
||||||
'1.1',
|
'1.1',
|
||||||
]
|
]
|
||||||
mod_str = 'nova.api.openstack.placement.microversion.VERSIONS'
|
mod_str = 'placement.microversion.VERSIONS'
|
||||||
self.useFixture(fixtures.MonkeyPatch(mod_str, _versions))
|
self.useFixture(fixtures.MonkeyPatch(mod_str, _versions))
|
||||||
|
|
||||||
def test_status_to_int_code(self):
|
def test_status_to_int_code(self):
|
||||||
@ -907,22 +907,22 @@ class TestEnsureConsumer(testtools.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestEnsureConsumer, self).setUp()
|
super(TestEnsureConsumer, self).setUp()
|
||||||
self.mock_project_get = self.useFixture(fixtures.MockPatch(
|
self.mock_project_get = self.useFixture(fixtures.MockPatch(
|
||||||
'nova.api.openstack.placement.objects.project.'
|
'placement.objects.project.'
|
||||||
'Project.get_by_external_id')).mock
|
'Project.get_by_external_id')).mock
|
||||||
self.mock_user_get = self.useFixture(fixtures.MockPatch(
|
self.mock_user_get = self.useFixture(fixtures.MockPatch(
|
||||||
'nova.api.openstack.placement.objects.user.'
|
'placement.objects.user.'
|
||||||
'User.get_by_external_id')).mock
|
'User.get_by_external_id')).mock
|
||||||
self.mock_consumer_get = self.useFixture(fixtures.MockPatch(
|
self.mock_consumer_get = self.useFixture(fixtures.MockPatch(
|
||||||
'nova.api.openstack.placement.objects.consumer.'
|
'placement.objects.consumer.'
|
||||||
'Consumer.get_by_uuid')).mock
|
'Consumer.get_by_uuid')).mock
|
||||||
self.mock_project_create = self.useFixture(fixtures.MockPatch(
|
self.mock_project_create = self.useFixture(fixtures.MockPatch(
|
||||||
'nova.api.openstack.placement.objects.project.'
|
'placement.objects.project.'
|
||||||
'Project.create')).mock
|
'Project.create')).mock
|
||||||
self.mock_user_create = self.useFixture(fixtures.MockPatch(
|
self.mock_user_create = self.useFixture(fixtures.MockPatch(
|
||||||
'nova.api.openstack.placement.objects.user.'
|
'placement.objects.user.'
|
||||||
'User.create')).mock
|
'User.create')).mock
|
||||||
self.mock_consumer_create = self.useFixture(fixtures.MockPatch(
|
self.mock_consumer_create = self.useFixture(fixtures.MockPatch(
|
||||||
'nova.api.openstack.placement.objects.consumer.'
|
'placement.objects.consumer.'
|
||||||
'Consumer.create')).mock
|
'Consumer.create')).mock
|
||||||
self.ctx = mock.sentinel.ctx
|
self.ctx = mock.sentinel.ctx
|
||||||
self.consumer_id = uuidsentinel.consumer
|
self.consumer_id = uuidsentinel.consumer
|
||||||
|
@ -23,15 +23,15 @@ from oslo_utils import timeutils
|
|||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from nova.api.openstack.placement import errors
|
from placement import errors
|
||||||
from nova.api.openstack.placement import exception
|
from placement import exception
|
||||||
from nova.api.openstack.placement import lib as placement_lib
|
from placement import lib as placement_lib
|
||||||
# NOTE(cdent): avoid cyclical import conflict between util and
|
# NOTE(cdent): avoid cyclical import conflict between util and
|
||||||
# microversion
|
# microversion
|
||||||
import nova.api.openstack.placement.microversion
|
import placement.microversion
|
||||||
from nova.api.openstack.placement.objects import consumer as consumer_obj
|
from placement.objects import consumer as consumer_obj
|
||||||
from nova.api.openstack.placement.objects import project as project_obj
|
from placement.objects import project as project_obj
|
||||||
from nova.api.openstack.placement.objects import user as user_obj
|
from placement.objects import user as user_obj
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
@ -115,7 +115,7 @@ def json_error_formatter(body, status, title, environ):
|
|||||||
http://specs.openstack.org/openstack/api-wg/guidelines/errors.html
|
http://specs.openstack.org/openstack/api-wg/guidelines/errors.html
|
||||||
"""
|
"""
|
||||||
# Shortcut to microversion module, to avoid wraps below.
|
# Shortcut to microversion module, to avoid wraps below.
|
||||||
microversion = nova.api.openstack.placement.microversion
|
microversion = placement.microversion
|
||||||
|
|
||||||
# Clear out the html that webob sneaks in.
|
# Clear out the html that webob sneaks in.
|
||||||
body = webob.exc.strip_tags(body)
|
body = webob.exc.strip_tags(body)
|
||||||
@ -368,7 +368,7 @@ def normalize_member_of_qs_params(req, suffix=''):
|
|||||||
:raises `webob.exc.HTTPBadRequest` if the val parameter is not in the
|
:raises `webob.exc.HTTPBadRequest` if the val parameter is not in the
|
||||||
expected format.
|
expected format.
|
||||||
"""
|
"""
|
||||||
microversion = nova.api.openstack.placement.microversion
|
microversion = placement.microversion
|
||||||
want_version = req.environ[microversion.MICROVERSION_ENVIRON]
|
want_version = req.environ[microversion.MICROVERSION_ENVIRON]
|
||||||
multi_member_of = want_version.matches((1, 24))
|
multi_member_of = want_version.matches((1, 24))
|
||||||
if not multi_member_of and len(req.GET.getall('member_of' + suffix)) > 1:
|
if not multi_member_of and len(req.GET.getall('member_of' + suffix)) > 1:
|
||||||
@ -493,7 +493,7 @@ def parse_qs_request_groups(req):
|
|||||||
:raises `webob.exc.HTTPBadRequest` if any value is malformed, or if a
|
:raises `webob.exc.HTTPBadRequest` if any value is malformed, or if a
|
||||||
trait list is given without corresponding resources.
|
trait list is given without corresponding resources.
|
||||||
"""
|
"""
|
||||||
microversion = nova.api.openstack.placement.microversion
|
microversion = placement.microversion
|
||||||
want_version = req.environ[microversion.MICROVERSION_ENVIRON]
|
want_version = req.environ[microversion.MICROVERSION_ENVIRON]
|
||||||
# Control whether we handle forbidden traits.
|
# Control whether we handle forbidden traits.
|
||||||
allow_forbidden = want_version.matches((1, 22))
|
allow_forbidden = want_version.matches((1, 22))
|
||||||
|
@ -24,8 +24,8 @@ from oslo_policy import opts as policy_opts
|
|||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import pbr.version
|
import pbr.version
|
||||||
|
|
||||||
from nova.api.openstack.placement import db_api
|
from placement import db_api
|
||||||
from nova.api.openstack.placement import deploy
|
from placement import deploy
|
||||||
from nova import conf
|
from nova import conf
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import webob
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from webob.dec import wsgify
|
from webob.dec import wsgify
|
||||||
|
|
||||||
from nova.api.openstack.placement import util
|
from placement import util
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ oslo.config.opts.defaults =
|
|||||||
|
|
||||||
oslo.policy.enforcer =
|
oslo.policy.enforcer =
|
||||||
nova = nova.policy:get_enforcer
|
nova = nova.policy:get_enforcer
|
||||||
placement = nova.api.openstack.placement.policy:get_enforcer
|
placement = placement.policy:get_enforcer
|
||||||
|
|
||||||
oslo.policy.policies =
|
oslo.policy.policies =
|
||||||
# The sample policies will be ordered by entry point and then by list
|
# The sample policies will be ordered by entry point and then by list
|
||||||
@ -48,7 +48,7 @@ oslo.policy.policies =
|
|||||||
# list_rules method into a separate entry point rather than using the
|
# list_rules method into a separate entry point rather than using the
|
||||||
# aggregate method.
|
# aggregate method.
|
||||||
nova = nova.policies:list_rules
|
nova = nova.policies:list_rules
|
||||||
placement = nova.api.openstack.placement.policies:list_rules
|
placement = placement.policies:list_rules
|
||||||
|
|
||||||
nova.compute.monitors.cpu =
|
nova.compute.monitors.cpu =
|
||||||
virt_driver = nova.compute.monitors.cpu.virt_driver:Monitor
|
virt_driver = nova.compute.monitors.cpu.virt_driver:Monitor
|
||||||
@ -75,8 +75,8 @@ console_scripts =
|
|||||||
nova-status = nova.cmd.status:main
|
nova-status = nova.cmd.status:main
|
||||||
nova-xvpvncproxy = nova.cmd.xvpvncproxy:main
|
nova-xvpvncproxy = nova.cmd.xvpvncproxy:main
|
||||||
wsgi_scripts =
|
wsgi_scripts =
|
||||||
nova-placement-api = nova.api.openstack.placement.wsgi:init_application
|
nova-placement-api = placement.wsgi:init_application
|
||||||
nova-api-wsgi = nova.api.openstack.compute.wsgi:init_application
|
nova-api-wsgi = compute.wsgi:init_application
|
||||||
nova-metadata-wsgi = nova.api.metadata.wsgi:init_application
|
nova-metadata-wsgi = nova.api.metadata.wsgi:init_application
|
||||||
|
|
||||||
nova.ipv6_backend =
|
nova.ipv6_backend =
|
||||||
|
Loading…
Reference in New Issue
Block a user