def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs log.set_defaults(default_log_levels=log.get_default_log_levels() + _EXTRA_DEFAULT_LOG_LEVELS) options.set_defaults(CONF, connection=_DEFAULT_SQL_CONNECTION, sqlite_db='nova.sqlite') rpc.set_defaults(control_exchange='nova') cache.configure(CONF) debugger.register_cli_opts() config.set_middleware_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs if CONF.glance.debug: extra_default_log_levels = ['glanceclient=DEBUG'] else: extra_default_log_levels = ['glanceclient=WARN'] log.set_defaults(default_log_levels=log.get_default_log_levels() + extra_default_log_levels) rpc.set_defaults(control_exchange='nova') if profiler: profiler.set_defaults(CONF) config.set_middleware_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs if CONF.glance.debug: extra_default_log_levels = ['glanceclient=DEBUG'] else: extra_default_log_levels = ['glanceclient=WARN'] # NOTE(danms): DEBUG logging in privsep will result in some large # and potentially sensitive things being logged. extra_default_log_levels.append('oslo.privsep.daemon=INFO') log.set_defaults(default_log_levels=log.get_default_log_levels() + extra_default_log_levels) rpc.set_defaults(control_exchange='nova') if profiler: profiler.set_defaults(CONF) config.set_middleware_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs if CONF.glance.debug: extra_default_log_levels = ['glanceclient=DEBUG'] else: extra_default_log_levels = ['glanceclient=WARN'] log.set_defaults(default_log_levels=log.get_default_log_levels() + extra_default_log_levels) rpc.set_defaults(control_exchange='nova') config.set_middleware_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs if CONF.glance.debug: extra_default_log_levels = ['glanceclient=DEBUG'] else: extra_default_log_levels = ['glanceclient=WARN'] # NOTE(danms): DEBUG logging in privsep will result in some large # and potentially sensitive things being logged. extra_default_log_levels.append('oslo.privsep.daemon=INFO') log.set_defaults(default_log_levels=log.get_default_log_levels() + extra_default_log_levels) rpc.set_defaults(control_exchange='nova') if profiler: profiler.set_defaults(CONF) config.set_middleware_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF) placement_db.configure(CONF)
def __init__(self, database='main'): super(Database, self).__init__() # NOTE(pkholkin): oslo_db.enginefacade is configured in tests the same # way as it is done for any other service that uses db global SESSION_CONFIGURED if not SESSION_CONFIGURED: session.configure(CONF) SESSION_CONFIGURED = True self.database = database if database == 'main': self.get_engine = session.get_engine elif database == 'api': self.get_engine = session.get_api_engine
def parse_args(argv, default_config_files=None, configure_db=True): log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS) log.register_options(CONF) options.set_defaults(CONF, connection=_DEFAULT_SQL_CONNECTION, sqlite_db='nova.sqlite') rpc.set_defaults(control_exchange='nova') debugger.register_cli_opts() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs log.set_defaults(default_log_levels=log.get_default_log_levels() + _EXTRA_DEFAULT_LOG_LEVELS) rpc.set_defaults(control_exchange='nova') config.set_middleware_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def __init__(self, database="main", connection=None): """Create a database fixture. :param database: The type of database, 'main' or 'api' :param connection: The connection string to use """ super(Database, self).__init__() # NOTE(pkholkin): oslo_db.enginefacade is configured in tests the same # way as it is done for any other service that uses db global SESSION_CONFIGURED if not SESSION_CONFIGURED: session.configure(CONF) SESSION_CONFIGURED = True self.database = database if database == "main": if connection is not None: ctxt_mgr = session.create_context_manager(connection=connection) facade = ctxt_mgr.get_legacy_facade() self.get_engine = facade.get_engine else: self.get_engine = session.get_engine elif database == "api": self.get_engine = session.get_api_engine
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Nova needs if CONF.glance.debug: extra_default_log_levels = ['glanceclient=DEBUG'] else: extra_default_log_levels = ['glanceclient=WARN'] # NOTE(sean-k-mooney): this filter addresses bug #1825584 # https://bugs.launchpad.net/nova/+bug/1825584 # eventlet monkey-patching breaks AMQP heartbeat on uWSGI rabbit_logger = logging.getLogger('oslo.messaging._drivers.impl_rabbit') rabbit_logger.addFilter(rabbit_heartbeat_filter) # NOTE(danms): DEBUG logging in privsep will result in some large # and potentially sensitive things being logged. extra_default_log_levels.append('oslo.privsep.daemon=INFO') log.set_defaults(default_log_levels=log.get_default_log_levels() + extra_default_log_levels) rpc.set_defaults(control_exchange='nova') if profiler: profiler.set_defaults(CONF) middleware.set_defaults() CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
def __init__(self, database='main', connection=None): """Create a database fixture. :param database: The type of database, 'main' or 'api' :param connection: The connection string to use """ super(Database, self).__init__() # NOTE(pkholkin): oslo_db.enginefacade is configured in tests the same # way as it is done for any other service that uses db global SESSION_CONFIGURED if not SESSION_CONFIGURED: session.configure(CONF) SESSION_CONFIGURED = True self.database = database if database == 'main': if connection is not None: ctxt_mgr = session.create_context_manager( connection=connection) facade = ctxt_mgr.get_legacy_facade() self.get_engine = facade.get_engine else: self.get_engine = session.get_engine elif database == 'api': self.get_engine = session.get_api_engine
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # NOTE(sean-k-mooney): this filter addresses bug #1825584 # https://bugs.launchpad.net/nova/+bug/1825584 # eventlet monkey-patching breaks AMQP heartbeat on uWSGI rabbit_logger = logging.getLogger('oslo.messaging._drivers.impl_rabbit') rabbit_logger.addFilter(rabbit_heartbeat_filter) set_lib_defaults() if profiler: profiler.set_defaults(CONF) CONF(argv[1:], project='nova', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
#!/usr/bin/env python from sys import argv import nova.conf from nova import config from nova import context from nova.objects import register_all from nova.scheduler.host_manager import HostManager from oslo_config import cfg from nova.db.sqlalchemy import api import logging logging.basicConfig(level=logging.INFO) if __name__ == '__main__': # register objects register_all() CONF = cfg.CONF CONF(project='host-test', ) # host manager should use [api_database] connection api.configure(CONF) # print all host states hm = HostManager() for i in hm.get_all_host_states(context.get_admin_context()): print(i.nodename, i.uuid, i.disk_mb_used, i.free_ram_mb, i.cpu_info)