puppet-cinder/manifests/quota_set.pp
Matt Fischer bb1e3e67dc Cinder hooks support
This code moves all deps to an external class so that Cinder can be
installed with mechanisms besides packages (like venv or docker). This
also cleans-up the dependency tree by removing false or confusing
dependencies.

Co-Author: Craig Delatte <craig.delatte@twcable.com>

Change-Id: I55a62f6173fe463fb8fb65df6729c9f509a0fb04
2016-09-13 09:18:41 -06:00

89 lines
2.2 KiB
Puppet

# == Class: cinder::quota_set
#
# Setup and configure Cinder quotas per volume type.
#
# === Parameters
#
# [*os_password*]
# (Required) The keystone tenant:username password.
#
# [*os_tenant_name*]
# (Optional) The keystone tenant name.
# Defaults to 'admin'.
#
# [*os_username*]
# (Optional) The keystone user name.
# Defaults to 'admin'.
#
# [*os_auth_url*]
# (Optional) The keystone auth url.
# Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*os_region_name*]
# (Optional) The keystone region name.
# Default is unset.
#
# [*quota_volumes*]
# (Optional) Number of volumes allowed per project.
# Defaults to 10.
#
# [*quota_snapshots*]
# (Optional) Number of volume snapshots allowed per project.
# Defaults to 10.
#
# [*quota_gigabytes*]
# (Optional) Number of volume gigabytes (snapshots are also included)
# allowed per project.
# Defaults to 1000.
#
# [*class_name*]
# (Optional) Quota class to use.
# Defaults to 'default'.
#
# [*volume_type*]
# volume type that will have quota changed
# Defaults to $name
#
define cinder::quota_set (
$os_password,
$os_tenant_name = 'admin',
$os_username = 'admin',
$os_auth_url = 'http://127.0.0.1:5000/v2.0/',
$os_region_name = undef,
$quota_volumes = 10,
$quota_snapshots = 10,
$quota_gigabytes = 1000,
$class_name = 'default',
$volume_type = $name,
) {
include ::cinder::deps
if $os_region_name {
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
"OS_REGION_NAME=${os_region_name}",
]
}
else {
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
]
}
exec {"cinder quota-class-update ${class_name}":
command => "cinder quota-class-update ${class_name} --volumes ${quota_volumes} --snapshots ${quota_snapshots} --gigabytes ${quota_gigabytes} --volume-type '${volume_type}'",
onlyif => 'cinder quota-class-show default | grep -qP -- -1',
environment => $cinder_env,
require => Anchor['cinder-support-package'],
path => ['/usr/bin', '/bin'],
}
}