Browse code

Move ironic to plugin

Also adds an is_ironic_enabled() function to prepare for an upcoming
change in is_service_enabled().

Change-Id: I6e6e0e8b70221e231785ab27e9b5d4836933ac4c

Dean Troyer authored on 2014/01/28 05:56:44
Showing 4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+# ironic.sh - Devstack extras script to install ironic
1
+
2
+if is_service_enabled ir-api ir-cond; then
3
+    if [[ "$1" == "source" ]]; then
4
+        # Initial source
5
+        source $TOP_DIR/lib/ironic
6
+    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
7
+        echo_summary "Installing Ironic"
8
+        install_ironic
9
+        install_ironicclient
10
+        cleanup_ironic
11
+    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
12
+        echo_summary "Configuring Ironic"
13
+        configure_ironic
14
+
15
+        if is_service_enabled key; then
16
+            create_ironic_accounts
17
+        fi
18
+
19
+    elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
20
+        # Initialize ironic
21
+        init_ironic
22
+
23
+        # Start the ironic API and ironic taskmgr components
24
+        echo_summary "Starting Ironic"
25
+        start_ironic
26
+    fi
27
+
28
+    if [[ "$1" == "unstack" ]]; then
29
+        stop_ironic
30
+        cleanup_ironic
31
+    fi
32
+fi
... ...
@@ -46,6 +46,13 @@ IRONIC_HOSTPORT=${IRONIC_HOSTPORT:-$SERVICE_HOST:6385}
46 46
 # Functions
47 47
 # ---------
48 48
 
49
+# Test if any Ironic services are enabled
50
+# is_ironic_enabled
51
+function is_ironic_enabled {
52
+    [[ ,${ENABLED_SERVICES} =~ ,"ir-" ]] && return 0
53
+    return 1
54
+}
55
+
49 56
 # install_ironic() - Collect source and prepare
50 57
 function install_ironic() {
51 58
     git_clone $IRONIC_REPO $IRONIC_DIR $IRONIC_BRANCH
... ...
@@ -336,7 +336,6 @@ source $TOP_DIR/lib/heat
336 336
 source $TOP_DIR/lib/neutron
337 337
 source $TOP_DIR/lib/baremetal
338 338
 source $TOP_DIR/lib/ldap
339
-source $TOP_DIR/lib/ironic
340 339
 
341 340
 # Extras Source
342 341
 # --------------
... ...
@@ -746,11 +745,6 @@ if is_service_enabled tls-proxy; then
746 746
     # don't be naive and add to existing line!
747 747
 fi
748 748
 
749
-if is_service_enabled ir-api ir-cond; then
750
-    install_ironic
751
-    install_ironicclient
752
-    configure_ironic
753
-fi
754 749
 
755 750
 # Extras Install
756 751
 # --------------
... ...
@@ -966,15 +960,6 @@ if is_service_enabled g-reg; then
966 966
 fi
967 967
 
968 968
 
969
-# Ironic
970
-# ------
971
-
972
-if is_service_enabled ir-api ir-cond; then
973
-    echo_summary "Configuring Ironic"
974
-    init_ironic
975
-fi
976
-
977
-
978 969
 # Neutron
979 970
 # -------
980 971
 
... ...
@@ -1101,12 +1086,6 @@ if is_service_enabled g-api g-reg; then
1101 1101
     start_glance
1102 1102
 fi
1103 1103
 
1104
-# Launch the Ironic services
1105
-if is_service_enabled ir-api ir-cond; then
1106
-    echo_summary "Starting Ironic"
1107
-    start_ironic
1108
-fi
1109
-
1110 1104
 # Create an access key and secret key for nova ec2 register image
1111 1105
 if is_service_enabled key && is_service_enabled swift3 && is_service_enabled nova; then
1112 1106
     NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1)
... ...
@@ -55,7 +55,6 @@ source $TOP_DIR/lib/heat
55 55
 source $TOP_DIR/lib/neutron
56 56
 source $TOP_DIR/lib/baremetal
57 57
 source $TOP_DIR/lib/ldap
58
-source $TOP_DIR/lib/ironic
59 58
 
60 59
 # Extras Source
61 60
 # --------------
... ...
@@ -118,12 +117,6 @@ if is_service_enabled s-proxy; then
118 118
     cleanup_swift
119 119
 fi
120 120
 
121
-# Ironic runs daemons
122
-if is_service_enabled ir-api ir-cond; then
123
-    stop_ironic
124
-    cleanup_ironic
125
-fi
126
-
127 121
 # Apache has the WSGI processes
128 122
 if is_service_enabled horizon; then
129 123
     stop_horizon