Files
nova/nova/conductor/__init__.py
Sujitha 3bfcb1d2aa Config options: centralize options in conductor api
This change moves all of the configuration options previously defined
in nova/conductor/api to the new centralized nova/conf directory.

Blueprint centralize-config-options

Change-Id: I8c420ac1de16d18613062112b2d86a5f66149dbf
2016-02-09 14:06:51 +00:00

38 lines
1.2 KiB
Python

# Copyright 2012 IBM Corp.
#
# 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.conductor import api as conductor_api
import nova.conf
CONF = nova.conf.CONF
def API(*args, **kwargs):
use_local = kwargs.pop('use_local', False)
if CONF.conductor.use_local or use_local:
api = conductor_api.LocalAPI
else:
api = conductor_api.API
return api(*args, **kwargs)
def ComputeTaskAPI(*args, **kwargs):
use_local = kwargs.pop('use_local', False)
if CONF.conductor.use_local or use_local:
api = conductor_api.LocalComputeTaskAPI
else:
api = conductor_api.ComputeTaskAPI
return api(*args, **kwargs)