Browse Source

Remove Keystone dependency from neutron-server RA

When we check the availability of Neutron API service, now we simply
check the response code of "List API version" call instead of getting a
token from Keystone, then checking a Neutron API endpoint using that
token. This way we don't need a token anymore so the checking process
will not depend on the availability on Keystone.

Partial-Bug: #1511721
Change-Id: I5fee8d47bd8e9af9f415b9f74c4f9325ac99df2f
Signed-off-by: Norbert Illes <norbert.e.illes@ericsson.com>
Norbert Illes 3 years ago
parent
commit
b1266c77dd
1 changed files with 14 additions and 17 deletions
  1. 14
    17
      ocf/neutron-server

+ 14
- 17
ocf/neutron-server View File

@@ -21,11 +21,12 @@
21 21
 #   OCF_RESKEY_plugin_config
22 22
 #   OCF_RESKEY_user
23 23
 #   OCF_RESKEY_pid
24
+#   OCF_RESKEY_additional_parameters
25
+# OCF deprecated parameters:
24 26
 #   OCF_RESKEY_os_username
25 27
 #   OCF_RESKEY_os_password
26 28
 #   OCF_RESKEY_os_tenant_name
27 29
 #   OCF_RESKEY_keystone_get_token_url
28
-#   OCF_RESKEY_additional_parameters
29 30
 #######################################################################
30 31
 # Initialization:
31 32
 
@@ -42,7 +43,6 @@ OCF_RESKEY_plugin_config_default="/etc/neutron/plugins/openvswitch/ovs_neutron_p
42 43
 OCF_RESKEY_user_default="neutron"
43 44
 OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
44 45
 OCF_RESKEY_url_default="http://127.0.0.1:9696"
45
-OCF_RESKEY_keystone_get_token_url_default="http://127.0.0.1:5000/v2.0/tokens"
46 46
 
47 47
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
48 48
 : ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
@@ -50,7 +50,6 @@ OCF_RESKEY_keystone_get_token_url_default="http://127.0.0.1:5000/v2.0/tokens"
50 50
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
51 51
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
52 52
 : ${OCF_RESKEY_url=${OCF_RESKEY_url_default}}
53
-: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_default}}
54 53
 
55 54
 #######################################################################
56 55
 
@@ -135,34 +134,38 @@ The default URL to use for monitoring this instance (neutron-server) via curl. I
135 134
 
136 135
 <parameter name="keystone_get_token_url" unique="0" required="0">
137 136
 <longdesc lang="en">
137
+This parameter is DEPRECATED, you can specify it but it won't be used.
138 138
 The default URL to use to acquire a Neutron API (neutron-server) token for monitoring this instance
139 139
 of OpenStack Neutron API (neutron-server)
140 140
 </longdesc>
141
-<shortdesc lang="en">OpenStack Neutron API (neutron-server) url</shortdesc>
141
+<shortdesc lang="en">DEPRECATED! OpenStack Neutron API (neutron-server) url</shortdesc>
142 142
 <content type="string" default="${OCF_RESKEY_keystone_get_token_url_default}" />
143 143
 </parameter>
144 144
 
145 145
 <parameter name="os_username" unique="0" required="0">
146 146
 <longdesc lang="en">
147
+This parameter is DEPRECATED, you can specify it but it won't be used.
147 148
 The username to use when connecting with Neutron API (neutron-server) for monitoring purposes
148 149
 </longdesc>
149
-<shortdesc lang="en">Neutron API (neutron-server) monitoring login</shortdesc>
150
+<shortdesc lang="en">DEPRECATED! Neutron API (neutron-server) monitoring login</shortdesc>
150 151
 <content type="string" />
151 152
 </parameter>
152 153
 
153 154
 <parameter name="os_password" unique="0" required="0">
154 155
 <longdesc lang="en">
156
+This parameter is DEPRECATED, you can specify it but it won't be used.
155 157
 The password to use when connecting Neutron API (neutron-server) for monitoring purposes
156 158
 </longdesc>
157
-<shortdesc lang="en">Neutron API (neutron-server) monitoring password</shortdesc>
159
+<shortdesc lang="en">DEPRECATED! Neutron API (neutron-server) monitoring password</shortdesc>
158 160
 <content type="string" />
159 161
 </parameter>
160 162
 
161 163
 <parameter name="os_tenant_name" unique="0" required="0">
162 164
 <longdesc lang="en">
165
+This parameter is DEPRECATED, you can specify it but it won't be used.
163 166
 The tenant to use when connecting Neutron API (neutron-server) for monitoring purposes
164 167
 </longdesc>
165
-<shortdesc lang="en">Neutron API (neutron-server) monitoring tenant</shortdesc>
168
+<shortdesc lang="en">DEPRECATED! Neutron API (neutron-server) monitoring tenant</shortdesc>
166 169
 <content type="string" />
167 170
 </parameter>
168 171
 
@@ -244,7 +247,6 @@ neutron_server_status() {
244 247
 
245 248
 neutron_server_monitor() {
246 249
     local rc
247
-    local token
248 250
     local http_code
249 251
 
250 252
     neutron_server_status
@@ -254,15 +256,10 @@ neutron_server_monitor() {
254 256
     if [ $rc -ne $OCF_SUCCESS ]; then
255 257
         return $rc
256 258
     fi
257
-
258
-    # Check detailed information about this specific version of the API.
259
-    if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
260
-    && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
261
-        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$OCF_RESKEY_os_username\", \
262
-          \"password\": \"$OCF_RESKEY_os_password\"}, \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
263
-          -H "Content-type: application/json" $OCF_RESKEY_keystone_get_token_url | tr ',' '\n' | grep '"id":' \
264
-          | cut -d'"' -f4 | head --lines 1`
265
-        http_code=`curl --write-out %{http_code} --output /dev/null -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
259
+    # Check the response code of the "List API versions" call.
260
+    # If it's 200, we consider neutron-server is properly running.
261
+    if [ -n "$OCF_RESKEY_url" ]; then
262
+        http_code=`curl --silent --write-out %{http_code} --output /dev/null -X GET $OCF_RESKEY_url`
266 263
         rc=$?
267 264
         if [ $rc -ne 0 ] || [ $http_code -ne 200 ]; then
268 265
             ocf_log err "Failed to connect to the OpenStack Neutron API (neutron-server): $rc and $http_code"

Loading…
Cancel
Save