Browse code

Rename Marconi to Zaqar

This patch changes all Marconi references to Zaqar.

Change-Id: Iec4aeca54c0f383c995fba564bc59daa550d3747
Implements: blueprint project-rename

Malini Kamalambal authored on 2014/08/02 06:41:08
Showing 7 changed files
... ...
@@ -287,8 +287,8 @@
287 287
                 <td><a href="lib/ldap.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
288 288
               </tr>
289 289
               <tr>
290
-                <td>lib/marconi</td>
291
-                <td><a href="lib/marconi.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
290
+                <td>lib/zaqar</td>
291
+                <td><a href="lib/zaqar.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
292 292
               </tr>
293 293
               <tr>
294 294
                 <td>lib/neutron</td>
... ...
@@ -351,8 +351,8 @@
351 351
                 <td><a href="extras.d/50-ironic.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
352 352
               </tr>
353 353
               <tr>
354
-                <td>extras.d/70-marconi.sh</td>
355
-                <td><a href="extras.d/70-marconi.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
354
+                <td>extras.d/70-zaqar.sh</td>
355
+                <td><a href="extras.d/70-zaqar.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
356 356
               </tr>
357 357
               <tr>
358 358
                 <td>extras.d/70-sahara.sh</td>
... ...
@@ -517,9 +517,6 @@
517 517
                 <td>exercises/horizon.sh</td>
518 518
                 <td><a href="exercises/horizon.sh.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
519 519
               </tr>
520
-                <td>exercises/marconi.sh</td>
521
-                <td><a href="exercises/marconi.sh.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
522
-              </tr>
523 520
               <tr>
524 521
                 <td>exercises/neutron-adv-test.sh</td>
525 522
                 <td><a href="exercises/neutron-adv-test.sh.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
... ...
@@ -545,6 +542,10 @@
545 545
                 <td>exercises/volumes.sh</td>
546 546
                 <td><a href="exercises/volumes.sh.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
547 547
               </tr>
548
+              <tr>
549
+                <td>exercises/zaqar.sh</td>
550
+                <td><a href="exercises/zaqar.sh.html" class="btn btn-small btn-primary table-action">Read &raquo;</a></td>
551
+              </tr>
548 552
             </tbody>
549 553
           </table>
550 554
 
551 555
deleted file mode 100755
... ...
@@ -1,43 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# **marconi.sh**
4
-
5
-# Sanity check that Marconi started if enabled
6
-
7
-echo "*********************************************************************"
8
-echo "Begin DevStack Exercise: $0"
9
-echo "*********************************************************************"
10
-
11
-# This script exits on an error so that errors don't compound and you see
12
-# only the first error that occurred.
13
-set -o errexit
14
-
15
-# Print the commands being run so that we can see the command that triggers
16
-# an error.  It is also useful for following allowing as the install occurs.
17
-set -o xtrace
18
-
19
-
20
-# Settings
21
-# ========
22
-
23
-# Keep track of the current directory
24
-EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
25
-TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
26
-
27
-# Import common functions
28
-source $TOP_DIR/functions
29
-
30
-# Import configuration
31
-source $TOP_DIR/openrc
32
-
33
-# Import exercise configuration
34
-source $TOP_DIR/exerciserc
35
-
36
-is_service_enabled marconi-server || exit 55
37
-
38
-curl http://$SERVICE_HOST:8888/v1/ 2>/dev/null | grep -q 'queue_name' || die $LINENO "Marconi API not functioning!"
39
-
40
-set +o xtrace
41
-echo "*********************************************************************"
42
-echo "SUCCESS: End DevStack Exercise: $0"
43
-echo "*********************************************************************"
44 1
new file mode 100755
... ...
@@ -0,0 +1,43 @@
0
+#!/usr/bin/env bash
1
+
2
+# **zaqar.sh**
3
+
4
+# Sanity check that Zaqar started if enabled
5
+
6
+echo "*********************************************************************"
7
+echo "Begin DevStack Exercise: $0"
8
+echo "*********************************************************************"
9
+
10
+# This script exits on an error so that errors don't compound and you see
11
+# only the first error that occurred.
12
+set -o errexit
13
+
14
+# Print the commands being run so that we can see the command that triggers
15
+# an error.  It is also useful for following allowing as the install occurs.
16
+set -o xtrace
17
+
18
+
19
+# Settings
20
+# ========
21
+
22
+# Keep track of the current directory
23
+EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
24
+TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
25
+
26
+# Import common functions
27
+source $TOP_DIR/functions
28
+
29
+# Import configuration
30
+source $TOP_DIR/openrc
31
+
32
+# Import exercise configuration
33
+source $TOP_DIR/exerciserc
34
+
35
+is_service_enabled zaqar-server || exit 55
36
+
37
+curl http://$SERVICE_HOST:8888/v1/ 2>/dev/null | grep -q 'queue_name' || die $LINENO "Zaqar API not functioning!"
38
+
39
+set +o xtrace
40
+echo "*********************************************************************"
41
+echo "SUCCESS: End DevStack Exercise: $0"
42
+echo "*********************************************************************"
0 43
deleted file mode 100644
... ...
@@ -1,29 +0,0 @@
1
-# marconi.sh - Devstack extras script to install Marconi
2
-
3
-if is_service_enabled marconi-server; then
4
-    if [[ "$1" == "source" ]]; then
5
-        # Initial source
6
-        source $TOP_DIR/lib/marconi
7
-    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
8
-        echo_summary "Installing Marconi"
9
-        install_marconiclient
10
-        install_marconi
11
-    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
12
-        echo_summary "Configuring Marconi"
13
-        configure_marconi
14
-        configure_marconiclient
15
-
16
-        if is_service_enabled key; then
17
-            create_marconi_accounts
18
-        fi
19
-
20
-    elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
21
-        echo_summary "Initializing Marconi"
22
-        init_marconi
23
-        start_marconi
24
-    fi
25
-
26
-    if [[ "$1" == "unstack" ]]; then
27
-        stop_marconi
28
-    fi
29
-fi
30 1
new file mode 100644
... ...
@@ -0,0 +1,29 @@
0
+# zaqar.sh - Devstack extras script to install Zaqar
1
+
2
+if is_service_enabled zaqar-server; then
3
+    if [[ "$1" == "source" ]]; then
4
+        # Initial source
5
+        source $TOP_DIR/lib/zaqar
6
+    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
7
+        echo_summary "Installing Zaqar"
8
+        install_zaqarclient
9
+        install_zaqar
10
+    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
11
+        echo_summary "Configuring Zaqar"
12
+        configure_zaqar
13
+        configure_zaqarclient
14
+
15
+        if is_service_enabled key; then
16
+            create_zaqar_accounts
17
+        fi
18
+
19
+    elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
20
+        echo_summary "Initializing Zaqar"
21
+        init_zaqar
22
+        start_zaqar
23
+    fi
24
+
25
+    if [[ "$1" == "unstack" ]]; then
26
+        stop_zaqar
27
+    fi
28
+fi
0 29
deleted file mode 100644
... ...
@@ -1,211 +0,0 @@
1
-# lib/marconi
2
-# Install and start **Marconi** service
3
-
4
-# To enable a minimal set of Marconi services, add the following to localrc:
5
-#
6
-#     enable_service marconi-server
7
-#
8
-# Dependencies:
9
-# - functions
10
-# - OS_AUTH_URL for auth in api
11
-# - DEST set to the destination directory
12
-# - SERVICE_PASSWORD, SERVICE_TENANT_NAME for auth in api
13
-# - STACK_USER service user
14
-
15
-# stack.sh
16
-# ---------
17
-# install_marconi
18
-# configure_marconi
19
-# init_marconi
20
-# start_marconi
21
-# stop_marconi
22
-# cleanup_marconi
23
-
24
-# Save trace setting
25
-XTRACE=$(set +o | grep xtrace)
26
-set +o xtrace
27
-
28
-
29
-# Defaults
30
-# --------
31
-
32
-# Set up default directories
33
-MARCONI_DIR=$DEST/marconi
34
-MARCONICLIENT_DIR=$DEST/python-marconiclient
35
-MARCONI_CONF_DIR=/etc/marconi
36
-MARCONI_CONF=$MARCONI_CONF_DIR/marconi.conf
37
-MARCONI_API_LOG_DIR=/var/log/marconi
38
-MARCONI_API_LOG_FILE=$MARCONI_API_LOG_DIR/queues.log
39
-MARCONI_AUTH_CACHE_DIR=${MARCONI_AUTH_CACHE_DIR:-/var/cache/marconi}
40
-
41
-# Support potential entry-points console scripts
42
-MARCONI_BIN_DIR=$(get_python_exec_prefix)
43
-
44
-# Set up database backend
45
-MARCONI_BACKEND=${MARCONI_BACKEND:-mongodb}
46
-
47
-
48
-# Set Marconi repository
49
-MARCONI_REPO=${MARCONI_REPO:-${GIT_BASE}/openstack/marconi.git}
50
-MARCONI_BRANCH=${MARCONI_BRANCH:-master}
51
-
52
-# Set client library repository
53
-MARCONICLIENT_REPO=${MARCONICLIENT_REPO:-${GIT_BASE}/openstack/python-marconiclient.git}
54
-MARCONICLIENT_BRANCH=${MARCONICLIENT_BRANCH:-master}
55
-
56
-# Set Marconi Connection Info
57
-MARCONI_SERVICE_HOST=${MARCONI_SERVICE_HOST:-$SERVICE_HOST}
58
-MARCONI_SERVICE_PORT=${MARCONI_SERVICE_PORT:-8888}
59
-MARCONI_SERVICE_PROTOCOL=${MARCONI_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
60
-
61
-# Tell Tempest this project is present
62
-TEMPEST_SERVICES+=,marconi
63
-
64
-
65
-# Functions
66
-# ---------
67
-
68
-# Test if any Marconi services are enabled
69
-# is_marconi_enabled
70
-function is_marconi_enabled {
71
-    [[ ,${ENABLED_SERVICES} =~ ,"marconi-" ]] && return 0
72
-    return 1
73
-}
74
-
75
-# cleanup_marconi() - Remove residual data files, anything left over from previous
76
-# runs that a clean run would need to clean up
77
-function cleanup_marconi {
78
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! mongo marconi --eval 'db.dropDatabase();'; do sleep 1; done"; then
79
-        die $LINENO "Mongo DB did not start"
80
-    else
81
-        full_version=$(mongo marconi --eval 'db.dropDatabase();')
82
-        mongo_version=`echo $full_version | cut -d' ' -f4`
83
-        required_mongo_version='2.2'
84
-        if [[ $mongo_version < $required_mongo_version ]]; then
85
-            die $LINENO "Marconi needs Mongo DB version >= 2.2 to run."
86
-        fi
87
-    fi
88
-}
89
-
90
-# configure_marconiclient() - Set config files, create data dirs, etc
91
-function configure_marconiclient {
92
-    setup_develop $MARCONICLIENT_DIR
93
-}
94
-
95
-# configure_marconi() - Set config files, create data dirs, etc
96
-function configure_marconi {
97
-    setup_develop $MARCONI_DIR
98
-
99
-    [ ! -d $MARCONI_CONF_DIR ] && sudo mkdir -m 755 -p $MARCONI_CONF_DIR
100
-    sudo chown $USER $MARCONI_CONF_DIR
101
-
102
-    [ ! -d $MARCONI_API_LOG_DIR ] &&  sudo mkdir -m 755 -p $MARCONI_API_LOG_DIR
103
-    sudo chown $USER $MARCONI_API_LOG_DIR
104
-
105
-    iniset $MARCONI_CONF DEFAULT verbose True
106
-    iniset $MARCONI_CONF DEFAULT use_syslog $SYSLOG
107
-    iniset $MARCONI_CONF DEFAULT log_file $MARCONI_API_LOG_FILE
108
-    iniset $MARCONI_CONF 'drivers:transport:wsgi' bind $MARCONI_SERVICE_HOST
109
-
110
-    iniset $MARCONI_CONF keystone_authtoken auth_protocol http
111
-    iniset $MARCONI_CONF keystone_authtoken admin_user marconi
112
-    iniset $MARCONI_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
113
-    iniset $MARCONI_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
114
-    iniset $MARCONI_CONF keystone_authtoken signing_dir $MARCONI_AUTH_CACHE_DIR
115
-
116
-    if [ "$MARCONI_BACKEND" = 'mysql' ] || [ "$MARCONI_BACKEND" = 'postgresql' ] ; then
117
-        iniset $MARCONI_CONF drivers storage sqlalchemy
118
-        iniset $MARCONI_CONF 'drivers:storage:sqlalchemy' uri `database_connection_url marconi`
119
-    elif [ "$MARCONI_BACKEND" = 'mongodb' ] ; then
120
-        iniset $MARCONI_CONF  drivers storage mongodb
121
-        iniset $MARCONI_CONF 'drivers:storage:mongodb' uri mongodb://localhost:27017/marconi
122
-        configure_mongodb
123
-        cleanup_marconi
124
-    fi
125
-}
126
-
127
-function configure_mongodb {
128
-    # Set nssize to 2GB. This increases the number of namespaces supported
129
-    # # per database.
130
-    if is_ubuntu; then
131
-        sudo sed -i -e "
132
-            s|[^ \t]*#[ \t]*\(nssize[ \t]*=.*\$\)|\1|
133
-            s|^\(nssize[ \t]*=[ \t]*\).*\$|\1 2047|
134
-        " /etc/mongodb.conf
135
-        restart_service mongodb
136
-    elif is_fedora; then
137
-        sudo sed -i '/--nssize/!s/OPTIONS=\"/OPTIONS=\"--nssize 2047 /' /etc/sysconfig/mongod
138
-        restart_service mongod
139
-    fi
140
-}
141
-
142
-# init_marconi() - Initialize etc.
143
-function init_marconi {
144
-    # Create cache dir
145
-    sudo mkdir -p $MARCONI_AUTH_CACHE_DIR
146
-    sudo chown $STACK_USER $MARCONI_AUTH_CACHE_DIR
147
-    rm -f $MARCONI_AUTH_CACHE_DIR/*
148
-}
149
-
150
-# install_marconi() - Collect source and prepare
151
-function install_marconi {
152
-    git_clone $MARCONI_REPO $MARCONI_DIR $MARCONI_BRANCH
153
-    setup_develop $MARCONI_DIR
154
-}
155
-
156
-# install_marconiclient() - Collect source and prepare
157
-function install_marconiclient {
158
-    git_clone $MARCONICLIENT_REPO $MARCONICLIENT_DIR $MARCONICLIENT_BRANCH
159
-    setup_develop $MARCONICLIENT_DIR
160
-}
161
-
162
-# start_marconi() - Start running processes, including screen
163
-function start_marconi {
164
-    if [[ "$USE_SCREEN" = "False" ]]; then
165
-        screen_it marconi-server "marconi-server --config-file $MARCONI_CONF --daemon"
166
-    else
167
-        screen_it marconi-server "marconi-server --config-file $MARCONI_CONF"
168
-    fi
169
-
170
-    echo "Waiting for Marconi to start..."
171
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $MARCONI_SERVICE_PROTOCOL://$MARCONI_SERVICE_HOST:$MARCONI_SERVICE_PORT/v1/health; do sleep 1; done"; then
172
-        die $LINENO "Marconi did not start"
173
-    fi
174
-}
175
-
176
-# stop_marconi() - Stop running processes
177
-function stop_marconi {
178
-    # Kill the marconi screen windows
179
-    for serv in marconi-server; do
180
-        screen -S $SCREEN_NAME -p $serv -X kill
181
-    done
182
-}
183
-
184
-function create_marconi_accounts {
185
-    SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
186
-    ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
187
-
188
-    MARCONI_USER=$(get_or_create_user "marconi" \
189
-        "$SERVICE_PASSWORD" $SERVICE_TENANT)
190
-    get_or_add_user_role $ADMIN_ROLE $MARCONI_USER $SERVICE_TENANT
191
-
192
-    if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
193
-
194
-        MARCONI_SERVICE=$(get_or_create_service "marconi" \
195
-            "queuing" "Marconi Service")
196
-        get_or_create_endpoint $MARCONI_SERVICE \
197
-            "$REGION_NAME" \
198
-            "$MARCONI_SERVICE_PROTOCOL://$MARCONI_SERVICE_HOST:$MARCONI_SERVICE_PORT" \
199
-            "$MARCONI_SERVICE_PROTOCOL://$MARCONI_SERVICE_HOST:$MARCONI_SERVICE_PORT" \
200
-            "$MARCONI_SERVICE_PROTOCOL://$MARCONI_SERVICE_HOST:$MARCONI_SERVICE_PORT"
201
-    fi
202
-
203
-}
204
-
205
-
206
-# Restore xtrace
207
-$XTRACE
208
-
209
-# Local variables:
210
-# mode: shell-script
211
-# End:
212 1
new file mode 100644
... ...
@@ -0,0 +1,211 @@
0
+# lib/zaqar
1
+# Install and start **Zaqar** service
2
+
3
+# To enable a minimal set of Zaqar services, add the following to localrc:
4
+#
5
+#     enable_service zaqar-server
6
+#
7
+# Dependencies:
8
+# - functions
9
+# - OS_AUTH_URL for auth in api
10
+# - DEST set to the destination directory
11
+# - SERVICE_PASSWORD, SERVICE_TENANT_NAME for auth in api
12
+# - STACK_USER service user
13
+
14
+# stack.sh
15
+# ---------
16
+# install_zaqar
17
+# configure_zaqar
18
+# init_zaqar
19
+# start_zaqar
20
+# stop_zaqar
21
+# cleanup_zaqar
22
+
23
+# Save trace setting
24
+XTRACE=$(set +o | grep xtrace)
25
+set +o xtrace
26
+
27
+
28
+# Defaults
29
+# --------
30
+
31
+# Set up default directories
32
+ZAQAR_DIR=$DEST/zaqar
33
+ZAQARCLIENT_DIR=$DEST/python-zaqarclient
34
+ZAQAR_CONF_DIR=/etc/zaqar
35
+ZAQAR_CONF=$ZAQAR_CONF_DIR/zaqar.conf
36
+ZAQAR_API_LOG_DIR=/var/log/zaqar
37
+ZAQAR_API_LOG_FILE=$ZAQAR_API_LOG_DIR/queues.log
38
+ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar}
39
+
40
+# Support potential entry-points console scripts
41
+ZAQAR_BIN_DIR=$(get_python_exec_prefix)
42
+
43
+# Set up database backend
44
+ZAQAR_BACKEND=${ZAQAR_BACKEND:-mongodb}
45
+
46
+
47
+# Set Zaqar repository
48
+ZAQAR_REPO=${ZAQAR_REPO:-${GIT_BASE}/openstack/zaqar.git}
49
+ZAQAR_BRANCH=${ZAQAR_BRANCH:-master}
50
+
51
+# Set client library repository
52
+ZAQARCLIENT_REPO=${ZAQARCLIENT_REPO:-${GIT_BASE}/openstack/python-zaqarclient.git}
53
+ZAQARCLIENT_BRANCH=${ZAQARCLIENT_BRANCH:-master}
54
+
55
+# Set Zaqar Connection Info
56
+ZAQAR_SERVICE_HOST=${ZAQAR_SERVICE_HOST:-$SERVICE_HOST}
57
+ZAQAR_SERVICE_PORT=${ZAQAR_SERVICE_PORT:-8888}
58
+ZAQAR_SERVICE_PROTOCOL=${ZAQAR_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
59
+
60
+# Tell Tempest this project is present
61
+TEMPEST_SERVICES+=,zaqar
62
+
63
+
64
+# Functions
65
+# ---------
66
+
67
+# Test if any Zaqar services are enabled
68
+# is_zaqar_enabled
69
+function is_zaqar_enabled {
70
+    [[ ,${ENABLED_SERVICES} =~ ,"zaqar-" ]] && return 0
71
+    return 1
72
+}
73
+
74
+# cleanup_zaqar() - Remove residual data files, anything left over from previous
75
+# runs that a clean run would need to clean up
76
+function cleanup_zaqar {
77
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! mongo zaqar --eval 'db.dropDatabase();'; do sleep 1; done"; then
78
+        die $LINENO "Mongo DB did not start"
79
+    else
80
+        full_version=$(mongo zaqar --eval 'db.dropDatabase();')
81
+        mongo_version=`echo $full_version | cut -d' ' -f4`
82
+        required_mongo_version='2.2'
83
+        if [[ $mongo_version < $required_mongo_version ]]; then
84
+            die $LINENO "Zaqar needs Mongo DB version >= 2.2 to run."
85
+        fi
86
+    fi
87
+}
88
+
89
+# configure_zaqarclient() - Set config files, create data dirs, etc
90
+function configure_zaqarclient {
91
+    setup_develop $ZAQARCLIENT_DIR
92
+}
93
+
94
+# configure_zaqar() - Set config files, create data dirs, etc
95
+function configure_zaqar {
96
+    setup_develop $ZAQAR_DIR
97
+
98
+    [ ! -d $ZAQAR_CONF_DIR ] && sudo mkdir -m 755 -p $ZAQAR_CONF_DIR
99
+    sudo chown $USER $ZAQAR_CONF_DIR
100
+
101
+    [ ! -d $ZAQAR_API_LOG_DIR ] &&  sudo mkdir -m 755 -p $ZAQAR_API_LOG_DIR
102
+    sudo chown $USER $ZAQAR_API_LOG_DIR
103
+
104
+    iniset $ZAQAR_CONF DEFAULT verbose True
105
+    iniset $ZAQAR_CONF DEFAULT use_syslog $SYSLOG
106
+    iniset $ZAQAR_CONF DEFAULT log_file $ZAQAR_API_LOG_FILE
107
+    iniset $ZAQAR_CONF 'drivers:transport:wsgi' bind $ZAQAR_SERVICE_HOST
108
+
109
+    iniset $ZAQAR_CONF keystone_authtoken auth_protocol http
110
+    iniset $ZAQAR_CONF keystone_authtoken admin_user zaqar
111
+    iniset $ZAQAR_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
112
+    iniset $ZAQAR_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
113
+    iniset $ZAQAR_CONF keystone_authtoken signing_dir $ZAQAR_AUTH_CACHE_DIR
114
+
115
+    if [ "$ZAQAR_BACKEND" = 'mysql' ] || [ "$ZAQAR_BACKEND" = 'postgresql' ] ; then
116
+        iniset $ZAQAR_CONF drivers storage sqlalchemy
117
+        iniset $ZAQAR_CONF 'drivers:storage:sqlalchemy' uri `database_connection_url zaqar`
118
+    elif [ "$ZAQAR_BACKEND" = 'mongodb' ] ; then
119
+        iniset $ZAQAR_CONF  drivers storage mongodb
120
+        iniset $ZAQAR_CONF 'drivers:storage:mongodb' uri mongodb://localhost:27017/zaqar
121
+        configure_mongodb
122
+        cleanup_zaqar
123
+    fi
124
+}
125
+
126
+function configure_mongodb {
127
+    # Set nssize to 2GB. This increases the number of namespaces supported
128
+    # # per database.
129
+    if is_ubuntu; then
130
+        sudo sed -i -e "
131
+            s|[^ \t]*#[ \t]*\(nssize[ \t]*=.*\$\)|\1|
132
+            s|^\(nssize[ \t]*=[ \t]*\).*\$|\1 2047|
133
+        " /etc/mongodb.conf
134
+        restart_service mongodb
135
+    elif is_fedora; then
136
+        sudo sed -i '/--nssize/!s/OPTIONS=\"/OPTIONS=\"--nssize 2047 /' /etc/sysconfig/mongod
137
+        restart_service mongod
138
+    fi
139
+}
140
+
141
+# init_zaqar() - Initialize etc.
142
+function init_zaqar {
143
+    # Create cache dir
144
+    sudo mkdir -p $ZAQAR_AUTH_CACHE_DIR
145
+    sudo chown $STACK_USER $ZAQAR_AUTH_CACHE_DIR
146
+    rm -f $ZAQAR_AUTH_CACHE_DIR/*
147
+}
148
+
149
+# install_zaqar() - Collect source and prepare
150
+function install_zaqar {
151
+    git_clone $ZAQAR_REPO $ZAQAR_DIR $ZAQAR_BRANCH
152
+    setup_develop $ZAQAR_DIR
153
+}
154
+
155
+# install_zaqarclient() - Collect source and prepare
156
+function install_zaqarclient {
157
+    git_clone $ZAQARCLIENT_REPO $ZAQARCLIENT_DIR $ZAQARCLIENT_BRANCH
158
+    setup_develop $ZAQARCLIENT_DIR
159
+}
160
+
161
+# start_zaqar() - Start running processes, including screen
162
+function start_zaqar {
163
+    if [[ "$USE_SCREEN" = "False" ]]; then
164
+        screen_it zaqar-server "zaqar-server --config-file $ZAQAR_CONF --daemon"
165
+    else
166
+        screen_it zaqar-server "zaqar-server --config-file $ZAQAR_CONF"
167
+    fi
168
+
169
+    echo "Waiting for Zaqar to start..."
170
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT/v1/health; do sleep 1; done"; then
171
+        die $LINENO "Zaqar did not start"
172
+    fi
173
+}
174
+
175
+# stop_zaqar() - Stop running processes
176
+function stop_zaqar {
177
+    # Kill the zaqar screen windows
178
+    for serv in zaqar-server; do
179
+        screen -S $SCREEN_NAME -p $serv -X kill
180
+    done
181
+}
182
+
183
+function create_zaqar_accounts {
184
+    SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
185
+    ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
186
+
187
+    ZAQAR_USER=$(get_or_create_user "zaqar" \
188
+        "$SERVICE_PASSWORD" $SERVICE_TENANT)
189
+    get_or_add_user_role $ADMIN_ROLE $ZAQAR_USER $SERVICE_TENANT
190
+
191
+    if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
192
+
193
+        ZAQAR_SERVICE=$(get_or_create_service "zaqar" \
194
+            "queuing" "Zaqar Service")
195
+        get_or_create_endpoint $ZAQAR_SERVICE \
196
+            "$REGION_NAME" \
197
+            "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \
198
+            "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \
199
+            "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT"
200
+    fi
201
+
202
+}
203
+
204
+
205
+# Restore xtrace
206
+$XTRACE
207
+
208
+# Local variables:
209
+# mode: shell-script
210
+# End: