Allow to manage Cinder Volume types from backends

manage_volume_type is a new parameter present in every Cinder backend.
When set to True, it will manage the Cinder Volume type for the backend.
For backward compatibility, it is set to False by default.

Change-Id: I193b8e517f5804a1bce5bf472f2ca6242414354f
This commit is contained in:
Emilien Macchi 2016-08-10 17:37:21 -04:00
parent cfd7891e88
commit 642aa03111
37 changed files with 418 additions and 6 deletions

View File

@ -40,6 +40,12 @@
# (Optional) Method used to wipe old volumes # (Optional) Method used to wipe old volumes
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend # (optional) Hash of extra options to pass to the backend
# Defaults to: {} # Defaults to: {}
@ -67,6 +73,7 @@ define cinder::backend::bdd (
$iscsi_helper = 'tgtadm', $iscsi_helper = 'tgtadm',
$iscsi_protocol = $::os_service_default, $iscsi_protocol = $::os_service_default,
$volume_clear = $::os_service_default, $volume_clear = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -84,6 +91,13 @@ define cinder::backend::bdd (
"${name}/volume_clear": value => $volume_clear; "${name}/volume_clear": value => $volume_clear;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
case $iscsi_helper { case $iscsi_helper {

View File

@ -49,6 +49,12 @@
# Example: # Example:
# { 'dellsc_iscsi_backend/param1' => { 'value' => value1 } } # { 'dellsc_iscsi_backend/param1' => { 'value' => value1 } }
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
define cinder::backend::dellsc_iscsi ( define cinder::backend::dellsc_iscsi (
$san_ip, $san_ip,
$san_login, $san_login,
@ -61,6 +67,7 @@ define cinder::backend::dellsc_iscsi (
$dell_sc_verify_cert = $::os_service_default, $dell_sc_verify_cert = $::os_service_default,
$dell_sc_volume_folder = 'vol', $dell_sc_volume_folder = 'vol',
$iscsi_port = $::os_service_default, $iscsi_port = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -88,6 +95,13 @@ define cinder::backend::dellsc_iscsi (
"${name}/iscsi_port": value => $iscsi_port; "${name}/iscsi_port": value => $iscsi_port;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -66,6 +66,12 @@
# (optional) Naviseccli Path. # (optional) Naviseccli Path.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
define cinder::backend::emc_vnx ( define cinder::backend::emc_vnx (
$iscsi_ip_address, $iscsi_ip_address,
$san_ip, $san_ip,
@ -82,6 +88,7 @@ define cinder::backend::emc_vnx (
$storage_vnx_auth_type = $::os_service_default, $storage_vnx_auth_type = $::os_service_default,
$storage_vnx_security_file_dir = $::os_service_default, $storage_vnx_security_file_dir = $::os_service_default,
$naviseccli_path = $::os_service_default, $naviseccli_path = $::os_service_default,
$manage_volume_type = false,
) { ) {
include ::cinder::params include ::cinder::params
@ -102,6 +109,13 @@ define cinder::backend::emc_vnx (
"${name}/storage_vnx_security_file_dir": value => $storage_vnx_security_file_dir; "${name}/storage_vnx_security_file_dir": value => $storage_vnx_security_file_dir;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -55,6 +55,12 @@
# (optional) The timeout for the Group Manager cli command execution. # (optional) The timeout for the Group Manager cli command execution.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# === DEPRECATED PARAMETERS # === DEPRECATED PARAMETERS
# #
# [*eqlx_use_chap*] # [*eqlx_use_chap*]
@ -88,6 +94,7 @@ define cinder::backend::eqlx (
$chap_password = $::os_service_default, $chap_password = $::os_service_default,
$use_chap_auth = $::os_service_default, $use_chap_auth = $::os_service_default,
$ssh_conn_timeout = $::os_service_default, $ssh_conn_timeout = $::os_service_default,
$manage_volume_type = false,
# Deprecated # Deprecated
$eqlx_use_chap = undef, $eqlx_use_chap = undef,
$eqlx_chap_login = undef, $eqlx_chap_login = undef,
@ -145,6 +152,13 @@ define cinder::backend::eqlx (
"${name}/eqlx_pool": value => $eqlx_pool; "${name}/eqlx_pool": value => $eqlx_pool;
} }
if $manage_volume_type {
cinder_type { $name:
ensure => present,
properties => ["volume_backend_name=${name}"],
}
}
# the default for this is false # the default for this is false
if !is_service_default($use_chap_auth_real) and $use_chap_auth_real == true { if !is_service_default($use_chap_auth_real) and $use_chap_auth_real == true {
cinder_config { cinder_config {

View File

@ -41,6 +41,12 @@
# Example : # Example :
# { 'glusterfs_backend/param1' => { 'value' => value1 } } # { 'glusterfs_backend/param1' => { 'value' => value1 } }
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# === Examples # === Examples
# #
# cinder::backend::glusterfs { 'myGluster': # cinder::backend::glusterfs { 'myGluster':
@ -55,6 +61,7 @@ define cinder::backend::glusterfs (
$glusterfs_sparsed_volumes = $::os_service_default, $glusterfs_sparsed_volumes = $::os_service_default,
$glusterfs_mount_point_base = $::os_service_default, $glusterfs_mount_point_base = $::os_service_default,
$glusterfs_shares_config = '/etc/cinder/shares.conf', $glusterfs_shares_config = '/etc/cinder/shares.conf',
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -77,6 +84,13 @@ define cinder::backend::glusterfs (
"${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base; "${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -64,6 +64,12 @@
# (optional) SSH port to use to connect to NAS system. # (optional) SSH port to use to connect to NAS system.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -90,6 +96,7 @@ define cinder::backend::gpfs (
$nas_password = $::os_service_default, $nas_password = $::os_service_default,
$nas_private_key = $::os_service_default, $nas_private_key = $::os_service_default,
$nas_ssh_port = $::os_service_default, $nas_ssh_port = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -116,6 +123,13 @@ define cinder::backend::gpfs (
"${name}/nas_ssh_port": value => $nas_ssh_port; "${name}/nas_ssh_port": value => $nas_ssh_port;
} }
if $manage_volume_type {
cinder_type { $name:
ensure => present,
properties => ["volume_backend_name=${name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -53,6 +53,12 @@
# than hp3par_snapshot_retention. # than hp3par_snapshot_retention.
# Defaults to 72. # Defaults to 72.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -73,6 +79,7 @@ define cinder::backend::hp3par_iscsi(
$hp3par_snap_cpg = 'OpenstackCPG', $hp3par_snap_cpg = 'OpenstackCPG',
$hp3par_snapshot_retention = 48, $hp3par_snapshot_retention = 48,
$hp3par_snapshot_expiration = 72, $hp3par_snapshot_expiration = 72,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -98,6 +105,13 @@ define cinder::backend::hp3par_iscsi(
"${name}/hpe3par_snapshot_expiration": value => $hp3par_snapshot_expiration; "${name}/hpe3par_snapshot_expiration": value => $hp3par_snapshot_expiration;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -54,6 +54,12 @@
# than hpe3par_snapshot_retention. # than hpe3par_snapshot_retention.
# Defaults to 72. # Defaults to 72.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -74,6 +80,7 @@ define cinder::backend::hpe3par_iscsi(
$hpe3par_cpg_snap = 'userCPG', $hpe3par_cpg_snap = 'userCPG',
$hpe3par_snapshot_retention = 48, $hpe3par_snapshot_retention = 48,
$hpe3par_snapshot_expiration = 72, $hpe3par_snapshot_expiration = 72,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -97,6 +104,13 @@ define cinder::backend::hpe3par_iscsi(
"${name}/hpe3par_snapshot_expiration": value => $hpe3par_snapshot_expiration; "${name}/hpe3par_snapshot_expiration": value => $hpe3par_snapshot_expiration;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -30,6 +30,12 @@
# (Optional) Protocol to use as iSCSI driver # (Optional) Protocol to use as iSCSI driver
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -44,6 +50,7 @@ define cinder::backend::iscsi (
$volumes_dir = '/var/lib/cinder/volumes', $volumes_dir = '/var/lib/cinder/volumes',
$iscsi_helper = $::cinder::params::iscsi_helper, $iscsi_helper = $::cinder::params::iscsi_helper,
$iscsi_protocol = $::os_service_default, $iscsi_protocol = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -59,6 +66,13 @@ define cinder::backend::iscsi (
"${name}/iscsi_protocol": value => $iscsi_protocol; "${name}/iscsi_protocol": value => $iscsi_protocol;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
case $iscsi_helper { case $iscsi_helper {

View File

@ -152,6 +152,12 @@
# application. # application.
# Defaults to '/devmgr/v2' # Defaults to '/devmgr/v2'
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -211,6 +217,7 @@ define cinder::backend::netapp (
$netapp_storage_pools = undef, $netapp_storage_pools = undef,
$netapp_host_type = $::os_service_default, $netapp_host_type = $::os_service_default,
$netapp_webservice_path = '/devmgr/v2', $netapp_webservice_path = '/devmgr/v2',
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$netapp_eseries_host_type = undef, $netapp_eseries_host_type = undef,
@ -260,6 +267,13 @@ define cinder::backend::netapp (
"${name}/netapp_webservice_path": value => $netapp_webservice_path; "${name}/netapp_webservice_path": value => $netapp_webservice_path;
} }
if $manage_volume_type {
cinder_type { $name:
ensure => present,
properties => ["volume_backend_name=${name}"],
}
}
if $netapp_storage_family == 'eseries' { if $netapp_storage_family == 'eseries' {
cinder_config { cinder_config {
"${name}/use_multipath_for_image_xfer": value => true; "${name}/use_multipath_for_image_xfer": value => true;

View File

@ -32,6 +32,12 @@
# [*nexenta_sparse*] # [*nexenta_sparse*]
# (optional) Flag to create sparse volumes. Defaults to true. # (optional) Flag to create sparse volumes. Defaults to true.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -48,6 +54,7 @@ define cinder::backend::nexenta (
$nexenta_target_group_prefix = 'cinder/', $nexenta_target_group_prefix = 'cinder/',
$nexenta_blocksize = '8k', $nexenta_blocksize = '8k',
$nexenta_sparse = true, $nexenta_sparse = true,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -64,6 +71,13 @@ define cinder::backend::nexenta (
"${name}/volume_driver": value => 'cinder.volume.drivers.nexenta.volume.NexentaDriver'; "${name}/volume_driver": value => 'cinder.volume.drivers.nexenta.volume.NexentaDriver';
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -49,6 +49,12 @@
# longer be valid. # longer be valid.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -66,6 +72,7 @@ define cinder::backend::nfs (
$nfs_shares_config = '/etc/cinder/shares.conf', $nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_used_ratio = $::os_service_default, $nfs_used_ratio = $::os_service_default,
$nfs_oversub_ratio = $::os_service_default, $nfs_oversub_ratio = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -89,6 +96,13 @@ define cinder::backend::nfs (
"${name}/nfs_oversub_ratio": value => $nfs_oversub_ratio; "${name}/nfs_oversub_ratio": value => $nfs_oversub_ratio;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -28,6 +28,12 @@
# (optional) Only affects the PureISCSIDriver. # (optional) Only affects the PureISCSIDriver.
# Defaults to False # Defaults to False
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza. # (optional) Hash of extra options to pass to the backend stanza.
# Defaults to: {} # Defaults to: {}
@ -41,6 +47,7 @@ define cinder::backend::pure(
$pure_storage_protocol = 'iSCSI', $pure_storage_protocol = 'iSCSI',
$use_chap_auth = false, $use_chap_auth = false,
$use_multipath_for_image_xfer = true, $use_multipath_for_image_xfer = true,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -58,5 +65,12 @@ define cinder::backend::pure(
"${name}/use_multipath_for_image_xfer": value => $use_multipath_for_image_xfer ; "${name}/use_multipath_for_image_xfer": value => $use_multipath_for_image_xfer ;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -34,6 +34,12 @@
# (optional) Allows for the volume_backend_name to be separate of $name. # (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name # Defaults to: $name
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# === Examples # === Examples
# #
# cinder::backend::quobyte { 'quobyte1': # cinder::backend::quobyte { 'quobyte1':
@ -47,6 +53,7 @@ define cinder::backend::quobyte (
$quobyte_sparsed_volumes = undef, $quobyte_sparsed_volumes = undef,
$quobyte_mount_point_base = undef, $quobyte_mount_point_base = undef,
$volume_backend_name = $name, $volume_backend_name = $name,
$manage_volume_type = false,
) { ) {
cinder_config { cinder_config {
@ -60,4 +67,11 @@ define cinder::backend::quobyte (
"${name}/quobyte_mount_point_base": value => $quobyte_mount_point_base; "${name}/quobyte_mount_point_base": value => $quobyte_mount_point_base;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
} }

View File

@ -57,6 +57,12 @@
# (optional) Volumes will be chunked into objects of this size (in megabytes). # (optional) Volumes will be chunked into objects of this size (in megabytes).
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -83,6 +89,7 @@ define cinder::backend::rbd (
$rados_connection_interval = $::os_service_default, $rados_connection_interval = $::os_service_default,
$rados_connection_retries = $::os_service_default, $rados_connection_retries = $::os_service_default,
$rbd_store_chunk_size = $::os_service_default, $rbd_store_chunk_size = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$volume_tmp_dir = false, $volume_tmp_dir = false,
@ -105,6 +112,13 @@ define cinder::backend::rbd (
"${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size; "${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
if $backend_host { if $backend_host {
cinder_config { cinder_config {
"${name}/backend_host": value => $backend_host; "${name}/backend_host": value => $backend_host;

View File

@ -50,6 +50,12 @@
# (Optional) Maximum ssh connections in the pool. # (Optional) Maximum ssh connections in the pool.
# Defaults to '5'. # Defaults to '5'.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -70,6 +76,7 @@ define cinder::backend::san (
$ssh_conn_timeout = 30, $ssh_conn_timeout = 30,
$ssh_min_pool_conn = 1, $ssh_min_pool_conn = 1,
$ssh_max_pool_conn = 5, $ssh_max_pool_conn = 5,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -89,6 +96,13 @@ define cinder::backend::san (
"${name}/ssh_max_pool_conn": value => $ssh_max_pool_conn; "${name}/ssh_max_pool_conn": value => $ssh_max_pool_conn;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -70,6 +70,12 @@
# (optional) Utilize volume access groups on a per-tenant basis. # (optional) Utilize volume access groups on a per-tenant basis.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -92,6 +98,7 @@ define cinder::backend::solidfire(
$sf_svip = $::os_service_default, $sf_svip = $::os_service_default,
$sf_enable_volume_mapping = $::os_service_default, $sf_enable_volume_mapping = $::os_service_default,
$sf_enable_vag = $::os_service_default, $sf_enable_vag = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -113,6 +120,13 @@ define cinder::backend::solidfire(
"${name}/sf_enable_vag": value => $sf_enable_vag; "${name}/sf_enable_vag": value => $sf_enable_vag;
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
} }

View File

@ -49,6 +49,12 @@
# (optional) The name for the folder in the VC datacenter that will contain cinder volumes. # (optional) The name for the folder in the VC datacenter that will contain cinder volumes.
# Defaults to 'cinder-volumes'. # Defaults to 'cinder-volumes'.
# #
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinde Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
# [*extra_options*] # [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza # (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {} # Defaults to: {}
@ -66,6 +72,7 @@ define cinder::backend::vmdk (
$task_poll_interval = 5, $task_poll_interval = 5,
$image_transfer_timeout_secs = $::os_service_default, $image_transfer_timeout_secs = $::os_service_default,
$wsdl_location = $::os_service_default, $wsdl_location = $::os_service_default,
$manage_volume_type = false,
$extra_options = {}, $extra_options = {},
) { ) {
@ -92,6 +99,13 @@ define cinder::backend::vmdk (
"${name}/host": value => "vmdk:${host_ip}-${volume_folder}"; "${name}/host": value => "vmdk:${host_ip}-${volume_folder}";
} }
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
package { 'python-suds': package { 'python-suds':
ensure => present ensure => present
} }

View File

@ -0,0 +1,5 @@
---
features:
- manage_volume_type is a new parameter present in every Cinder backend.
When set to True, it will manage the Cinder Volume type for the backend.
For backward compatibility, it is set to False by default.

View File

@ -34,6 +34,7 @@ describe 'cinder::backend::bdd' do
:volume_clear => 'zero', :volume_clear => 'zero',
:volume_group => 'cinder', :volume_group => 'cinder',
:iscsi_helper => 'lioadm', :iscsi_helper => 'lioadm',
:manage_volume_type => true,
}) })
end end
@ -45,6 +46,9 @@ describe 'cinder::backend::bdd' do
should contain_cinder_config('hippo/volume_group').with_value('cinder') should contain_cinder_config('hippo/volume_group').with_value('cinder')
should contain_cinder_config('hippo/volume_clear').with_value('zero') should contain_cinder_config('hippo/volume_clear').with_value('zero')
end end
it 'should create type with properties' do
should contain_cinder_type('hippo').with(:ensure => :present, :properties => ['volume_backend_name=hippo'])
end
end end
context 'block device backend with additional configuration' do context 'block device backend with additional configuration' do

View File

@ -60,4 +60,13 @@ describe 'cinder::backend::dellsc_iscsi' do
end end
end end
context 'dellsc_iscsi backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('dellsc_iscsi').with(:ensure => :present, :properties => ['volume_backend_name=dellsc_iscsi'])
end
end
end end

View File

@ -44,6 +44,7 @@ describe 'cinder::backend::emc_vnx' do
:storage_vnx_auth_type => 'global', :storage_vnx_auth_type => 'global',
:storage_vnx_security_file_dir => '/etc/secfile/array1', :storage_vnx_security_file_dir => '/etc/secfile/array1',
:naviseccli_path => '/opt/Navisphere/bin/naviseccli', :naviseccli_path => '/opt/Navisphere/bin/naviseccli',
:manage_volume_type => true,
}) })
end end
@ -53,6 +54,10 @@ describe 'cinder::backend::emc_vnx' do
is_expected.to contain_cinder_config('emc/storage_vnx_security_file_dir').with_value(params[:storage_vnx_security_file_dir]) is_expected.to contain_cinder_config('emc/storage_vnx_security_file_dir').with_value(params[:storage_vnx_security_file_dir])
is_expected.to contain_cinder_config('emc/naviseccli_path').with_value(params[:naviseccli_path]) is_expected.to contain_cinder_config('emc/naviseccli_path').with_value(params[:naviseccli_path])
end end
it 'should create type with properties' do
should contain_cinder_type('emc').with(:ensure => :present, :properties => ['volume_backend_name=emc'])
end
end end
describe 'emc vnx backend with additional configuration' do describe 'emc vnx backend with additional configuration' do

View File

@ -47,6 +47,15 @@ describe 'cinder::backend::eqlx' do
end end
end end
describe 'eqlx backend with cinder type' do
before :each do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('eqlx-1').with(:ensure => :present, :properties => ['volume_backend_name=eqlx-1'])
end
end
context 'eqlx backend with chap' do context 'eqlx backend with chap' do
before :each do before :each do
params.merge!({ params.merge!({

View File

@ -50,6 +50,15 @@ describe 'cinder::backend::glusterfs' do
end end
end end
context 'glusterfs backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('mygluster').with(:ensure => :present, :properties => ['volume_backend_name=mygluster'])
end
end
end end
on_supported_os({ on_supported_os({

View File

@ -95,6 +95,15 @@ describe 'cinder::backend::gpfs' do
it_raises 'a Puppet::Error', /gpfs_images_share_mode only support `copy` or `copy_on_write`/ it_raises 'a Puppet::Error', /gpfs_images_share_mode only support `copy` or `copy_on_write`/
end end
context 'gpfs backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('gpfs').with(:ensure => :present, :properties => ['volume_backend_name=gpfs'])
end
end
context 'gpfs backend with additional configuration' do context 'gpfs backend with additional configuration' do
before do before do
params.merge!({:extra_options => {'gpfs/param1' => { 'value' => 'value1' }}}) params.merge!({:extra_options => {'gpfs/param1' => { 'value' => 'value1' }}})

View File

@ -44,4 +44,13 @@ describe 'cinder::backend::hp3par_iscsi' do
end end
end end
describe 'hp3par_iscsi backend with cinder type' do
before :each do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('hp3par_iscsi').with(:ensure => :present, :properties => ['volume_backend_name=hp3par_iscsi'])
end
end
end end

View File

@ -44,4 +44,13 @@ describe 'cinder::backend::hpe3par_iscsi' do
end end
end end
describe 'hpe3par_iscsi backend with cinder type' do
before :each do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('hpe3par_iscsi').with(:ensure => :present, :properties => ['volume_backend_name=hpe3par_iscsi'])
end
end
end end

View File

@ -69,6 +69,15 @@ describe 'cinder::backend::iscsi' do
end end
end end
describe 'iscsi backend with cinder type' do
before :each do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('hippo').with(:ensure => :present, :properties => ['volume_backend_name=hippo'])
end
end
describe 'iscsi backend with additional configuration' do describe 'iscsi backend with additional configuration' do
before :each do before :each do
params.merge!({:extra_options => {'hippo/param1' => {'value' => 'value1'}}}) params.merge!({:extra_options => {'hippo/param1' => {'value' => 'value1'}}})

View File

@ -99,6 +99,15 @@ describe 'cinder::backend::netapp' do
end end
end end
context 'netapp backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('netapp').with(:ensure => :present, :properties => ['volume_backend_name=netapp'])
end
end
context 'netapp backend with additional configuration' do context 'netapp backend with additional configuration' do
before do before do
params.merge!({:extra_options => {'netapp/param1' => { 'value' => 'value1' }}}) params.merge!({:extra_options => {'netapp/param1' => { 'value' => 'value1' }}})

View File

@ -49,4 +49,13 @@ describe 'cinder::backend::nexenta' do
end end
end end
context 'nexenta backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('nexenta').with(:ensure => :present, :properties => ['volume_backend_name=nexenta'])
end
end
end end

View File

@ -61,4 +61,13 @@ describe 'cinder::backend::nfs' do
end end
end end
describe 'nfs backend with cinder type' do
before :each do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('hippo').with(:ensure => :present, :properties => ['volume_backend_name=hippo'])
end
end
end end

View File

@ -67,4 +67,13 @@ describe 'cinder::backend::pure' do
end end
end end
describe 'pure backend with cinder type' do
let :params do
req_params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('pure').with(:ensure => :present, :properties => ['volume_backend_name=pure'])
end
end
end end

View File

@ -24,6 +24,14 @@ describe 'cinder::backend::quobyte' do
true) true)
end end
context 'quobyte backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('myquobyte').with(:ensure => :present, :properties => ['volume_backend_name=myquobyte'])
end
end
end end
on_supported_os({ on_supported_os({

View File

@ -97,6 +97,15 @@ describe 'cinder::backend::rbd' do
end end
end end
context 'rbd backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('rbd-ssd').with(:ensure => :present, :properties => ['volume_backend_name=rbd-ssd'])
end
end
end end
describe 'with RedHat' do describe 'with RedHat' do

View File

@ -50,4 +50,13 @@ describe 'cinder::backend::san' do
end end
end end
context 'san backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('mysan').with(:ensure => :present, :properties => ['volume_backend_name=mysan'])
end
end
end end

View File

@ -94,6 +94,18 @@ describe 'cinder::backend::solidfire' do
end end
end end
context 'solidfire backend with cinder type' do
let :params do
req_params
end
before :each do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('solidfire').with(:ensure => :present, :properties => ['volume_backend_name=solidfire'])
end
end
context 'without required parameters' do context 'without required parameters' do
before do before do
params = {} params = {}

View File

@ -77,4 +77,13 @@ describe 'cinder::backend::vmdk' do
end end
end end
context 'vmdk backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('hippo').with(:ensure => :present, :properties => ['volume_backend_name=hippo'])
end
end
end end