enable sharev2 API capacity
* With the same interface as puppet-nova and puppet-cinder, create *_v2 parameters. * Keep v1 enabled by default for backward compatibility. * Enable v2 by default because that's the new API since Juno release. Change-Id: I81a5c6696708732a0de34225200f1242e988d0aa Closes-Bug: #1512577
This commit is contained in:
parent
3878c3d56e
commit
cf8041398f
|
@ -41,6 +41,36 @@
|
||||||
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8786/v1/%(tenant_id)s')
|
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8786/v1/%(tenant_id)s')
|
||||||
# This url should *not* contain any trailing '/'.
|
# This url should *not* contain any trailing '/'.
|
||||||
#
|
#
|
||||||
|
# [*password_v2*]
|
||||||
|
# Password for Manila v2 user. Optional. Defaults to undef.
|
||||||
|
#
|
||||||
|
# [*email_v2*]
|
||||||
|
# Email for Manila v2 user. Optional. Defaults to 'manilav2@localhost'.
|
||||||
|
#
|
||||||
|
# [*auth_name_v2*]
|
||||||
|
# Username for Manila v2 service. Optional. Defaults to 'manilav2'.
|
||||||
|
#
|
||||||
|
# [*configure_endpoint_v2*]
|
||||||
|
# Should Manila v2 endpoint be configured? Optional. Defaults to 'true'.
|
||||||
|
#
|
||||||
|
# [*service_type_v2*]
|
||||||
|
# Type of service v2. Optional. Defaults to 'sharev2'.
|
||||||
|
#
|
||||||
|
# [*service_description_v2*]
|
||||||
|
# Description for keystone service v2. Optional. Defaults to 'Manila Service v2'.
|
||||||
|
#
|
||||||
|
# [*public_url_v2*]
|
||||||
|
# (optional) The v2 endpoint's public url. (Defaults to 'http://127.0.0.1:8786/v2/%(tenant_id)s')
|
||||||
|
# This url should *not* contain any trailing '/'.
|
||||||
|
#
|
||||||
|
# [*admin_url_v2*]
|
||||||
|
# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1:8786/v2/%(tenant_id)s')
|
||||||
|
# This url should *not* contain any trailing '/'.
|
||||||
|
#
|
||||||
|
# [*internal_url_v2*]
|
||||||
|
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8786/v2/%(tenant_id)s')
|
||||||
|
# This url should *not* contain any trailing '/'.
|
||||||
|
#
|
||||||
# [*share_version*]
|
# [*share_version*]
|
||||||
# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
|
# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
|
||||||
# API version endpoint. (Defaults to 'v1')
|
# API version endpoint. (Defaults to 'v1')
|
||||||
|
@ -96,27 +126,44 @@
|
||||||
#
|
#
|
||||||
class manila::keystone::auth (
|
class manila::keystone::auth (
|
||||||
$password,
|
$password,
|
||||||
$auth_name = 'manila',
|
$password_v2 = undef,
|
||||||
$email = 'manila@localhost',
|
$auth_name_v2 = 'manilav2',
|
||||||
$tenant = 'services',
|
$auth_name = 'manila',
|
||||||
$configure_endpoint = true,
|
$email = 'manila@localhost',
|
||||||
$service_type = 'share',
|
$email_v2 = 'manilav2@localhost',
|
||||||
$service_description = 'Manila Service',
|
$tenant = 'services',
|
||||||
$region = 'RegionOne',
|
$configure_endpoint = true,
|
||||||
$public_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
$configure_endpoint_v2 = true,
|
||||||
$admin_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
$service_type = 'share',
|
||||||
$internal_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
$service_type_v2 = 'sharev2',
|
||||||
|
$service_description = 'Manila Service',
|
||||||
|
$service_description_v2 = 'Manila Service v2',
|
||||||
|
$region = 'RegionOne',
|
||||||
|
$public_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
||||||
|
$public_url_v2 = 'http://127.0.0.1:8786/v2/%(tenant_id)s',
|
||||||
|
$admin_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
||||||
|
$admin_url_v2 = 'http://127.0.0.1:8786/v2/%(tenant_id)s',
|
||||||
|
$internal_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
||||||
|
$internal_url_v2 = 'http://127.0.0.1:8786/v2/%(tenant_id)s',
|
||||||
# DEPRECATED PARAMETERS
|
# DEPRECATED PARAMETERS
|
||||||
$share_version = undef,
|
$share_version = undef,
|
||||||
$port = undef,
|
$port = undef,
|
||||||
$public_protocol = undef,
|
$public_protocol = undef,
|
||||||
$public_address = undef,
|
$public_address = undef,
|
||||||
$internal_protocol = undef,
|
$internal_protocol = undef,
|
||||||
$internal_address = undef,
|
$internal_address = undef,
|
||||||
$admin_protocol = undef,
|
$admin_protocol = undef,
|
||||||
$admin_address = undef,
|
$admin_address = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
# for interface backward compatibility, we can't enforce to set a new parameter
|
||||||
|
# so we take 'password' parameter by default but allow to override it.
|
||||||
|
if ! $password_v2 {
|
||||||
|
$password_v2_real = $password
|
||||||
|
} else {
|
||||||
|
$password_v2_real = $password_v2
|
||||||
|
}
|
||||||
|
|
||||||
if $share_version {
|
if $share_version {
|
||||||
warning('The share_version parameter is deprecated, use public_url, internal_url and admin_url instead.')
|
warning('The share_version parameter is deprecated, use public_url, internal_url and admin_url instead.')
|
||||||
}
|
}
|
||||||
|
@ -180,6 +227,7 @@ class manila::keystone::auth (
|
||||||
}
|
}
|
||||||
|
|
||||||
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'manila-api' |>
|
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'manila-api' |>
|
||||||
|
Keystone_user_role["${auth_name_v2}@${tenant}"] ~> Service <| name == 'manila-api' |>
|
||||||
|
|
||||||
keystone::resource::service_identity { $auth_name:
|
keystone::resource::service_identity { $auth_name:
|
||||||
configure_user => true,
|
configure_user => true,
|
||||||
|
@ -196,4 +244,18 @@ class manila::keystone::auth (
|
||||||
internal_url => $internal_url_real,
|
internal_url => $internal_url_real,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keystone::resource::service_identity { $auth_name_v2:
|
||||||
|
configure_user => true,
|
||||||
|
configure_user_role => true,
|
||||||
|
configure_endpoint => $configure_endpoint_v2,
|
||||||
|
service_type => $service_type_v2,
|
||||||
|
service_description => $service_description_v2,
|
||||||
|
region => $region,
|
||||||
|
password => $password_v2_real,
|
||||||
|
email => $email_v2,
|
||||||
|
tenant => $tenant,
|
||||||
|
public_url => $public_url_v2,
|
||||||
|
admin_url => $admin_url_v2,
|
||||||
|
internal_url => $internal_url_v2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,8 @@ describe 'basic manila' do
|
||||||
password => 'a_big_secret',
|
password => 'a_big_secret',
|
||||||
}
|
}
|
||||||
class { '::manila::keystone::auth':
|
class { '::manila::keystone::auth':
|
||||||
password => 'a_big_secret',
|
password => 'a_big_secret',
|
||||||
|
password_v2 => 'a_big_secret',
|
||||||
}
|
}
|
||||||
class { '::manila::client': }
|
class { '::manila::client': }
|
||||||
class { '::manila::compute::nova': }
|
class { '::manila::compute::nova': }
|
||||||
|
|
|
@ -3,7 +3,8 @@ require 'spec_helper'
|
||||||
describe 'manila::keystone::auth' do
|
describe 'manila::keystone::auth' do
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{:password => 'pw'}
|
{:password => 'pw',
|
||||||
|
:password_v2 => 'pw2'}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with only required params' do
|
describe 'with only required params' do
|
||||||
|
@ -25,6 +26,21 @@ describe 'manila::keystone::auth' do
|
||||||
:description => 'Manila Service'
|
:description => 'Manila Service'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_expected.to contain_keystone_user('manilav2').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:password => 'pw2',
|
||||||
|
:email => 'manilav2@localhost',
|
||||||
|
)
|
||||||
|
is_expected.to contain_keystone_user_role('manilav2@services').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:roles => ['admin']
|
||||||
|
)
|
||||||
|
is_expected.to contain_keystone_service('manilav2').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:type => 'sharev2',
|
||||||
|
:description => 'Manila Service v2'
|
||||||
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_keystone_endpoint('RegionOne/manila').with(
|
it { is_expected.to contain_keystone_endpoint('RegionOne/manila').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
|
@ -32,16 +48,25 @@ describe 'manila::keystone::auth' do
|
||||||
:admin_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
:admin_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s',
|
||||||
:internal_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s'
|
:internal_url => 'http://127.0.0.1:8786/v1/%(tenant_id)s'
|
||||||
) }
|
) }
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionOne/manilav2').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s',
|
||||||
|
:admin_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s',
|
||||||
|
:internal_url => 'http://127.0.0.1:8786/v2/%(tenant_id)s'
|
||||||
|
) }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when overriding endpoint parameters' do
|
context 'when overriding endpoint parameters' do
|
||||||
before do
|
before do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
:region => 'RegionThree',
|
:region => 'RegionThree',
|
||||||
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
|
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
|
||||||
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
|
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
|
||||||
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
|
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s',
|
||||||
|
:public_url_v2 => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
|
||||||
|
:admin_url_v2 => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
|
||||||
|
:internal_url_v2 => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,6 +76,12 @@ describe 'manila::keystone::auth' do
|
||||||
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
|
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
|
||||||
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
|
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
|
||||||
)}
|
)}
|
||||||
|
it { is_expected.to contain_keystone_endpoint('RegionThree/manilav2').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:public_url => 'https://10.0.42.1:4242/v43/%(tenant_id)s',
|
||||||
|
:admin_url => 'https://10.0.42.2:4242/v43/%(tenant_id)s',
|
||||||
|
:internal_url => 'https://10.0.42.3:4242/v43/%(tenant_id)s'
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when deprecated endpoint parameters' do
|
context 'when deprecated endpoint parameters' do
|
||||||
|
@ -79,9 +110,11 @@ describe 'manila::keystone::auth' do
|
||||||
describe 'when endpoint should not be configured' do
|
describe 'when endpoint should not be configured' do
|
||||||
before do
|
before do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
:configure_endpoint => false
|
:configure_endpoint => false,
|
||||||
|
:configure_endpoint_v2 => false
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila') }
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila') }
|
||||||
|
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manilav2') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue