Files
trove/bin/trove-guestagent
Denis Makogon 110f20e6a1 Disable redundant DB initialization on guesagent's start
Reasons:
 - Guestagent uses conductor to communicate with database.
 - No direct connection to DB is required.
   But GA still initializes DB connection on start.
   This prevent running guestagent without MySQL installed in guest,
   which could be useful for datastores other then MySQL.

Changes:
 - This patch disables DB initialization on GA start.

Closes-bug: #1256046
Change-Id: I23dafdfbc7b04c24f1b4ddd714005eb615641cd6
2014-01-24 15:44:14 +02:00

68 lines
2.2 KiB
Python
Executable File

#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# 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()
import gettext
import os
import sys
gettext.install('trove', unicode=1)
# If ../trove/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir, 'trove', '__init__.py')):
sys.path.insert(0, possible_topdir)
from trove.common import cfg
from trove.common.rpc import service as rpc_service
from oslo.config import cfg as openstack_cfg
from trove.openstack.common import log as logging
from trove.openstack.common import service as openstack_service
CONF = cfg.CONF
CONF.register_opts([openstack_cfg.StrOpt('guest_id')])
def main():
cfg.parse_args(sys.argv)
from trove.guestagent import dbaas
logging.setup(None)
try:
manager = dbaas.datastore_registry().get(CONF.datastore_manager)
if not manager:
msg = ("Manager class not registered for datastore manager %s" %
CONF.datastore_manager)
raise RuntimeError(msg)
server = rpc_service.RpcService(manager=manager, host=CONF.guest_id)
launcher = openstack_service.launch(server)
launcher.wait()
except RuntimeError as error:
import traceback
print(traceback.format_exc())
sys.exit("ERROR: %s" % error)
if __name__ == '__main__':
main()