示例#1
0
文件: main.py 项目: a9261/sahara
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'sahara',
                            'sahara.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    log.setup("sahara")

    LOG.info(_LI('Starting Sahara %s'), service_name)

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()

    messaging.setup()

    if service_name != 'all-in-one':
        LOG.warn(
            _LW("Distributed mode is in the alpha state, it's recommended to "
                "use all-in-one mode by running 'sahara-all' binary."))

    plugins_base.setup_plugins()
示例#2
0
    def test_only_notifications(self):
        self.override_config('enable', True,
                             group='oslo_messaging_notifications')

        messaging.setup('all-in-one')
        self.assertEqual(0, self.get_transport.call_count)
        self.assertEqual(1, self.get_notify_transport.call_count)
示例#3
0
文件: main.py 项目: openstack/sahara
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'sahara',
                            'sahara.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    common_config.set_config_defaults()
    log.setup(CONF, "sahara")

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()
    keystone.validate_config()
    validate_castellan_config()

    messaging.setup(service_name)

    plugins_base.setup_plugins()

    ds_manager.setup_data_sources()
    jb_manager.setup_job_binaries()

    LOG.info('Sahara {service} started'.format(service=service_name))
示例#4
0
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'sahara',
                            'sahara.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    common_config.set_config_defaults()
    log.setup(CONF, "sahara")

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()
    keystone.validate_config()
    validate_castellan_config()

    messaging.setup(service_name)

    plugins_base.setup_plugins()

    ds_manager.setup_data_sources()
    jb_manager.setup_job_binaries()

    LOG.info('Sahara {service} started'.format(service=service_name))
示例#5
0
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'sahara',
                            'sahara.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    log.setup("sahara")

    LOG.info(_LI('Starting Sahara %s'), service_name)

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()

    messaging.setup()

    if service_name != 'all-in-one':
        LOG.warn(
            _LW("Distributed mode is in the alpha state, it's recommended to "
                "use all-in-one mode by running 'sahara-all' binary."))

    plugins_base.setup_plugins()
示例#6
0
    def test_update_cluster(self, mock_notify):
        self.override_config("enable_notifications", True)
        messaging.setup()

        self._make_sample()
        self.assertEqual([self.expected], mock_notify.call_args_list)

        if messaging.TRANSPORT:
            messaging.TRANSPORT.cleanup()
            messaging.TRANSPORT = messaging.NOTIFIER = None
示例#7
0
    def test_update_cluster(self, mock_notify):
        self.override_config("enable_notifications", True)
        messaging.setup()

        self._make_sample()
        self.assertEqual([self.expected],
                         mock_notify.call_args_list)

        if messaging.TRANSPORT:
            messaging.TRANSPORT.cleanup()
            messaging.TRANSPORT = messaging.NOTIFIER = None
示例#8
0
    def test_set_defaults(self):
        messaging.setup('distributed')

        self.assertIsNotNone(messaging.MESSAGING_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFIER)

        expected = [mock.call('sahara')]
        self.assertEqual(expected, self.set_transport_def.call_args_list)
        self.assertEqual([mock.call(main.CONF)],
                         self.get_transport.call_args_list)
        self.assertEqual([mock.call(main.CONF)],
                         self.get_notify_transport.call_args_list)
        self.assertEqual(1, self.notifier_init.call_count)
示例#9
0
文件: main.py 项目: snowind/sahara
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir, "etc", "sahara", "sahara.conf")
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    log.setup(CONF, "sahara")

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()

    if service_name != "all-in-one" or cfg.CONF.enable_notifications:
        messaging.setup()

    plugins_base.setup_plugins()

    LOG.info(_LI("Sahara {service} started").format(service=service_name))
示例#10
0
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir, 'etc', 'sahara', 'sahara.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    log.setup(CONF, "sahara")

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()

    if service_name != 'all-in-one' or cfg.CONF.enable_notifications:
        messaging.setup()

    plugins_base.setup_plugins()

    LOG.info(_LI('Sahara {service} started').format(service=service_name))
示例#11
0
    def test_set_defaults(self):
        messaging.setup('distributed')

        self.assertIsNotNone(messaging.MESSAGING_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFIER)

        expected = [
            mock.call('sahara')
        ]
        self.assertEqual(expected, self.set_transport_def.call_args_list)
        self.assertEqual(
            [mock.call(main.CONF)],
            self.get_transport.call_args_list)
        self.assertEqual(
            [mock.call(main.CONF)],
            self.get_notify_transport.call_args_list)
        self.assertEqual(1, self.notifier_init.call_count)
示例#12
0
    def test_set_defaults(self):
        self.override_config('enable', True,
                             group='oslo_messaging_notifications')

        messaging.setup('distributed')
        self.assertIsNotNone(messaging.MESSAGING_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFIER)

        expected = [
            mock.call('sahara')
        ]
        self.assertEqual(expected, self.set_transport_def.call_args_list)
        self.assertEqual(
            [mock.call(main.CONF, aliases=_ALIASES)],
            self.get_transport.call_args_list)
        self.assertEqual(
            [mock.call(main.CONF, aliases=_ALIASES)],
            self.get_notify_transport.call_args_list)
        self.assertEqual(1, self.notifier_init.call_count)
示例#13
0
    def test_fallback(self):
        self.get_notify_transport.side_effect = ValueError()
        messaging.setup('distributed')

        self.assertIsNotNone(messaging.MESSAGING_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT)
        self.assertEqual(
            messaging.MESSAGING_TRANSPORT, messaging.NOTIFICATION_TRANSPORT)
        self.assertIsNotNone(messaging.NOTIFIER)

        expected = [
            mock.call('sahara')
        ]
        self.assertEqual(expected, self.set_transport_def.call_args_list)
        self.assertEqual(
            [mock.call(main.CONF, aliases=_ALIASES)],
            self.get_transport.call_args_list)
        self.assertEqual(
            [mock.call(main.CONF, aliases=_ALIASES)],
            self.get_notify_transport.call_args_list)
        self.assertEqual(1, self.notifier_init.call_count)
示例#14
0
文件: main.py 项目: frgaudet/sahara
def setup_common(possible_topdir, service_name):
    dev_conf = os.path.join(possible_topdir,
                            'etc',
                            'sahara',
                            'sahara.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(config_files)
    common_config.set_config_defaults()
    log.setup(CONF, "sahara")

    # Validate other configurations (that may produce logs) here
    cinder.validate_config()
    castellan.validate_config()

    if (service_name != 'all-in-one' or
            CONF.oslo_messaging_notifications.enable):
        messaging.setup()

    plugins_base.setup_plugins()

    LOG.info(_LI('Sahara {service} started').format(service=service_name))
示例#15
0
    def test_only_service_messaging(self):
        messaging.setup('distributed')

        self.assertEqual(1, self.get_transport.call_count)
        self.assertEqual(0, self.get_notify_transport.call_count)
示例#16
0
 def _install(self):
     messaging.setup('fake://', optional=True)
     self.assertNotEqual(None, messaging.TRANSPORT)
     self.assertNotEqual(None, messaging.NOTIFIER)
示例#17
0
def rpc_setup(service_name, **kwargs):
    rpc.setup(service_name)
示例#18
0
 def _install(self):
     messaging.setup()
     self.assertIsNotNone(messaging.TRANSPORT)
     self.assertIsNotNone(messaging.NOTIFIER)
示例#19
0
文件: base.py 项目: openstack/sahara
 def setUp(self):
     super(SaharaTestCase, self).setUp()
     self.setup_context()
     rpc.setup('all-in-one')
示例#20
0
 def _install(self):
     messaging.setup()
     self.assertNotEqual(None, messaging.TRANSPORT)
     self.assertNotEqual(None, messaging.NOTIFIER)
示例#21
0
文件: base.py 项目: madar010/mad
 def setUp(self):
     super(SaharaTestCase, self).setUp()
     self.setup_context()
     rpc.setup('all-in-one')
示例#22
0
 def test_only_notifications(self):
     messaging.setup('all-in-one')
     self.assertEqual(0, self.get_transport.call_count)
     self.assertEqual(1, self.get_notify_transport.call_count)
示例#23
0
 def test_only_notifications(self):
     messaging.setup('all-in-one')
     self.assertEqual(0, self.get_transport.call_count)
     self.assertEqual(1, self.get_notify_transport.call_count)
示例#24
0
文件: test_rpc.py 项目: a9261/sahara
 def _install(self):
     messaging.setup('fake://', optional=True)
     self.assertNotEqual(None, messaging.TRANSPORT)
     self.assertNotEqual(None, messaging.NOTIFIER)
示例#25
0
 def _install(self):
     messaging.setup()
     self.assertIsNotNone(messaging.TRANSPORT)
     self.assertIsNotNone(messaging.NOTIFIER)
示例#26
0
    def test_no_messaging(self):
        messaging.setup('all-in-one')

        self.assertEqual(0, self.get_notify_transport.call_count)
        self.assertEqual(0, self.get_transport.call_count)