Ejemplo n.º 1
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()
    log = logging.getLogger(__name__)

    gmr.TextGuruMeditation.setup_autorun(version)

    launcher = service.process_launcher()
    started = 0
    for api in CONF.enabled_apis:
        should_use_ssl = api in CONF.enabled_ssl_apis
        try:
            server = service.WSGIService(api, use_ssl=should_use_ssl)
            launcher.launch_service(server, workers=server.workers or 1)
            started += 1
        except exception.PasteAppNotFound as ex:
            log.warning(
                _LW("%s. ``enabled_apis`` includes bad values. "
                    "Fix to remove this warning."), six.text_type(ex))

    if started == 0:
        log.error(
            _LE('No APIs were started. '
                'Check the enabled_apis config option.'))
        sys.exit(1)

    launcher.wait()
Ejemplo n.º 2
0
def main():
    """加载和设置配置参数,有两点需要注意:
    1. 调用rpc.set_defaults设置默认的exchange为nova,如果不设置则为
    openstack
    2. 调用rpc.init设置Transport和Notifier,Transport是
    oslo_messaging/transport.py/Transport实例,我采用的是默认的
    rpc_backend=rabbit,所以Transport采用的driver=oslo_messaging/
    _drivers/impl_rabbit.py/RabbitDriver;Notifier是一个通知消息发
    送器,它借助Transport完成通知消息的发送
    """
    config.parse_args(sys.argv)
    logging.setup('nova')
    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()
    """调用类方法nova/service.py/Service.create创建Service服务对象
    输入参数topic = compute, db_allowd = false;`create`方法是一个
    类方法(@classmethod),它首先基于输入参数和(/etc/nova.conf中的选
    项)设置配置,然后创建一个Service对象并返回给调用者
    """
    server = service.Service.create(binary='nova-compute',
                                    topic=CONF.compute_topic,
                                    db_allowed=CONF.conductor.use_local)
    """调用server方法启动服务并调用wait方法等待服务启动完成,serve方法创
    建Launcher服务启动实例对象(这里是ServiceLauncher)来启动服务,
    但最终会调用server.start方法启动服务。
    """
    service.serve(server)
    service.wait()
Ejemplo n.º 3
0
def main():
    """Parse options and call the appropriate class/method."""
    CONF.register_cli_opt(category_opt)
    try:
        config.parse_args(sys.argv)
        logging.setup("nova")
    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 nova-manage as root.'))
        return(2)

    objects.register_all()

    if CONF.category.name == "version":
        print(version.version_string_with_package())
        return(0)

    if CONF.category.name == "bash-completion":
        if not CONF.category.query_category:
            print(" ".join(CATEGORIES.keys()))
        elif CONF.category.query_category in CATEGORIES:
            fn = CATEGORIES[CONF.category.query_category]
            command_object = fn()
            actions = methods_of(command_object)
            print(" ".join([k for (k, v) in actions]))
        return(0)

    fn = CONF.category.action_fn
    fn_args = [arg.decode('utf-8') for arg in CONF.category.action_args]
    fn_kwargs = {}
    for k in CONF.category.action_kwargs:
        v = getattr(CONF.category, 'action_kwarg_' + k)
        if v is None:
            continue
        if isinstance(v, six.string_types):
            v = v.decode('utf-8')
        fn_kwargs[k] = v

    # call the action with the remaining arguments
    # check arguments
    try:
        cliutils.validate_args(fn, *fn_args, **fn_kwargs)
    except cliutils.MissingArgs as e:
        print(fn.__doc__)
        print(e)
        return(1)
    try:
        fn(*fn_args, **fn_kwargs)
        return(0)
    except Exception:
        print(_("Command failed, please check log for more info"))
        raise
Ejemplo n.º 4
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()
    gmr_opts.set_defaults(CONF)
    if 'osapi_compute' in CONF.enabled_apis:
        # NOTE(mriedem): This is needed for caching the nova-compute service
        # version.
        objects.Service.enable_min_version_cache()
    log = logging.getLogger(__name__)

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    launcher = service.process_launcher()
    started = 0
    for api in CONF.enabled_apis:
        should_use_ssl = api in CONF.enabled_ssl_apis
        try:
            server = service.WSGIService(api, use_ssl=should_use_ssl)
            launcher.launch_service(server, workers=server.workers or 1)
            started += 1
        except exception.PasteAppNotFound as ex:
            log.warning(
                "%s. ``enabled_apis`` includes bad values. "
                "Fix to remove this warning.", ex)

    if started == 0:
        log.error('No APIs were started. '
                  'Check the enabled_apis config option.')
        sys.exit(1)

    launcher.wait()
Ejemplo n.º 5
0
Archivo: api.py Proyecto: Juniper/nova
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()
    if 'osapi_compute' in CONF.enabled_apis:
        # NOTE(mriedem): This is needed for caching the nova-compute service
        # version.
        objects.Service.enable_min_version_cache()
    log = logging.getLogger(__name__)

    gmr.TextGuruMeditation.setup_autorun(version)

    launcher = service.process_launcher()
    started = 0
    for api in CONF.enabled_apis:
        should_use_ssl = api in CONF.enabled_ssl_apis
        try:
            server = service.WSGIService(api, use_ssl=should_use_ssl)
            launcher.launch_service(server, workers=server.workers or 1)
            started += 1
        except exception.PasteAppNotFound as ex:
            log.warning("%s. ``enabled_apis`` includes bad values. "
                        "Fix to remove this warning.", ex)

    if started == 0:
        log.error('No APIs were started. '
                  'Check the enabled_apis config option.')
        sys.exit(1)

    launcher.wait()
Ejemplo n.º 6
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("nova")
    global LOG
    LOG = logging.getLogger('nova.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']:
        msg = (_("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'") % {
            "action": CONF.action.name,
            "mac": CONF.action.mac,
            "ip": CONF.action.ip
        })
        LOG.debug(msg)
        CONF.action.func(CONF.action.mac, CONF.action.ip)
    else:
        try:
            network_id = int(os.environ.get('NETWORK_ID'))
        except TypeError:
            LOG.error(_("Environment variable 'NETWORK_ID' must be set."))
            return (1)

        print(init_leases(network_id))

    rpc.cleanup()
Ejemplo n.º 7
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")

    # NOTE(stephenfin): Yes, this is silly, but the whole thing is being
    # removed and we want to make the diff in individual changes as small as
    # possible
    if True:
        LOG.error('Nova network is deprecated and not supported '
                  'except as required for CellsV1 deployments.')
        return 1

    objects.register_all()
    gmr_opts.set_defaults(CONF)

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    cmd_common.block_db_access('nova-network')
    objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()

    LOG.warning('Nova network is deprecated and will be removed '
                'in the future')
    server = service.Service.create(binary='nova-network',
                                    topic=network_rpcapi.RPC_TOPIC,
                                    manager=CONF.network_manager)
    service.serve(server)
    service.wait()
Ejemplo n.º 8
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    # PF9 begin
    logging_pf9.setup("nova")
    # PF9 end
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-conductor',
                                    topic=CONF.conductor.topic,
                                    manager=CONF.conductor.manager)
    # PF9 change:
    if CONF.conductor.workers is None:
        # If unset, use openstack default of cpu count
        workers = processutils.get_worker_count()
    else:
        workers = CONF.conductor.workers
        # If set to 0, set it to half of cpu count
        if workers == 0:
            workers = (processutils.get_worker_count() + 1) / 2
    # PF9 end
    service.serve(server, workers=workers)
    service.wait()
Ejemplo n.º 9
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("nova")
    global LOG
    LOG = logging.getLogger('nova.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']:
        msg = (_("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'") %
               {"action": CONF.action.name,
                "mac": CONF.action.mac,
                "ip": CONF.action.ip})
        LOG.debug(msg)
        CONF.action.func(CONF.action.mac, CONF.action.ip)
    else:
        try:
            network_id = int(os.environ.get('NETWORK_ID'))
        except TypeError:
            LOG.error(_("Environment variable 'NETWORK_ID' must be set."))
            return(1)

        print(init_leases(network_id))

    rpc.cleanup()
Ejemplo n.º 10
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")

    if not CONF.cells.enable:
        LOG.error(
            _LE('Nova network is deprecated and not supported '
                'except as required for CellsV1 deployments.'))
        return 1

    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    cmd_common.block_db_access('nova-network')
    objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()

    LOG.warning(
        _LW('Nova network is deprecated and will be removed '
            'in the future'))
    server = service.Service.create(binary='nova-network',
                                    topic=CONF.network_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 11
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()
    if 'osapi_compute' in CONF.enabled_apis:
        # NOTE(mriedem): This is needed for caching the nova-compute service
        # version which is looked up when a server create request is made with
        # network id of 'auto' or 'none'.
        objects.Service.enable_min_version_cache()
    log = logging.getLogger(__name__)

    gmr.TextGuruMeditation.setup_autorun(version)

    launcher = service.process_launcher()
    started = 0
    for api in CONF.enabled_apis:
        should_use_ssl = api in CONF.enabled_ssl_apis
        try:
            server = service.WSGIService(api, use_ssl=should_use_ssl)
            launcher.launch_service(server, workers=server.workers or 1)
            started += 1
        except exception.PasteAppNotFound as ex:
            log.warning(
                _LW("%s. ``enabled_apis`` includes bad values. "
                    "Fix to remove this warning."), six.text_type(ex))

    if started == 0:
        log.error(
            _LE('No APIs were started. '
                'Check the enabled_apis config option.'))
        sys.exit(1)

    launcher.wait()
Ejemplo n.º 12
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, "nova")
    global LOG
    LOG = logging.getLogger("nova.dhcpbridge")
    objects.register_all()

    if not CONF.conductor.use_local:
        block_db_access()
        objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()
    else:
        LOG.warning(_LW("Conductor local mode is deprecated and will " "be removed in a subsequent release"))

    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()
Ejemplo n.º 13
0
def main():
    """Parse options and call the appropriate class/method."""
    CONF.register_cli_opt(category_opt)
    try:
        config.parse_args(sys.argv)
        logging.setup("nova")
    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 nova-manage as root."))
        return 2

    objects.register_all()

    if CONF.category.name == "version":
        print(version.version_string_with_package())
        return 0

    if CONF.category.name == "bash-completion":
        if not CONF.category.query_category:
            print(" ".join(CATEGORIES.keys()))
        elif CONF.category.query_category in CATEGORIES:
            fn = CATEGORIES[CONF.category.query_category]
            command_object = fn()
            actions = methods_of(command_object)
            print(" ".join([k for (k, v) in actions]))
        return 0

    fn = CONF.category.action_fn
    fn_args = [arg.decode("utf-8") for arg in CONF.category.action_args]
    fn_kwargs = {}
    for k in CONF.category.action_kwargs:
        v = getattr(CONF.category, "action_kwarg_" + k)
        if v is None:
            continue
        if isinstance(v, six.string_types):
            v = v.decode("utf-8")
        fn_kwargs[k] = v

    # call the action with the remaining arguments
    # check arguments
    try:
        cliutils.validate_args(fn, *fn_args, **fn_kwargs)
    except cliutils.MissingArgs as e:
        print(fn.__doc__)
        print(e)
        return 1
    try:
        fn(*fn_args, **fn_kwargs)
        return 0
    except Exception:
        print(_("Command failed, please check log for more info"))
        raise
Ejemplo n.º 14
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    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()
    else:
        LOG.warning(
            _LW('Conductor local mode is deprecated and will '
                'be removed in a subsequent release'))

    LOG.warning(
        _LW('Nova network is deprecated and will be removed '
            'in the future'))
    server = service.Service.create(binary='nova-network',
                                    topic=CONF.network_topic,
                                    db_allowed=CONF.conductor.use_local)
    service.serve(server)
    service.wait()
Ejemplo n.º 15
0
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    server = service.Service.create(binary="nova-conductor", topic=CONF.conductor.topic, manager=CONF.conductor.manager)
    service.serve(server, workers=CONF.conductor.workers)
    service.wait()
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup("service_monitor")
    utils.monkey_patch()
    LOG = logging.getLogger('service_monitor')
    monitor = ServiceMonitor();
    monitor.monitor(True)
Ejemplo n.º 17
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    global LOG
    LOG = logging.getLogger('nova.virt.baremetal.deploy_helper')
    objects.register_all()
    app = BareMetalDeploy()
    srv = simple_server.make_server('', 10000, app)
    srv.serve_forever()
Ejemplo n.º 18
0
Archivo: cert.py Proyecto: apporc/nova
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    server = service.Service.create(binary='nova-cert', topic=CONF.cert_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 19
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    global LOG
    LOG = logging.getLogger('nova.virt.baremetal.deploy_helper')
    objects.register_all()
    app = BareMetalDeploy()
    srv = simple_server.make_server('', 10000, app)
    srv.serve_forever()
Ejemplo n.º 20
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()

    server = service.Service.create(binary='nova-console',
                                    topic=CONF.console_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 21
0
def main():

    lock_filename = '/tmp/locking.lock'
    lock_file = open(lock_filename, 'w')
    try:
        fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
    except IOError:
        print('Cannot lock: ' + lock_filename)
        sys.exit(1)

    if len(sys.argv) < 3 or sys.argv[1] != '--config-file':
        usage()
        exit(1)
    detection_only = False
    if '--detection-only' in sys.argv:
        detection_only = True
        sys.argv.remove('--detection-only')

    out, err = utils.execute('which', 'multipath', check_exit_code=False)
    if 'multipath' not in out:
        print('Info: Multipath tools not installed. No cleanup need be done.')
        exit(0)

    multipath_flush_on_last_del = False
    multipath_conf_path = "/etc/multipath.conf"
    if os.path.exists(multipath_conf_path):
        flush_on_last_del_yes = re.compile(r'\s*flush_on_last_del.*yes')
        for line in open(multipath_conf_path, "r"):
            if flush_on_last_del_yes.match(line):
                multipath_flush_on_last_del = True
                break
    if not multipath_flush_on_last_del:
        print("Warning: 'flush_on_last_del yes' is not seen in"
              " /etc/multipath.conf."
              " 'map in use' failure may show up during cleanup.")

    CONF(sys.argv[1:])

    rpc.set_defaults(control_exchange='nova')
    rpc.init(CONF)

    utils.monkey_patch()
    objects.register_all()
    objects_base.NovaObject.indirection_api = \
        conductor_rpcapi.ConductorAPI()

    # connect_volume and disconnect_volume in nova/virt/libvirt/volume.py
    # need be adjusted to take the same 'external=True' lock for
    # synchronization
    @utils.synchronized('connect_volume', external=True)
    def do_cleanup(detection_only):
        cleaner = FaultyDevicesCleaner(detection_only)
        cleaner.cleanup()

    do_cleanup(detection_only)

    os.unlink('/tmp/locking.lock')
Ejemplo n.º 22
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    server = service.Service.create(binary='nova-cert', topic=CONF.cert_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 23
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()

    server = service.Service.create(binary='nova-console',
                                    topic=CONF.console_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 24
0
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    server = service.Service.create(binary='nova-sample',
                                    topic='sample',
                                    manager='nova.sample.manager.SampleManager')
    service.serve(server, workers=CONF.conductor.workers)
    service.wait()
Ejemplo n.º 25
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    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()
Ejemplo n.º 26
0
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    server = service.Service.create(binary='nova-android',
                                    topic=CONF.android.topic,
                                    manager='nova.android.agent.manager.AndroidManager')
    service.serve(server, workers=CONF.conductor.workers)
    service.wait()
Ejemplo n.º 27
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary="nova-consoleauth", topic=CONF.consoleauth_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 28
0
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    server = service.Service.create(binary='nova-conductor',
                                    topic=CONF.conductor.topic,
                                    manager=CONF.conductor.manager)
    service.serve(server, workers=CONF.conductor.workers)
    service.wait()
Ejemplo n.º 29
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    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()
Ejemplo n.º 30
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-loadbalancer')
    service.serve(server)
    service.wait()
Ejemplo n.º 31
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-console',
                                    topic=console_rpcapi.RPC_TOPIC)
    service.serve(server)
    service.wait()
Ejemplo n.º 32
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-loadbalancer')
    service.serve(server)
    service.wait()
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup("ccbilling")
    utils.monkey_patch()

    server = billing_service.Service.create(binary='cc-billing',
                                    topic=CONF.ccbilling.topic,
                                    manager=CONF.ccbilling.manager)
    service.serve(server, workers=CONF.ccbilling.workers)
    service.wait()
Ejemplo n.º 34
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-consoleauth',
                                    topic=CONF.consoleauth_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 35
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary="nova-scheduler", topic=CONF.scheduler_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 36
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    server = service.Service.create(binary='nova-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()
Ejemplo n.º 37
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()
    gmr_opts.set_defaults(CONF)

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    server = service.Service.create(binary='nova-console',
                                    topic=console_rpcapi.RPC_TOPIC)
    service.serve(server)
    service.wait()
Ejemplo n.º 38
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-scheduler',
                                    topic=CONF.scheduler_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 39
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary="nova-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()
Ejemplo n.º 40
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    launcher = service.process_launcher()
    server = service.Service('daolisync')
    launcher.launch_service(server)
    launcher.wait()
Ejemplo n.º 41
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    should_use_ssl = "ec2" in CONF.enabled_ssl_apis
    server = service.WSGIService("ec2", use_ssl=should_use_ssl, max_url_len=16384)
    service.serve(server, workers=server.workers)
    service.wait()
Ejemplo n.º 42
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'nova')
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-cells',
                                    topic=CONF.cells.topic,
                                    manager=CONF.cells.manager)
    service.serve(server)
    service.wait()
Ejemplo n.º 43
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    should_use_ssl = 'ec2' in CONF.enabled_ssl_apis
    server = service.WSGIService('ec2', use_ssl=should_use_ssl,
                                 max_url_len=16384)
    service.serve(server, workers=server.workers)
    service.wait()
Ejemplo n.º 44
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()
    objects.Service.enable_min_version_cache()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-scheduler',
                                    topic=scheduler_rpcapi.RPC_TOPIC)
    service.serve(server)
    service.wait()
Ejemplo n.º 45
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    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
        server = service.WSGIService(api, use_ssl=should_use_ssl)
        launcher.launch_service(server, workers=server.workers or 1)
    launcher.wait()
Ejemplo n.º 46
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    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
        server = service.WSGIService(api, use_ssl=should_use_ssl)
        launcher.launch_service(server, workers=server.workers or 1)
    launcher.wait()
Ejemplo n.º 47
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()
    gmr_opts.set_defaults(CONF)
    objects.Service.enable_min_version_cache()

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    server = service.Service.create(binary='nova-conductor',
                                    topic=rpcapi.RPC_TOPIC)
    workers = CONF.conductor.workers or processutils.get_worker_count()
    service.serve(server, workers=workers)
    service.wait()
Ejemplo n.º 48
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    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()
Ejemplo n.º 49
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()  #为指定model的所有方法增加decorator。
    objects.register_all()  #import nova.objects下所有model
    objects.Service.enable_min_version_cache()  #低版本缓存 ???

    gmr.TextGuruMeditation.setup_autorun(version)  #???

    server = service.Service.create(
        binary='nova-scheduler',
        topic=scheduler_rpcapi.RPC_TOPIC)  #"scheduler"
    service.serve(server)
    service.wait()
Ejemplo n.º 50
0
def main():
    config.parse_args(sys.argv)
    logging.setup("nova")
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary='nova-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()
Ejemplo n.º 51
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()
    gmr_opts.set_defaults(CONF)
    objects.Service.enable_min_version_cache()

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    server = service.Service.create(binary='nova-scheduler',
                                    topic=scheduler_rpcapi.RPC_TOPIC)
    service.serve(server)
    service.wait()
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()
    gmr_opts.set_defaults(CONF)
    objects.Service.enable_min_version_cache()

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    server = service.Service.create(binary='nova-conductor',
                                    topic=rpcapi.RPC_TOPIC)
    workers = CONF.conductor.workers or processutils.get_worker_count()
    service.serve(server, workers=workers)
    service.wait()
Ejemplo n.º 53
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    LOG = logging.getLogger('nova.all')
    utils.monkey_patch()
    objects.register_all()
    launcher = service.process_launcher()

    # nova-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 [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 [
            'nova-compute', 'nova-network', 'nova-scheduler', 'nova-cert',
            'nova-conductor'
    ]:

        # FIXME(sirp): Most service configs are defined in nova/service.py, but
        # conductor has set a new precedent of storing these configs
        # nova/<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 == 'nova-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()
Ejemplo n.º 54
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    utils.monkey_patch()
    objects.register_all()
    log = logging.getLogger(__name__)
    versionutils.report_deprecated_feature(
        log, _LW("The nova-cert service is deprecated and will be removed " "in a future release.")
    )

    gmr.TextGuruMeditation.setup_autorun(version)

    server = service.Service.create(binary="nova-cert", topic=CONF.cert_topic)
    service.serve(server)
    service.wait()
Ejemplo n.º 55
0
    def run_me(self):

        # this is to make parse_args happy and still be able to use sys.argv later for argparse
        dummy_argv = []
        dummy_argv.append(sys.argv[0])
        config.parse_args(dummy_argv)

        # looks like this is needed
        objects.register_all()

        self.get_db_url()
        self.makeConnection()

        self.buildup_nova_neutron_connection()
        self.compare_and_fix_instance_info_cache()
Ejemplo n.º 56
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'nova')
    objects.register_all()
    gmr_opts.set_defaults(CONF)

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    LOG.warning('Cells v1 is deprecated in favor of Cells v2 and will be '
                'removed in the future.')
    server = service.Service.create(binary='nova-cells',
                                    topic=cells.TOPIC,
                                    manager='nova.cells.manager.CellsManager')
    service.serve(server)
    service.wait()
Ejemplo n.º 57
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    objects.register_all()
    gmr_opts.set_defaults(CONF)
    # NOTE(mriedem): This is needed for caching the nova-compute service
    # version.
    objects.Service.enable_min_version_cache()

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    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()
Ejemplo n.º 58
0
def main():
    objects.register_all()
    config.parse_args(sys.argv)
    logging.setup('nova')
    utils.monkey_patch()

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

    server = service.Service.create(binary='nova-compute',
                                    topic=CONF.compute_topic,
                                    db_allowed=False)
    service.serve(server)
    service.wait()