From e8250d2824b4d2280fa71e7671d84f126f408db7 Mon Sep 17 00:00:00 2001
From: Maksim Malchuk <maksim.malchuk@gmail.com>
Date: Thu, 18 May 2023 15:17:43 +0300
Subject: [PATCH] Fix the Cyborg service

According to the documentation [1] type of the Cyborg service should
be 'accelerator' and description 'Acceleration Service'. Also, this
change fixes incorrect endpoint URLs, and not configures an admin
endpoint [2] because the documentation [1] not updated yet.

1. https://docs.openstack.org/cyborg/latest/install/common.html
2. Icf3bf08deab2c445361f0a0124d87ad8b0e4e9d9

Closes-Bug: #2020080
Change-Id: I002db50cbad5a90e479498e605bdeab343e129c7
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
---
 ansible/roles/cyborg/defaults/main.yml                    | 8 ++++----
 ansible/roles/cyborg/templates/cyborg.conf.j2             | 2 +-
 .../notes/fix-cyborg-service-5bc5bf8748daf504.yaml        | 6 ++++++
 3 files changed, 11 insertions(+), 5 deletions(-)
 create mode 100644 releasenotes/notes/fix-cyborg-service-5bc5bf8748daf504.yaml

diff --git a/ansible/roles/cyborg/defaults/main.yml b/ansible/roles/cyborg/defaults/main.yml
index 69ca507f64..f736b341f2 100644
--- a/ansible/roles/cyborg/defaults/main.yml
+++ b/ansible/roles/cyborg/defaults/main.yml
@@ -141,8 +141,8 @@ cyborg_conductor_extra_volumes: "{{ cyborg_extra_volumes }}"
 ####################
 # OpenStack
 ####################
-cyborg_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ cyborg_api_port }}"
-cyborg_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn | put_address_in_context('url') }}:{{ cyborg_api_port }}"
+cyborg_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ cyborg_api_port }}/v2"
+cyborg_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn | put_address_in_context('url') }}:{{ cyborg_api_port }}/v2"
 
 cyborg_logging_debug: "{{ openstack_logging_debug }}"
 
@@ -165,8 +165,8 @@ cyborg_enabled_notification_topics: "{{ cyborg_notification_topics | selectattr(
 ####################
 cyborg_ks_services:
   - name: "cyborg"
-    type: "cyborg"
-    description: "OpenStack Cyborg Service"
+    type: "accelerator"
+    description: "Acceleration Service"
     endpoints:
       - {'interface': 'internal', 'url': '{{ cyborg_internal_endpoint }}'}
       - {'interface': 'public', 'url': '{{ cyborg_public_endpoint }}'}
diff --git a/ansible/roles/cyborg/templates/cyborg.conf.j2 b/ansible/roles/cyborg/templates/cyborg.conf.j2
index e67c48c1ae..1bd325906c 100644
--- a/ansible/roles/cyborg/templates/cyborg.conf.j2
+++ b/ansible/roles/cyborg/templates/cyborg.conf.j2
@@ -15,7 +15,7 @@ connection_recycle_time = {{ database_connection_recycle_time }}
 max_pool_size = {{ database_max_pool_size }}
 
 [keystone_authtoken]
-service_type = cyborg
+service_type = accelerator
 memcache_security_strategy = ENCRYPT
 memcache_secret_key = {{ memcache_secret_key }}
 memcache_servers = {% for host in groups['memcached'] %}{{ 'api' | kolla_address(host) | put_address_in_context('memcache') }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
diff --git a/releasenotes/notes/fix-cyborg-service-5bc5bf8748daf504.yaml b/releasenotes/notes/fix-cyborg-service-5bc5bf8748daf504.yaml
new file mode 100644
index 0000000000..b15774494a
--- /dev/null
+++ b/releasenotes/notes/fix-cyborg-service-5bc5bf8748daf504.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Fixes the incorrect endpoint URLs and service type information for the
+    Cyborg service in the Keystone. `LP#2020080
+    <https://bugs.launchpad.net/kolla-ansible/+bug/2020080>`__