Add support for parameters required for unified limits feature
This change introduces support for the [quota] driver parameter and the oslo.limit library parameters, so that users can set up unified limits feature which is being implemented in Yoga release[1]. [1] https://specs.openstack.org/openstack/nova-specs/specs/yoga/approved/unified-limits-nova.html Change-Id: I6533036a5ccb38c2c12899beba008b8b97622a21
This commit is contained in:
91
manifests/limit.pp
Normal file
91
manifests/limit.pp
Normal file
@@ -0,0 +1,91 @@
|
||||
# == Class: nova::limit
|
||||
#
|
||||
# Configure oslo_limit options
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*endpoint_id*]
|
||||
# (Required) The service's endpoint id which is registered in Keystone.
|
||||
#
|
||||
# [*password*]
|
||||
# (Required) Password to create for the service user
|
||||
#
|
||||
# [*username*]
|
||||
# (Optional) The name of the service user
|
||||
# Defaults to 'nova'
|
||||
#
|
||||
# [*auth_url*]
|
||||
# (Optional) The URL to use for authentication.
|
||||
# Defaults to 'http://localhost:5000'
|
||||
#
|
||||
# [*project_name*]
|
||||
# (Optional) Service project name
|
||||
# Defaults to 'services'
|
||||
#
|
||||
# [*user_domain_name*]
|
||||
# (Optional) Name of domain for $username
|
||||
# Defaults to 'Default'.
|
||||
#
|
||||
# [*project_domain_name*]
|
||||
# (Optional) Name of domain for $project_name
|
||||
# Defaults to 'Default'.
|
||||
#
|
||||
# [*system_scope*]
|
||||
# (Optional) Scope for system operations.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*auth_type*]
|
||||
# (Optional) Authentication type to load
|
||||
# Defaults to 'password'.
|
||||
#
|
||||
# [*service_type*]
|
||||
# (Optional) The name or type of the service as it appears in the service
|
||||
# catalog. This is used to validate tokens that have restricted access rules.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*valid_interfaces*]
|
||||
# (Optional) List of interfaces, in order of preference, for endpoint URL.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) The region in which the identity server can be found.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*endpoint_override*]
|
||||
# (Optional) Always use this endpoint URL for requests for this client.
|
||||
# Defualts to $::os_service_default.
|
||||
#
|
||||
class nova::limit(
|
||||
$endpoint_id,
|
||||
$password,
|
||||
$username = 'nova',
|
||||
$auth_url = 'http://localhost:5000',
|
||||
$project_name = 'services',
|
||||
$user_domain_name = 'Default',
|
||||
$project_domain_name = 'Default',
|
||||
$system_scope = $::os_service_default,
|
||||
$auth_type = 'password',
|
||||
$service_type = $::os_service_default,
|
||||
$valid_interfaces = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
$endpoint_override = $::os_service_default,
|
||||
) {
|
||||
|
||||
include nova::deps
|
||||
|
||||
oslo::limit { 'nova_config':
|
||||
endpoint_id => $endpoint_id,
|
||||
username => $username,
|
||||
password => $password,
|
||||
auth_url => $auth_url,
|
||||
project_name => $project_name,
|
||||
user_domain_name => $user_domain_name,
|
||||
project_domain_name => $project_domain_name,
|
||||
system_scope => $system_scope,
|
||||
auth_type => $auth_type,
|
||||
service_type => $service_type,
|
||||
valid_interfaces => join(any2array($valid_interfaces), ','),
|
||||
region_name => $region_name,
|
||||
endpoint_override => $endpoint_override,
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,10 @@
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*driver*]
|
||||
# (optional) Driver to use for quota checks.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*instances*]
|
||||
# (optional) Number of instances
|
||||
# Defaults to $::os_service_default
|
||||
@@ -75,6 +79,7 @@
|
||||
# Defaults to undef
|
||||
#
|
||||
class nova::quota(
|
||||
$driver = $::os_service_default,
|
||||
$instances = $::os_service_default,
|
||||
$cores = $::os_service_default,
|
||||
$ram = $::os_service_default,
|
||||
@@ -112,6 +117,7 @@ class nova::quota(
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'quota/driver': value => $driver;
|
||||
'quota/instances': value => $instances;
|
||||
'quota/cores': value => $cores;
|
||||
'quota/ram': value => $ram;
|
||||
|
||||
8
releasenotes/notes/unified-limit-93329f1bccb6628e.yaml
Normal file
8
releasenotes/notes/unified-limit-93329f1bccb6628e.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``nova::limit`` class has been added. This class manages parameters
|
||||
of the ``oslo.limit`` library.
|
||||
|
||||
- |
|
||||
The new ``nova::quota::driver`` parameter has been added.
|
||||
81
spec/classes/nova_limit_spec.rb
Normal file
81
spec/classes/nova_limit_spec.rb
Normal file
@@ -0,0 +1,81 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::limit' do
|
||||
|
||||
shared_examples_for 'nova::limit' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
|
||||
:password => 'nova_password',
|
||||
}
|
||||
end
|
||||
|
||||
it 'configure limit default params' do
|
||||
is_expected.to contain_oslo__limit('nova_config').with(
|
||||
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
|
||||
:username => 'nova',
|
||||
:password => 'nova_password',
|
||||
:auth_url => 'http://localhost:5000',
|
||||
:project_name => 'services',
|
||||
:user_domain_name => 'Default',
|
||||
:project_domain_name => 'Default',
|
||||
:system_scope => '<SERVICE DEFAULT>',
|
||||
:auth_type => 'password',
|
||||
:service_type => '<SERVICE DEFAULT>',
|
||||
:valid_interfaces => '<SERVICE DEFAULT>',
|
||||
:region_name => '<SERVICE DEFAULT>',
|
||||
:endpoint_override => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:username => 'alt_nova',
|
||||
:auth_url => 'http://192.168.0.1:5000',
|
||||
:project_name => 'alt_services',
|
||||
:user_domain_name => 'domainX',
|
||||
:project_domain_name => 'domainX',
|
||||
:system_scope => 'all',
|
||||
:auth_type => 'v3password',
|
||||
:service_type => 'identity',
|
||||
:valid_interfaces => 'public',
|
||||
:region_name => 'regionOne',
|
||||
:endpoint_override => 'http://192.168.0.2:5000',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure limit params' do
|
||||
is_expected.to contain_oslo__limit('nova_config').with(
|
||||
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
|
||||
:username => 'alt_nova',
|
||||
:password => 'nova_password',
|
||||
:auth_url => 'http://192.168.0.1:5000',
|
||||
:project_name => 'alt_services',
|
||||
:user_domain_name => 'domainX',
|
||||
:project_domain_name => 'domainX',
|
||||
:system_scope => 'all',
|
||||
:auth_type => 'v3password',
|
||||
:service_type => 'identity',
|
||||
:valid_interfaces => 'public',
|
||||
:region_name => 'regionOne',
|
||||
:endpoint_override => 'http://192.168.0.2:5000',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'nova::limit'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user