Comment 0 for bug 2047797

Revision history for this message
Alex Mercer (flashadow) wrote : octavia-api调用失败

通过skyline访问octavia失败,详情见https://bugs.launchpad.net/skyline-console/+bug/2047624

测试如下:
测试一
root@node-1:/var/log/kolla/octavia# curl -X GET -H "X-Auth-Token: $Token" -H "Cookie: $Cookie" -H "Content-Type: application/json" http://192.168.27.253:9999/api/openstack/regionone/octavia/v2/lbaas/loadbalancers
<html>
 <head>
  <title>404 Not Found</title>
 </head>
 <body>
  <h1>404 Not Found</h1>
  The resource could not be found.<br /><br />

 </body>

测试二
root@node-1:/var/log/kolla/skyline# curl -X GET -H "X-Auth-Token: $Token" -H "Cookie: $Cookie" -H "Content-Type: application/json" http://192.168.27.253:9999/api/openstack/regionone/octavia/
{"versions": [{"id": "v2.0", "status": "SUPPORTED", "updated": "2016-12-11T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.1", "status": "SUPPORTED", "updated": "2018-04-20T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.2", "status": "SUPPORTED", "updated": "2018-07-31T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.3", "status": "SUPPORTED", "updated": "2018-12-18T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.4", "status": "SUPPORTED", "updated": "2018-12-19T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.5", "status": "SUPPORTED", "updated": "2019-01-21T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.6", "status": "SUPPORTED", "updated": "2019-01-25T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.7", "status": "SUPPORTED", "updated": "2018-01-25T12:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.8", "status": "SUPPORTED", "updated": "2019-02-12T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.9", "status": "SUPPORTED", "updated": "2019-03-04T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.10", "status": "SUPPORTED", "updated": "2019-03-05T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.11", "status": "SUPPORTED", "updated": "2019-06-24T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.12", "status": "SUPPORTED", "updated": "2019-09-11T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.13", "status": "SUPPORTED", "updated": "2019-09-13T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.14", "status": "SUPPORTED", "updated": "2019-11-10T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.15", "status": "SUPPORTED", "updated": "2020-03-10T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.16", "status": "SUPPORTED", "updated": "2020-03-15T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.17", "status": "SUPPORTED", "updated": "2020-04-29T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.18", "status": "SUPPORTED", "updated": "2020-04-29T01:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.19", "status": "SUPPORTED", "updated": "2020-05-12T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.20", "status": "SUPPORTED", "updated": "2020-08-02T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.21", "status": "SUPPORTED", "updated": "2020-09-03T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.22", "status": "SUPPORTED", "updated": "2020-09-04T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}, {"id": "v2.23", "status": "CURRENT", "updated": "2020-09-07T00:00:00Z", "links": [{"href": "http://192.168.27.253:9999//v2", "rel": "self"}]}]}

测试三
root@node-1:/opt/kolla-ansible/ansible/roles/skyline/templates# curl -X GET -H "X-Auth-Token: $Token" -H "Cookie: $Cookie" -H "Content-Type: application/json" http://192.168.27.253:9999/api/openstack/regionone/octaviav2
"v2"

通过测试可知调用skyline-console地址http://192.168.27.253:9999/api/openstack/regionone/octavia/访问octavia-api时,skyline的nginx会将http://192.168.27.253:9999/api/openstack/regionone/octavia重定向成http://192.168.27.253:9876//v2,导致资源访问失败。

修复方案:
将https://opendev.org/openstack/kolla-ansible/src/branch/master/ansible/roles/skyline/templates/nginx.conf.j2第184行

        location {{ skyline_nginx_prefix }}/{{ openstack_region_name | lower }}/octavia {
改为:

        location {{ skyline_nginx_prefix }}/{{ openstack_region_name | lower }}/octavia/ {