Exemplo n.º 1
0
 def test_register_configs_ceph(self, exists):
     exists.return_value = True
     self.os_release.return_value = 'grizzly'
     self.relation_ids.return_value = ['ceph:0']
     self.service_name.return_value = 'glance'
     configs = utils.register_configs()
     calls = []
     for conf in [
             utils.GLANCE_REGISTRY_CONF, utils.GLANCE_API_CONF,
             utils.HAPROXY_CONF,
             utils.ceph_config_file()
     ]:
         calls.append(call(conf, utils.CONFIG_FILES[conf]['hook_contexts']))
     configs.register.assert_has_calls(calls, any_order=True)
     self.mkdir.assert_called_with('/etc/ceph')
Exemplo n.º 2
0
 def test_register_configs_ceph(self, exists):
     exists.return_value = True
     self.os_release.return_value = 'grizzly'
     self.relation_ids.return_value = ['ceph:0']
     self.service_name.return_value = 'glance'
     configs = utils.register_configs()
     calls = []
     for conf in [utils.GLANCE_REGISTRY_CONF,
                  utils.GLANCE_API_CONF,
                  utils.HAPROXY_CONF,
                  utils.ceph_config_file()]:
         calls.append(
             call(conf,
                  utils.CONFIG_FILES[conf]['hook_contexts'])
         )
     configs.register.assert_has_calls(calls, any_order=True)
     self.mkdir.assert_called_with('/etc/ceph')
Exemplo n.º 3
0
def ceph_changed():
    if 'ceph' not in CONFIGS.complete_contexts():
        juju_log('ceph relation incomplete. Peer not ready?')
        return

    service = service_name()
    if not ensure_ceph_keyring(service=service, user='******', group='glance'):
        juju_log('Could not create ceph keyring: peer not ready?')
        return

    if is_request_complete(get_ceph_request()):
        juju_log('Request complete')
        CONFIGS.write(GLANCE_API_CONF)
        CONFIGS.write(ceph_config_file())
        # Ensure that glance-api is restarted since only now can we
        # guarantee that ceph resources are ready.
        service_restart('glance-api')
    else:
        send_request_if_needed(get_ceph_request())
Exemplo n.º 4
0
def ceph_changed():
    if 'ceph' not in CONFIGS.complete_contexts():
        juju_log('ceph relation incomplete. Peer not ready?')
        return

    service = service_name()
    if not ensure_ceph_keyring(service=service,
                               user='******', group='glance'):
        juju_log('Could not create ceph keyring: peer not ready?')
        return

    if is_request_complete(get_ceph_request()):
        juju_log('Request complete')
        CONFIGS.write(GLANCE_API_CONF)
        CONFIGS.write(ceph_config_file())
        # Ensure that glance-api is restarted since only now can we
        # guarantee that ceph resources are ready.
        service_restart('glance-api')
    else:
        send_request_if_needed(get_ceph_request())
Exemplo n.º 5
0
    def test_restart_map_stein(self):
        self.enable_memcache.return_value = True
        self.config.side_effect = None
        self.service_name.return_value = 'glance'
        self.os_release.return_value = 'stein'

        ex_map = OrderedDict([
            (utils.GLANCE_API_CONF, ['glance-api']),
            (utils.GLANCE_SWIFT_CONF, ['glance-api']),
            (utils.ceph_config_file(), ['glance-api']),
            (utils.HAPROXY_CONF, ['haproxy']),
            (utils.HTTPS_APACHE_CONF, ['apache2']),
            (utils.HTTPS_APACHE_24_CONF, ['apache2']),
            (utils.MEMCACHED_CONF, ['memcached']),
            (utils.GLANCE_POLICY_FILE, ['glance-api']),
        ])
        self.assertEqual(ex_map, utils.restart_map())
        self.enable_memcache.return_value = False
        del ex_map[utils.MEMCACHED_CONF]
        self.assertEqual(ex_map, utils.restart_map())
Exemplo n.º 6
0
    def test_restart_map_stein(self):
        self.enable_memcache.return_value = True
        self.config.side_effect = None
        self.service_name.return_value = 'glance'
        self.os_release.return_value = 'stein'

        ex_map = OrderedDict([
            (utils.GLANCE_API_CONF, ['glance-api']),
            (utils.GLANCE_SWIFT_CONF, ['glance-api']),
            (utils.ceph_config_file(), ['glance-api']),
            (utils.HAPROXY_CONF, ['haproxy']),
            (utils.HTTPS_APACHE_CONF, ['apache2']),
            (utils.HTTPS_APACHE_24_CONF, ['apache2']),
            (utils.MEMCACHED_CONF, ['memcached']),
            (utils.GLANCE_POLICY_FILE, ['glance-api']),
        ])
        self.assertEqual(ex_map, utils.restart_map())
        self.enable_memcache.return_value = False
        del ex_map[utils.MEMCACHED_CONF]
        self.assertEqual(ex_map, utils.restart_map())