Remove cinder v1 service and endpoints

The cinder v1 API was removed in the queens release. The
'os_keystone_service' module is used to allow removal of existing
services and endpoints. Disabling the v2 API will now also ensure there
is not a registered service or endpoints.

The 'cinder_enable_v3_api' variable has been removed since it had no
effect on cinder's enablement of the v3 API.

Depends-On: https://review.openstack.org/#/c/557016/
Change-Id: I02d2bae8712c0ca223cafb5a43304806c4b83125
This commit is contained in:
Jimmy McCrory 2018-03-19 15:01:40 -07:00
parent 9cbff60731
commit f9ceec9cd5
5 changed files with 115 additions and 124 deletions

View File

@ -102,9 +102,7 @@ cinder_service_admin_tenant_name: "service"
cinder_service_admin_username: "cinder"
## Cinder API's enabled
cinder_enable_v1_api: true
cinder_enable_v2_api: true
cinder_enable_v3_api: true
## Cinder API check cert validation
cinder_service_internaluri_insecure: false
@ -125,11 +123,8 @@ cinder_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(ci
cinder_service_internaluri_proto: "{{ openstack_service_internaluri_proto | default(cinder_service_proto) }}"
cinder_service_type: volume
cinder_service_publicuri: "{{ cinder_service_publicuri_proto }}://{{ external_lb_vip_address }}:{{ cinder_service_port }}"
cinder_service_publicurl: "{{ cinder_service_publicuri }}/v1/%(tenant_id)s"
cinder_service_adminuri: "{{ cinder_service_adminuri_proto }}://{{ internal_lb_vip_address }}:{{ cinder_service_port }}"
cinder_service_adminurl: "{{ cinder_service_adminuri }}/v1/%(tenant_id)s"
cinder_service_internaluri: "{{ cinder_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ cinder_service_port }}"
cinder_service_internalurl: "{{ cinder_service_internaluri }}/v1/%(tenant_id)s"
cinder_service_v2_name: cinderv2
cinder_service_v2_port: 8776
@ -259,9 +254,9 @@ cinder_service_in_ldap: false
# Cinder packages that must be installed before anything else
cinder_requires_pip_packages:
- virtualenv
- python-keystoneclient # Keystoneclient needed by the keystone Ansible module
- httplib2
- shade
- virtualenv
# Common pip packages
cinder_pip_packages:

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
The Cinder v1 API and the variable to enable it, ``cinder_enable_v1_api``,
have been removed. Existing keystone registered endpoints and service for
cinder v1 will be removed during an upgrade.
- |
The ``cinder_enable_v3_api`` variable has been removed as it had no effect.

View File

@ -1,91 +0,0 @@
---
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Create a service
- name: Ensure cinder service
keystone:
command: "ensure_service"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
service_name: "{{ service_name }}"
service_type: "{{ service_type }}"
description: "{{ service_description }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
# Create an admin user
- name: Ensure cinder user
keystone:
command: "ensure_user"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
user_name: "{{ cinder_service_user_name }}"
tenant_name: "{{ cinder_service_project_name }}"
password: "{{ cinder_service_password }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
when: not cinder_service_in_ldap | bool
until: add_service|success
retries: 5
delay: 10
# Add a role to the user
- name: Ensure cinder user to admin role
keystone:
command: "ensure_user_role"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
user_name: "{{ cinder_service_user_name }}"
tenant_name: "{{ cinder_service_project_name }}"
role_name: "{{ cinder_service_role_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
when: not cinder_service_in_ldap | bool
until: add_service|success
retries: 5
delay: 10
# Create an endpoint
- name: Ensure cinder endpoint
keystone:
command: "ensure_endpoint"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
region_name: "{{ cinder_service_region }}"
service_name: "{{ service_name }}"
service_type: "{{ service_type }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
endpoint_list:
- url: "{{ service_publicurl }}"
interface: "public"
- url: "{{ service_internalurl }}"
interface: "internal"
- url: "{{ service_adminurl }}"
interface: "admin"
register: add_service
until: add_service|success
retries: 5
delay: 10

View File

@ -13,29 +13,110 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: cinder_service_add.yml
vars:
service_name: "{{ cinder_service_name }}"
service_type: "{{ cinder_service_type }}"
service_description: "{{ cinder_service_description }}"
service_publicurl: "{{ cinder_service_publicurl }}"
service_internalurl: "{{ cinder_service_internalurl }}"
service_adminurl: "{{ cinder_service_adminurl }}"
# Create an admin user
- name: Ensure cinder user
keystone:
command: "ensure_user"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
user_name: "{{ cinder_service_user_name }}"
tenant_name: "{{ cinder_service_project_name }}"
password: "{{ cinder_service_password }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
when: not cinder_service_in_ldap | bool
until: add_service|success
retries: 5
delay: 10
- include: cinder_service_add.yml
vars:
service_name: "{{ cinder_service_v2_name }}"
service_type: "{{ cinder_service_v2_type }}"
service_description: "{{ cinder_service_v2_description }}"
service_publicurl: "{{ cinder_service_v2_publicurl }}"
service_internalurl: "{{ cinder_service_v2_internalurl }}"
service_adminurl: "{{ cinder_service_v2_adminurl }}"
# Add a role to the user
- name: Ensure cinder user to admin role
keystone:
command: "ensure_user_role"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
user_name: "{{ cinder_service_user_name }}"
tenant_name: "{{ cinder_service_project_name }}"
role_name: "{{ cinder_service_role_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
when: not cinder_service_in_ldap | bool
until: add_service|success
retries: 5
delay: 10
- include: cinder_service_add.yml
vars:
service_name: "{{ cinder_service_v3_name }}"
service_type: "{{ cinder_service_v3_type }}"
service_description: "{{ cinder_service_v3_description }}"
service_publicurl: "{{ cinder_service_v3_publicurl }}"
service_internalurl: "{{ cinder_service_v3_internalurl }}"
service_adminurl: "{{ cinder_service_v3_adminurl }}"
# Create a service
- name: Ensure cinder service
os_keystone_service:
auth:
auth_url: "{{ keystone_service_adminurl }}"
username: "{{ cinder_service_user_name }}"
password: "{{ cinder_service_password }}"
project_name: "{{ cinder_service_project_name }}"
user_domain_name: "{{ cinder_service_user_domain_id }}"
project_domain_name: "{{ cinder_service_project_domain_id }}"
endpoint_type: admin
region_name: "{{ cinder_service_region }}"
validate_certs: "{{ keystone_service_adminuri_insecure | ternary(false, true) }}"
name: "{{ item.name }}"
service_type: "{{ item.type }}"
description: "{{ item.description }}"
state: "{{ item.state }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
with_items:
- name: "{{ cinder_service_name }}"
type: "{{ cinder_service_type }}"
description: "{{ cinder_service_description }}"
state: absent
- name: "{{ cinder_service_v2_name }}"
type: "{{ cinder_service_v2_type }}"
description: "{{ cinder_service_v2_description }}"
state: "{{ cinder_enable_v2_api | bool | ternary('present', 'absent') }}"
- name: "{{ cinder_service_v3_name }}"
type: "{{ cinder_service_v3_type }}"
description: "{{ cinder_service_v3_description }}"
state: present
# Create an endpoint
- name: Ensure cinder endpoint
keystone:
command: "ensure_endpoint"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
region_name: "{{ cinder_service_region }}"
service_name: "{{ item.name }}"
service_type: "{{ item.type }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
endpoint_list:
- url: "{{ item.publicurl }}"
interface: "public"
- url: "{{ item.internalurl }}"
interface: "internal"
- url: "{{ item.adminurl }}"
interface: "admin"
when: item.condition | default(true)
register: add_service
until: add_service|success
retries: 5
delay: 10
with_items:
- name: "{{ cinder_service_v2_name }}"
type: "{{ cinder_service_v2_type }}"
publicurl: "{{ cinder_service_v2_publicurl }}"
internalurl: "{{ cinder_service_v2_internalurl }}"
adminurl: "{{ cinder_service_v2_adminurl }}"
condition: "{{ cinder_enable_v2_api | bool }}"
- name: "{{ cinder_service_v3_name }}"
type: "{{ cinder_service_v3_type }}"
publicurl: "{{ cinder_service_v3_publicurl }}"
internalurl: "{{ cinder_service_v3_internalurl }}"
adminurl: "{{ cinder_service_v3_adminurl }}"

View File

@ -14,9 +14,7 @@ api_paste_config = /etc/cinder/api-paste.ini
auth_strategy = {{ cinder_auth_strategy }}
## Cinder API's enabled
enable_v1_api = {{ cinder_enable_v1_api }}
enable_v2_api = {{ cinder_enable_v2_api }}
enable_v3_api = {{ cinder_enable_v3_api }}
{% if cinder_services['cinder-volume']['group'] in group_names %}
{% if cinder_service_backup_program_enabled == true %}