There was a eventlet.monkey_patch [1] when we launch a nova process(like nova-api, nova-compute), but it's invalid under the uwsgi mode. But there are concurrency requirements in the api service, such as, when listing instances cross multiple cells we're using greenthreads and oslo.db does a time.sleep to allow switching greenthreads [2]. So, in this patch we add the monkey_patch in the uwsgi application setup and refactor the monkey patching to use common code. [1] https://github.com/openstack/nova/blob/233ea58/nova/cmd/__init__.py#L26 [2] https://github.com/openstack/oslo.db/blob/9c66959/oslo_db/sqlalchemy/engines.py#L51 Closes-bug: #1787331 Change-Id: Ie7bf5d012e2ccbcd63c262ddaf739782afcdaf56
19 lines
679 B
Python
19 lines
679 B
Python
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
|
# 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.
|
|
|
|
from nova import utils
|
|
|
|
utils.monkey_patch()
|