Allow deployment without glance-registry

The glance v1 API is deprecated and intended to be removed
from the glance code within the Queens or Rocky cycles.

When using the glance v2 API the glance-registry service is
optional, and the intention is to remove the glance-registry
service in the S cycle. The glance-registry service is required
when using the v1 API though.

Furthermore, when using the glance-registry service it is not
possible to execute a rolling upgrade without losing API
transactions.

Given the above information, this patch enables the deployment
of glance with only the v2 API enabled, and without the
glance-registry service. It adds a per-commit test to validate
that this configuration works.

This patch also corrects a previous misconfiguration which
enabled the v2 registry service, but did not set the data_api
correctly for the API service to inform it that the registry
was operating.

The glance_enable_v1_registry variable is also removed as it
is meaningless. The v1 API *requires* the registry to be
enabled, so we just enable it if glance_enable_v1_api is
enabled.

Change-Id: Ie95daed286798d139f0a35ffdd2a4dd1cdda6ff9
This commit is contained in:
Jesse Pretorius 2017-11-18 12:10:48 +00:00
parent 6adc4a4512
commit 1416013cd4
9 changed files with 65 additions and 4 deletions

View File

@ -67,7 +67,6 @@ glance_show_multiple_locations: "{{ glance_default_store == 'rbd' }}"
## API options
glance_enable_v1_api: True
glance_enable_v1_registry: True
glance_enable_v2_api: True
glance_enable_v2_registry: True
@ -235,12 +234,13 @@ glance_services:
wsgi_app: True
log_string: "--logto "
wsgi_name: glance-wsgi-api
uwsgi_bind_address: "{{glance_api_bind_address }}"
uwsgi_bind_address: "{{ glance_api_bind_address }}"
uwsgi_port: "{{ glance_api_service_port }}"
program_override: "{{ glance_bin }}/uwsgi --ini /etc/uwsgi/glance-api.ini"
glance-registry:
group: glance_registry
service_name: glance-registry
condition: "{{ glance_enable_v1_api | bool or glance_enable_v2_registry | bool }}"
init_config_overrides: "{{ glance_registry_init_overrides }}"
start_order: 2

View File

@ -0,0 +1,13 @@
---
deprecations:
- |
The ``glance_enable_v1_registry`` variable has been removed. When using
the glance v1 API the registry service is required, so having a variable
to disable it makes little sense. The service is now enabled/disabled
for the v1 API using the ``glance_enable_v1_api`` variable.
fixes:
- |
When the ``glance_enable_v2_registry`` variable is set to ``True`` the
corresponding ``data_api`` setting is now correctly set. Previously it
was not set and therefore the API service was not correctly informed
that the registry was operating.

View File

@ -22,6 +22,7 @@
mode: "0640"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
when: "{{ item.condition | default(True) }}"
with_items:
- src: "glance-api-paste.ini.j2"
dest: "/etc/glance/glance-api-paste.ini"
@ -43,10 +44,12 @@
dest: "/etc/glance/glance-registry-paste.ini"
config_overrides: "{{ glance_glance_registry_paste_ini_overrides }}"
config_type: "ini"
condition: "{{ glance_services['glance-registry']['condition'] | bool }}"
- src: "glance-registry.conf.j2"
dest: "/etc/glance/glance-registry.conf"
config_overrides: "{{ glance_glance_registry_conf_overrides }}"
config_type: "ini"
condition: "{{ glance_services['glance-registry']['condition'] | bool }}"
- src: "glance-scrubber.conf.j2"
dest: "/etc/glance/glance-scrubber.conf"
config_overrides: "{{ glance_glance_scrubber_conf_overrides }}"

View File

@ -18,10 +18,14 @@ registry_client_protocol = {{ glance_service_registry_proto }}
cinder_catalog_info = volume:cinder:internalURL
enable_v1_api = {{ glance_enable_v1_api }}
enable_v1_registry = {{ glance_enable_v1_registry }}
enable_v1_registry = {{ glance_enable_v1_api }}
enable_v2_api = {{ glance_enable_v2_api }}
enable_v2_registry = {{ glance_enable_v2_registry }}
{% if glance_enable_v2_registry | bool %}
data_api = glance.db.registry.api
{% endif %}
transport_url = rabbit://{% for host in glance_rabbitmq_servers.split(',') %}{{ glance_rabbitmq_userid }}:{{ glance_rabbitmq_password }}@{{ host }}:{{ glance_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ glance_rabbitmq_vhost }}{% endif %}{% endfor %}
delayed_delete = False

View File

@ -14,6 +14,11 @@ workers = {{ glance_registry_workers | default(glance_api_threads) }}
api_limit_max = 1000
limit_param_default = 25
enable_v1_api = {{ glance_enable_v1_api }}
enable_v1_registry = {{ glance_enable_v1_api }}
enable_v2_api = {{ glance_enable_v2_api }}
enable_v2_registry = {{ glance_enable_v2_registry }}
transport_url = rabbit://{% for host in glance_rabbitmq_servers.split(',') %}{{ glance_rabbitmq_userid }}:{{ glance_rabbitmq_password }}@{{ host }}:{{ glance_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ glance_rabbitmq_vhost }}{% endif %}{% endfor %}

View File

@ -34,6 +34,8 @@
uri:
url: "http://localhost:9191"
status_code: 401
when:
- (glance_enable_v1_api | default(True)) | bool or (glance_enable_v2_registry | default(True)) | bool
- name: Download the Cirros image
get_url:

13
tox.ini
View File

@ -95,6 +95,14 @@ commands =
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
[testenv:functional]
deps =
{[testenv:ansible]deps}
commands =
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:upgrade]
deps =
{[testenv:ansible]deps}
@ -107,9 +115,12 @@ commands =
bash -c "{toxinidir}/tests/test-glance-upgrades.sh"
[testenv:functional]
[testenv:v2_api_only]
deps =
{[testenv:ansible]deps}
setenv =
{[testenv]setenv}
ANSIBLE_PARAMETERS=-e glance_enable_v1_api=False -e glance_enable_v2_registry=False
commands =
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"

21
zuul.d/jobs.yaml Normal file
View File

@ -0,0 +1,21 @@
---
# Copyright 2017, 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.
- job:
name: openstack-ansible-v2_api_only
parent: openstack-ansible-functional
nodeset: ubuntu-xenial
vars:
tox_env: v2_api_only

View File

@ -22,6 +22,7 @@
- openstack-ansible-functional-opensuse-423
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-upgrade-ubuntu-xenial
- openstack-ansible-v2_api_only
gate:
jobs:
- openstack-ansible-linters
@ -29,3 +30,4 @@
- openstack-ansible-functional-opensuse-423
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-upgrade-ubuntu-xenial
- openstack-ansible-v2_api_only