Previously, instances updated their status by updating the database on the host directly. Necessarily, each instance would need access to the database to stay updated. Trove's new conductor service eliminates that need by working as a proxy for those instances. By sending a heartbeat to conductor via RPC, conductor updates the database on the host on behalf of the instance. As backups also made use of the host database, the backup code has been refactored to take richer inputs to remove the need to query the host database, and now conductor is also used to submit updates to backup states. Implements: blueprint trove-conductor Change-Id: I4cb34baedd0e3a50051f9e66de95c9028c66e4b5
63 lines
1.7 KiB
Python
Executable File
63 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
# Copyright 2013 Rackspace Hosting
|
|
# 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.
|
|
|
|
import eventlet
|
|
eventlet.monkey_patch(all=True, thread=False)
|
|
|
|
import gettext
|
|
import traceback
|
|
import sys
|
|
|
|
|
|
gettext.install('trove', unicode=1)
|
|
|
|
|
|
from trove.common import cfg
|
|
from trove.common import debug_utils
|
|
from trove.common.rpc import service as rpc_service
|
|
from trove.db import get_db_api
|
|
from trove.openstack.common import log as logging
|
|
from trove.openstack.common import service as openstack_service
|
|
|
|
CONF = cfg.CONF
|
|
|
|
|
|
def main():
|
|
get_db_api().configure_db(CONF)
|
|
manager = 'trove.conductor.manager.Manager'
|
|
topic = CONF.conductor_queue
|
|
server = rpc_service.RpcService(manager=manager, topic=topic)
|
|
launcher = openstack_service.launch(server,
|
|
workers=CONF.trove_conductor_workers)
|
|
launcher.wait()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
cfg.parse_args(sys.argv)
|
|
logging.setup(None)
|
|
|
|
debug_utils.setup()
|
|
|
|
if not debug_utils.enabled():
|
|
eventlet.monkey_patch(thread=True)
|
|
try:
|
|
main()
|
|
except RuntimeError as error:
|
|
print traceback.format_exc()
|
|
sys.exit("ERROR: %s" % error)
|