trio2o/tricircle/proxy/service.py
zhiyuan_cai 57f0ddbf91 Proxy for compute
Initial patch for compute proxy, now we can boot a vm and the
RPC request will be captured by dispatcher then sent to proxy.

Change-Id: I361d18e0b87ece3db113f6549f2b3c9bf50e1006
2015-12-02 09:41:13 +08:00

43 lines
1.3 KiB
Python

# Copyright 2015 Huawei Technologies Co., Ltd.
#
# 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 oslo_config.cfg import CONF
import tricircle.common.service as t_service
from tricircle.common.utils import get_import_path
from tricircle.proxy.compute_manager import ProxyComputeManager
_REPORT_INTERVAL = 30
_REPORT_INTERVAL_MAX = 60
def setup_server():
service = t_service.NovaService(
host=CONF.host,
# NOTE(zhiyuan) binary needs to start with "nova-"
# if nova service is used
binary="nova-proxy",
topic="proxy",
db_allowed=False,
periodic_enable=True,
report_interval=_REPORT_INTERVAL,
periodic_interval_max=_REPORT_INTERVAL_MAX,
manager=get_import_path(ProxyComputeManager),
)
t_service.fix_compute_service_exchange(service)
return service