From 204c680f5202f1f93a1522c972a9757c58f012f6 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Tue, 23 Feb 2016 11:03:09 +0000 Subject: [PATCH] Automate setting of glance_api_version When integrating ceph w/ OpenStack, we suggest setting glance_api_version to 2 in the cinder_backends section for the ceph backend in question. This allows cinder to create clones from glance snapshots when glance uses RBD as a storage mechanism. The problem is that glance_api_version needs to be set in [DEFAULT], and not in the backend's section in cinder.conf. This change adds a new user variable cinder_glance_api_version, and if the environment has a cinder RBD backend and has glance configured to use RBD it will then set glance_api_version in cinder.conf to 2. If these conditions are not met, then it will use version 1 (the default). Change-Id: I242cd5b1e7eb47ee76c1f3cb0169e3b5d070959c --- etc/openstack_deploy/openstack_user_config.yml.example | 1 - playbooks/inventory/group_vars/hosts.yml | 1 + playbooks/roles/os_cinder/defaults/main.yml | 1 + playbooks/roles/os_cinder/templates/cinder.conf.j2 | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/openstack_deploy/openstack_user_config.yml.example b/etc/openstack_deploy/openstack_user_config.yml.example index 908f00c04e..cf61adcfe5 100644 --- a/etc/openstack_deploy/openstack_user_config.yml.example +++ b/etc/openstack_deploy/openstack_user_config.yml.example @@ -614,7 +614,6 @@ # rbd_max_clone_depth: 5 # rbd_store_chunk_size: 4 # rados_connect_timeout: -1 -# glance_api_version: 2 # volume_backend_name: volumes_hdd # rbd_user: "{{ cinder_ceph_client }}" # rbd_secret_uuid: "{{ cinder_ceph_client_uuid }}" diff --git a/playbooks/inventory/group_vars/hosts.yml b/playbooks/inventory/group_vars/hosts.yml index 98422039b9..dfd53302df 100644 --- a/playbooks/inventory/group_vars/hosts.yml +++ b/playbooks/inventory/group_vars/hosts.yml @@ -237,6 +237,7 @@ cinder_service_region: "{{ service_region }}" cinder_service_in_ldap: "{{ service_ldap_backend_enabled }}" cinder_rabbitmq_userid: cinder cinder_rabbitmq_vhost: /cinder +cinder_glance_api_version: "{{ (cinder_backends_rbd_inuse|bool and glance_default_store == 'rbd') | ternary('2','1') }}" ## Swift diff --git a/playbooks/roles/os_cinder/defaults/main.yml b/playbooks/roles/os_cinder/defaults/main.yml index 42c180b484..0bc3beb04f 100644 --- a/playbooks/roles/os_cinder/defaults/main.yml +++ b/playbooks/roles/os_cinder/defaults/main.yml @@ -212,6 +212,7 @@ cinder_quota_backup_gigabytes: 1000 cinder_glance_host: 127.0.0.1 cinder_glance_service_port: 9292 +cinder_glance_api_version: 1 cinder_service_in_ldap: false diff --git a/playbooks/roles/os_cinder/templates/cinder.conf.j2 b/playbooks/roles/os_cinder/templates/cinder.conf.j2 index 9d7c9c94f7..efd737856d 100644 --- a/playbooks/roles/os_cinder/templates/cinder.conf.j2 +++ b/playbooks/roles/os_cinder/templates/cinder.conf.j2 @@ -68,6 +68,7 @@ glance_host = {{ cinder_glance_host }} glance_port = {{ cinder_glance_service_port }} {% endif %} glance_num_retries = 0 +glance_api_version = {{ cinder_glance_api_version }} volume_clear = {{ cinder_volume_clear }} volume_clear_size = {{ cinder_volume_clear_size }}