Add API v3 endpoint support

Nova API v3 is now by default in Icehouse. This patch aims to add the
ability to create the endpoint or not.

Change-Id: I66c6c9b439f8320cd56b6899d02bbe01b80f7243
Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi
2014-05-08 00:20:06 +02:00
parent 47d576d2e6
commit 00ed6139ec
2 changed files with 37 additions and 0 deletions

View File

@@ -11,6 +11,10 @@
# (optional) The name of the nova service user
# Defaults to 'nova'
#
# [*auth_name_v3*]
# (optional) The name of the nova v3 service user
# Defaults to 'novav3'
#
# [*public_address*]
# (optional) The public nova-api endpoint
# Defaults to '127.0.0.1'
@@ -55,6 +59,10 @@
# (optional) Whether to create the endpoint.
# Defaults to true
#
# [*configure_endpoint_v3*]
# (optional) Whether to create the v3 endpoint.
# Defaults to true
#
# [*cinder*]
# (optional) Deprecated and has no effect
# Defaults to undef
@@ -72,6 +80,7 @@
class nova::keystone::auth(
$password,
$auth_name = 'nova',
$auth_name_v3 = 'novav3',
$public_address = '127.0.0.1',
$admin_address = '127.0.0.1',
$internal_address = '127.0.0.1',
@@ -85,6 +94,7 @@ class nova::keystone::auth(
$cinder = undef,
$public_protocol = 'http',
$configure_endpoint = true,
$configure_endpoint_v3 = true,
$admin_protocol = 'http',
$internal_protocol = 'http'
) {
@@ -110,6 +120,11 @@ class nova::keystone::auth(
type => 'compute',
description => 'Openstack Compute Service',
}
keystone_service { $auth_name_v3:
ensure => present,
type => 'computev3',
description => 'Openstack Compute Service v3',
}
if $configure_endpoint {
keystone_endpoint { "${region}/${auth_name}":
@@ -120,6 +135,15 @@ class nova::keystone::auth(
}
}
if $configure_endpoint_v3 {
keystone_endpoint { "${region}/${auth_name_v3}":
ensure => present,
public_url => "${public_protocol}://${public_address}:${compute_port}/v3",
admin_url => "${admin_protocol}://${admin_address}:${compute_port}/v3",
internal_url => "${internal_protocol}://${internal_address}:${compute_port}/v3",
}
}
if $configure_ec2_endpoint {
keystone_service { "${auth_name}_ec2":
ensure => present,

View File

@@ -24,6 +24,12 @@ describe 'nova::keystone::auth' do
:description => 'Openstack Compute Service'
)}
it { should contain_keystone_service('novav3').with(
:ensure => 'present',
:type => 'computev3',
:description => 'Openstack Compute Service v3'
)}
it { should contain_keystone_service('nova_ec2').with(
:ensure => 'present',
:type => 'ec2',
@@ -37,6 +43,13 @@ describe 'nova::keystone::auth' do
:internal_url => 'http://127.0.0.1:8774/v2/%(tenant_id)s'
)}
it { should contain_keystone_endpoint('RegionOne/novav3').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8774/v3',
:admin_url => 'http://127.0.0.1:8774/v3',
:internal_url => 'http://127.0.0.1:8774/v3'
)}
it { should contain_keystone_endpoint('RegionOne/nova_ec2').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8773/services/Cloud',