def test_register_configs_ceph(self, exists):
     exists.return_value = True
     self.get_os_codename_package.return_value = 'grizzly'
     self.relation_ids.return_value = ['ceph:0']
     configs = cinder_utils.register_configs()
     calls = []
     for conf in [cinder_utils.ceph_config_file()]:
         calls.append(
             call(conf, cinder_utils.CONFIG_FILES[conf]['hook_contexts']))
     configs.register.assert_has_calls(calls, any_order=True)
     self.mkdir.assert_has_calls([
         call(os.path.dirname(cinder_utils.ceph_config_file())),
         call(os.path.dirname(cinder_utils.CEPH_CONF))
     ])
     self.install_alternative.assert_called_with(
         os.path.basename(cinder_utils.CEPH_CONF), cinder_utils.CEPH_CONF,
         cinder_utils.ceph_config_file())
 def test_register_configs_ceph(self, exists):
     exists.return_value = True
     self.get_os_codename_package.return_value = 'grizzly'
     self.relation_ids.return_value = ['ceph:0']
     configs = cinder_utils.register_configs()
     calls = []
     for conf in [cinder_utils.ceph_config_file()]:
         calls.append(
             call(conf,
                  cinder_utils.CONFIG_FILES[conf]['hook_contexts'])
         )
     configs.register.assert_has_calls(calls, any_order=True)
     self.mkdir.assert_has_calls([
         call(os.path.dirname(cinder_utils.ceph_config_file())),
         call(os.path.dirname(cinder_utils.CEPH_CONF))
     ])
     self.install_alternative.assert_called_with(
         os.path.basename(cinder_utils.CEPH_CONF),
         cinder_utils.CEPH_CONF, cinder_utils.ceph_config_file()
     )
示例#3
0
def ceph_changed(relation_id=None):
    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='cinder'):
        juju_log('Could not create ceph keyring: peer not ready?')
        return

    if is_request_complete(get_ceph_request()):
        log('Request complete')
        set_ceph_env_variables(service=service)
        CONFIGS.write(CINDER_CONF)
        CONFIGS.write(ceph_config_file())
        # Ensure that cinder-volume is restarted since only now can we
        # guarantee that ceph resources are ready.
        service_restart('cinder-volume')
    else:
        send_request_if_needed(get_ceph_request())
def ceph_changed(relation_id=None):
    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='cinder'):
        juju_log('Could not create ceph keyring: peer not ready?')
        return

    if is_request_complete(get_ceph_request()):
        log('Request complete')
        set_ceph_env_variables(service=service)
        CONFIGS.write(CINDER_CONF)
        CONFIGS.write(ceph_config_file())
        # Ensure that cinder-volume is restarted since only now can we
        # guarantee that ceph resources are ready.
        if not is_unit_paused_set():
            service_restart('cinder-volume')
    else:
        send_request_if_needed(get_ceph_request())