summaryrefslogtreecommitdiffstats
path: root/devstack/plugin.sh
blob: a7f6a63bf6196c3083c066d517b8314134e2c210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash

##############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

# Defaults
# --------

CONF_FILES=(
    $CINDER_CONF
    $HEAT_CONF
    $KEYSTONE_CONF
    $NOVA_CONF
    $NEUTRON_CONF
    $GLANCE_API_CONF
    $GLANCE_REGISTRY_CONF
# Supported by osprofiler but not used in doctor at the moment
#    $TROVE_CONF
#    $TROVE_CONDUCTOR_CONF
#    $TROVE_GUESTAGENT_CONF
#    $TROVE_TASKMANAGER_CONF
#    $SENLIN_CONF
#    $MAGNUM_CONF
#    $ZUN_CONF
)

function install_doctor {
    # no-op
    :
}

function configure_doctor {
    for conf in ${CONF_FILES[@]}; do
        if [ -f $conf ]
        then
            iniset $conf profiler enabled true
            iniset $conf profiler trace_sqlalchemy true
            iniset $conf profiler hmac_keys $(iniget $conf profiler hmac_keys),${DOCTOR_HMAC_KEYS:=doctor}
            iniset $conf profiler connection_string ${OSPROFILER_CONNECTION_STRING:=redis://127.0.0.1:6379}
        fi
    done
}

function init_doctor {
    # no-op
    :
}

# check for service enabled
if is_service_enabled doctor; then

    if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
        # Set up system services
        echo_summary "Configuring system services Doctor"
        # install_package cowsay

    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
        # Perform installation of service source
        echo_summary "Installing Doctor"
        install_doctor

    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
        # Configure after the other layer 1 and 2 services have been configured
        echo_summary "Configuring Doctor"
        configure_doctor

    elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
        # Initialize and start the doctor service
        echo_summary "Initializing Doctor"
        init_doctor
    fi

    if [[ "$1" == "unstack" ]]; then
        # Shut down doctor services
        # no-op
        :
    fi

    if [[ "$1" == "clean" ]]; then
        # Remove state and transient data
        # Remember clean.sh first calls unstack.sh
        # no-op
        :
    fi
fi