def initialize_application(): objects.register_all() CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") rpc.init(CONF) return wsgi_common.Loader().load_app(name='osapi_migration')
def main(): objects.register_all() CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") LOG = logging.getLogger('guts.all') utils.monkey_patch() gmr.TextGuruMeditation.setup_autorun(version) rpc.init(CONF) launcher = service.process_launcher() # guts-api try: server = service.WSGIService('osapi_migration') launcher.launch_service(server, workers=server.workers or 1) except (Exception, SystemExit): LOG.exception(_LE('Failed to load osapi_migration')) # guts-migration try: launcher.launch_service( service.Service.create(binary='guts-migration')) except (Exception, SystemExit): LOG.exception(_LE('Failed to load guts-migration')) launcher.wait()
def main(): objects.register_all() CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") utils.monkey_patch() server = service.Service.create(binary='guts-migration') service.serve(server) service.wait()
def main(): objects.register_all() CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") python_logging.captureWarnings(True) utils.monkey_patch() server = service.Service.create(binary='guts-scheduler') service.serve(server) service.wait()
def main(): objects.register_all() CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") utils.monkey_patch() rpc.init(CONF) launcher = service.process_launcher() server = service.WSGIService('osapi_migration') launcher.launch_service(server, workers=server.workers) launcher.wait()
def main(): objects.register_all() CONF(sys.argv[1:], project="guts", version=version.version_string()) logging.setup(CONF, "guts") utils.monkey_patch() rpc.init(CONF) launcher = service.process_launcher() server = service.WSGIService("osapi_migration") launcher.launch_service(server, workers=server.workers) launcher.wait()
def main(): objects.register_all() CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") utils.monkey_patch() launcher = service.get_launcher() LOG = logging.getLogger(__name__) source_service_started = False destination_service_started = False if CONF.enabled_source_hypervisors: for source in CONF.enabled_source_hypervisors: host = "%s@%s" % (CONF.host, source) try: server = service.Service.create(host=host, service_name=source, binary="guts-source") except Exception: msg = _('Source service %s failed to start.') % (host) LOG.exception(msg) else: launcher.launch_service(server) source_service_started = True if CONF.enabled_destination_hypervisors: for dest in CONF.enabled_destination_hypervisors: host = "%s@%s" % (CONF.host, dest) try: server = service.Service.create(host=host, service_name=dest, binary="guts-destination") except Exception: msg = _('Destination service %s failed to start.') % (host) LOG.exception(msg) else: launcher.launch_service(server) destination_service_started = True if not (source_service_started or destination_service_started): msg = _('No migration service(s) started successfully, terminating.') LOG.error(msg) sys.exit(1) launcher.wait()
def main(): objects.register_all() """Parse options and call the appropriate class/method.""" CONF.register_cli_opt(category_opt) script_name = sys.argv[0] if len(sys.argv) < 2: print(_("\nOpenStack Guts version: %(version)s\n") % {'version': version.version_string()}) print(script_name + " category action [<args>]") print(_("Available categories:")) for category in CATEGORIES: print(_("\t%s") % category) sys.exit(2) try: CONF(sys.argv[1:], project='guts', version=version.version_string()) logging.setup(CONF, "guts") except cfg.ConfigDirNotFoundError as details: print(_("Invalid directory: %s") % details) sys.exit(2) except cfg.ConfigFilesNotFoundError: cfgfile = CONF.config_file[-1] if CONF.config_file else None if cfgfile and not os.access(cfgfile, os.R_OK): st = os.stat(cfgfile) print(_("Could not read %s. Re-running with sudo") % cfgfile) try: os.execvp('sudo', ['sudo', '-u', '#%s' % st.st_uid] + sys.argv) except Exception: print(_('sudo failed, continuing as if nothing happened')) print(_('Please re-run guts-manage as root.')) sys.exit(2) fn = CONF.category.action_fn fn_args = fetch_func_args(fn) fn(*fn_args)