Set openrc with OS_VOLUME_API_VERSION with cinder v2

As recently Nova merged commit https://review.openstack.org/#/c/124468/
which have switched to use Cinder v2 api, and cookbook will register
Cinder v2 endpoint. So openrc file also need to be updated
for cinder v2 support.

Change-Id: I3bcd3ca95d5f65c33eb5ddfda611280785412549
This commit is contained in:
ZHU ZHU 2014-11-13 20:24:02 -06:00
parent 85ec51aba7
commit 5b50abcdb2
4 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@ This file is used to list changes made in each version of cookbook-openstack-com
* Fix openstack_command with correct arguments order
* Fix openstack_command with single argument type
* Make default using cinder v2 api
* Add OS_VOLUME_API_VERSION for openrc
## 10.1.0
* Adding identity admin bind host endpoint to allow flexibility and consistency

View File

@ -41,6 +41,9 @@ end
ksadmin_pass = get_password 'user', ksadmin_user
identity_endpoint = endpoint 'identity-api'
volume_api_version = 2
volume_api_path = node['openstack']['endpoints']['block-storage-api']['path']
volume_api_version = volume_api_path[/\d/].to_i unless volume_api_path.to_s.empty?
directory node['openstack']['openrc']['path'] do
owner node['openstack']['openrc']['user']
@ -59,6 +62,7 @@ template "#{node['openstack']['openrc']['path']}/#{node['openstack']['openrc']['
user: ksadmin_user,
tenant: ksadmin_tenant_name,
password: ksadmin_pass,
identity_endpoint: identity_endpoint.to_s
identity_endpoint: identity_endpoint.to_s,
volume_api_version: volume_api_version
)
end

View File

@ -36,7 +36,8 @@ describe 'openstack-common::openrc' do
/^export OS_TENANT_NAME=admin$/,
/^export OS_PASSWORD=admin$/,
%r{^export OS_AUTH_URL=http://127.0.0.1:5000/v2.0$},
/^export OS_REGION_NAME=RegionOne$/
/^export OS_REGION_NAME=RegionOne$/,
/^export OS_VOLUME_API_VERSION=2$/
].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
end

View File

@ -6,6 +6,7 @@ export OS_PASSWORD=<%= @password %>
export OS_TENANT_NAME=<%= @tenant %>
export OS_AUTH_URL=<%= @identity_endpoint %>
export OS_REGION_NAME=<%= node['openstack']['region'] %>
export OS_VOLUME_API_VERSION=<%= @volume_api_version %>
<% if node['openstack']['misc_openrc'] %>
# Misc options