Пример #1
0
 def setUp(self):
     super(ConfFixture, self).setUp()
     self.conf.set_default('api_paste_config',
                           paths.state_path_def('etc/patron/api-paste.ini'))
     self.conf.set_default('host', 'fake-mini')
     self.conf.set_default('compute_driver',
                           'patron.virt.fake.SmallFakeDriver')
     self.conf.set_default('fake_network', True)
     self.conf.set_default('flat_network_bridge', 'br100')
     self.conf.set_default('floating_ip_dns_manager',
                           'patron.tests.unit.utils.dns_manager')
     self.conf.set_default('instance_dns_manager',
                           'patron.tests.unit.utils.dns_manager')
     self.conf.set_default('network_size', 8)
     self.conf.set_default('num_networks', 2)
     self.conf.set_default('use_ipv6', True)
     self.conf.set_default('vlan_interface', 'eth0')
     self.conf.set_default('auth_strategy', 'noauth2')
     config.parse_args([], default_config_files=[])
     self.conf.set_default('connection', "sqlite://", group='database')
     self.conf.set_default('connection', "sqlite://", group='api_database')
     self.conf.set_default('sqlite_synchronous', False, group='database')
     self.conf.set_default('sqlite_synchronous', False,
             group='api_database')
     self.conf.set_default('fatal_exception_format_errors', True)
     self.conf.set_default('enabled', True, 'osapi_v3')
     self.conf.set_default('force_dhcp_release', False)
     self.conf.set_default('periodic_enable', False)
     self.addCleanup(utils.cleanup_dns_managers)
     self.addCleanup(ipv6.api.reset_backend)
Пример #2
0
def main():
    """Parse environment and arguments and call the appropriate action."""
    config.parse_args(sys.argv,
                      default_config_files=jsonutils.loads(
                          os.environ['CONFIG_FILE']))

    logging.setup(CONF, "patron")
    global LOG
    LOG = logging.getLogger('patron.dhcpbridge')
    objects.register_all()

    if not CONF.conductor.use_local:
        block_db_access()
        objects_base.NovaObject.indirection_api = \
            conductor_rpcapi.ConductorAPI()

    if CONF.action.name in ['add', 'del', 'old']:
        LOG.debug(
            "Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'", {
                "action": CONF.action.name,
                "mac": CONF.action.mac,
                "ip": CONF.action.ip
            })
        CONF.action.func(CONF.action.mac, CONF.action.ip)
    else:
        try:
            network_id = int(os.environ.get('NETWORK_ID'))
        except TypeError:
            LOG.error(_LE("Environment variable 'NETWORK_ID' must be set."))
            return (1)

        print(init_leases(network_id))

    rpc.cleanup()
Пример #3
0
def main():
    """Parse environment and arguments and call the appropriate action."""
    config.parse_args(sys.argv,
        default_config_files=jsonutils.loads(os.environ['CONFIG_FILE']))

    logging.setup(CONF, "patron")
    global LOG
    LOG = logging.getLogger('patron.dhcpbridge')
    objects.register_all()

    if not CONF.conductor.use_local:
        block_db_access()
        objects_base.NovaObject.indirection_api = \
            conductor_rpcapi.ConductorAPI()

    if CONF.action.name in ['add', 'del', 'old']:
        LOG.debug("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'",
                  {"action": CONF.action.name,
                   "mac": CONF.action.mac,
                   "ip": CONF.action.ip})
        CONF.action.func(CONF.action.mac, CONF.action.ip)
    else:
        try:
            network_id = int(os.environ.get('NETWORK_ID'))
        except TypeError:
            LOG.error(_LE("Environment variable 'NETWORK_ID' must be set."))
            return(1)

        print(init_leases(network_id))

    rpc.cleanup()
Пример #4
0
def main():
    # set default web flag option
    CONF.set_default('web', None)
    config.parse_args(sys.argv)

    baseproxy.proxy(
        host=CONF.serial_console.serialproxy_host,
        port=CONF.serial_console.serialproxy_port)
Пример #5
0
def main():
    # set default web flag option
    CONF.set_default('web', '/usr/share/novnc')
    config.parse_args(sys.argv)

    baseproxy.proxy(
        host=CONF.novncproxy_host,
        port=CONF.novncproxy_port)
Пример #6
0
def main():
    config.parse_args(sys.argv)
    logging.setup(config.CONF, "patron")

    gmr.TextGuruMeditation.setup_autorun(version)

    wsgi_server = xvp_proxy.get_wsgi_server()
    service.serve(wsgi_server)
    service.wait()
Пример #7
0
def main():
    config.parse_args(sys.argv)
    logging.setup(config.CONF, "patron")
    utils.monkey_patch()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = s3server.get_wsgi_server()
    service.serve(server)
    service.wait()
Пример #8
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-cert', topic=CONF.cert_topic)
    service.serve(server)
    service.wait()
Пример #9
0
def main():
    config.parse_args(sys.argv)
    logging.setup(config.CONF, "patron")
    utils.monkey_patch()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = s3server.get_wsgi_server()
    service.serve(server)
    service.wait()
Пример #10
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-console',
                                    topic=CONF.console_topic)
    service.serve(server)
    service.wait()
Пример #11
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary="patron-scheduler", topic=CONF.scheduler_topic)
    service.serve(server)
    service.wait()
Пример #12
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-consoleauth',
                                    topic=CONF.consoleauth_topic)
    service.serve(server)
    service.wait()
Пример #13
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-scheduler',
                                    topic=CONF.scheduler_topic)
    service.serve(server)
    service.wait()
Пример #14
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    should_use_ssl = "osapi_compute" in CONF.enabled_ssl_apis
    server = service.WSGIService("osapi_compute", use_ssl=should_use_ssl)
    service.serve(server, workers=server.workers)
    service.wait()
Пример #15
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    should_use_ssl = 'osapi_compute' in CONF.enabled_ssl_apis
    server = service.WSGIService('osapi_compute', use_ssl=should_use_ssl)
    service.serve(server, workers=server.workers)
    service.wait()
Пример #16
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'patron')
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-cells',
                                    topic=CONF.cells.topic,
                                    manager=CONF.cells.manager)
    service.serve(server)
    service.wait()
Пример #17
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'patron')
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-cells',
                                    topic=CONF.cells.topic,
                                    manager=CONF.cells.manager)
    service.serve(server)
    service.wait()
Пример #18
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-conductor',
                                    topic=CONF.conductor.topic,
                                    manager=CONF.conductor.manager)
    workers = CONF.conductor.workers or processutils.get_worker_count()
    service.serve(server, workers=workers)
    service.wait()
Пример #19
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='patron-verify',
                                    topic=CONF.verify.topic,
                                    manager=CONF.verify.manager)
    workers = CONF.verify.workers or processutils.get_worker_count()
    service.serve(server, workers=workers)
    service.wait()
Пример #20
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    if not CONF.conductor.use_local:
        objects_base.NovaObject.indirection_api = \
            conductor_rpcapi.ConductorAPI()

    should_use_ssl = 'metadata' in CONF.enabled_ssl_apis
    server = service.WSGIService('metadata', use_ssl=should_use_ssl)
    service.serve(server, workers=server.workers)
    service.wait()
Пример #21
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    LOG = logging.getLogger('patron.all')
    utils.monkey_patch()
    objects.register_all()
    launcher = service.process_launcher()

    # patron-api
    for api in CONF.enabled_apis:
        try:
            should_use_ssl = api in CONF.enabled_ssl_apis
            server = service.WSGIService(api, use_ssl=should_use_ssl)
            launcher.launch_service(server, workers=server.workers or 1)
        except (Exception, SystemExit):
            LOG.exception(_LE('Failed to load %s-api'), api)

    for mod in [s3server, xvp_proxy]:
        try:
            launcher.launch_service(mod.get_wsgi_server())
        except (Exception, SystemExit):
            LOG.exception(_LE('Failed to load %s'), mod.__name__)

    for binary in ['patron-compute', 'patron-network', 'patron-scheduler',
                   'patron-cert', 'patron-conductor']:

        # FIXME(sirp): Most service configs are defined in patron/service.py, but
        # conductor has set a new precedent of storing these configs
        # patron/<service>/api.py.
        #
        # We should update the existing services to use this new approach so we
        # don't have to treat conductor differently here.
        if binary == 'patron-conductor':
            topic = CONF.conductor.topic
            manager = CONF.conductor.manager
        else:
            topic = None
            manager = None

        try:
            launcher.launch_service(service.Service.create(binary=binary,
                                                           topic=topic,
                                                          manager=manager))
        except (Exception, SystemExit):
            LOG.exception(_LE('Failed to load %s'), binary)
    launcher.wait()
Пример #22
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    if not CONF.conductor.use_local:
        block_db_access()
        objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()

    server = service.Service.create(
        binary="patron-compute", topic=CONF.compute_topic, db_allowed=CONF.conductor.use_local
    )
    service.serve(server)
    service.wait()
Пример #23
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    if not CONF.conductor.use_local:
        block_db_access()
        objects_base.NovaObject.indirection_api = \
            conductor_rpcapi.ConductorAPI()

    server = service.Service.create(binary='patron-network',
                                    topic=CONF.network_topic,
                                    db_allowed=CONF.conductor.use_local)
    service.serve(server)
    service.wait()
Пример #24
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    launcher = service.process_launcher()
    for api in CONF.enabled_apis:
        should_use_ssl = api in CONF.enabled_ssl_apis
        if api == 'ec2':
            server = service.WSGIService(api, use_ssl=should_use_ssl,
                                         max_url_len=16384)
        else:
            server = service.WSGIService(api, use_ssl=should_use_ssl)
        launcher.launch_service(server, workers=server.workers or 1)
    launcher.wait()
Пример #25
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    launcher = service.process_launcher()
    for api in CONF.enabled_apis:
        should_use_ssl = api in CONF.enabled_ssl_apis
        if api == 'ec2':
            server = service.WSGIService(api,
                                         use_ssl=should_use_ssl,
                                         max_url_len=16384)
        else:
            server = service.WSGIService(api, use_ssl=should_use_ssl)
        launcher.launch_service(server, workers=server.workers or 1)
    launcher.wait()
Пример #26
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "patron")
    LOG = logging.getLogger("patron.all")
    utils.monkey_patch()
    objects.register_all()
    launcher = service.process_launcher()

    # patron-api
    for api in CONF.enabled_apis:
        try:
            should_use_ssl = api in CONF.enabled_ssl_apis
            server = service.WSGIService(api, use_ssl=should_use_ssl)
            launcher.launch_service(server, workers=server.workers or 1)
        except (Exception, SystemExit):
            LOG.exception(_LE("Failed to load %s-api"), api)

    for mod in [s3server, xvp_proxy]:
        try:
            launcher.launch_service(mod.get_wsgi_server())
        except (Exception, SystemExit):
            LOG.exception(_LE("Failed to load %s"), mod.__name__)

    for binary in ["patron-compute", "patron-network", "patron-scheduler", "patron-cert", "patron-conductor"]:

        # FIXME(sirp): Most service configs are defined in patron/service.py, but
        # conductor has set a new precedent of storing these configs
        # patron/<service>/api.py.
        #
        # We should update the existing services to use this new approach so we
        # don't have to treat conductor differently here.
        if binary == "patron-conductor":
            topic = CONF.conductor.topic
            manager = CONF.conductor.manager
        else:
            topic = None
            manager = None

        try:
            launcher.launch_service(service.Service.create(binary=binary, topic=topic, manager=manager))
        except (Exception, SystemExit):
            LOG.exception(_LE("Failed to load %s"), binary)
    launcher.wait()
Пример #27
0
def main():
    config.parse_args(sys.argv)

    baseproxy.proxy(
        host=CONF.spice.html5proxy_host,
        port=CONF.spice.html5proxy_port)