From 642aa03111293281c175a1a6a87ab38c2c709273 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 10 Aug 2016 17:37:21 -0400 Subject: [PATCH] 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 --- manifests/backend/bdd.pp | 14 ++++++++++++++ manifests/backend/dellsc_iscsi.pp | 14 ++++++++++++++ manifests/backend/emc_vnx.pp | 14 ++++++++++++++ manifests/backend/eqlx.pp | 14 ++++++++++++++ manifests/backend/glusterfs.pp | 14 ++++++++++++++ manifests/backend/gpfs.pp | 14 ++++++++++++++ manifests/backend/hp3par_iscsi.pp | 14 ++++++++++++++ manifests/backend/hpe3par_iscsi.pp | 14 ++++++++++++++ manifests/backend/iscsi.pp | 14 ++++++++++++++ manifests/backend/netapp.pp | 14 ++++++++++++++ manifests/backend/nexenta.pp | 14 ++++++++++++++ manifests/backend/nfs.pp | 14 ++++++++++++++ manifests/backend/pure.pp | 14 ++++++++++++++ manifests/backend/quobyte.pp | 14 ++++++++++++++ manifests/backend/rbd.pp | 14 ++++++++++++++ manifests/backend/san.pp | 14 ++++++++++++++ manifests/backend/solidfire.pp | 14 ++++++++++++++ manifests/backend/vmdk.pp | 14 ++++++++++++++ .../notes/volume_type-125be2a2e5b466aa.yaml | 5 +++++ spec/defines/cinder_backend_bdd_spec.rb | 16 ++++++++++------ spec/defines/cinder_backend_dellsc_iscsi_spec.rb | 9 +++++++++ spec/defines/cinder_backend_emc_vnx_spec.rb | 5 +++++ spec/defines/cinder_backend_eqlx_spec.rb | 9 +++++++++ spec/defines/cinder_backend_glusterfs_spec.rb | 9 +++++++++ spec/defines/cinder_backend_gpfs_spec.rb | 9 +++++++++ spec/defines/cinder_backend_hp3par_iscsi_spec.rb | 9 +++++++++ .../defines/cinder_backend_hpe3par_iscsi_spec.rb | 9 +++++++++ spec/defines/cinder_backend_iscsi_spec.rb | 9 +++++++++ spec/defines/cinder_backend_netapp_spec.rb | 9 +++++++++ spec/defines/cinder_backend_nexenta_spec.rb | 9 +++++++++ spec/defines/cinder_backend_nfs_spec.rb | 9 +++++++++ spec/defines/cinder_backend_pure_spec.rb | 9 +++++++++ spec/defines/cinder_backend_quobyte_spec.rb | 8 ++++++++ spec/defines/cinder_backend_rbd_spec.rb | 9 +++++++++ spec/defines/cinder_backend_san_spec.rb | 9 +++++++++ spec/defines/cinder_backend_solidfire_spec.rb | 12 ++++++++++++ spec/defines/cinder_backend_vmdk_spec.rb | 9 +++++++++ 37 files changed, 418 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/volume_type-125be2a2e5b466aa.yaml diff --git a/manifests/backend/bdd.pp b/manifests/backend/bdd.pp index 88326919..b2c97900 100644 --- a/manifests/backend/bdd.pp +++ b/manifests/backend/bdd.pp @@ -40,6 +40,12 @@ # (Optional) Method used to wipe old volumes # 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*] # (optional) Hash of extra options to pass to the backend # Defaults to: {} @@ -67,6 +73,7 @@ define cinder::backend::bdd ( $iscsi_helper = 'tgtadm', $iscsi_protocol = $::os_service_default, $volume_clear = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -84,6 +91,13 @@ define cinder::backend::bdd ( "${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) case $iscsi_helper { diff --git a/manifests/backend/dellsc_iscsi.pp b/manifests/backend/dellsc_iscsi.pp index 9c7d3f27..f860d52c 100644 --- a/manifests/backend/dellsc_iscsi.pp +++ b/manifests/backend/dellsc_iscsi.pp @@ -49,6 +49,12 @@ # Example: # { '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 ( $san_ip, $san_login, @@ -61,6 +67,7 @@ define cinder::backend::dellsc_iscsi ( $dell_sc_verify_cert = $::os_service_default, $dell_sc_volume_folder = 'vol', $iscsi_port = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -88,6 +95,13 @@ define cinder::backend::dellsc_iscsi ( "${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) } diff --git a/manifests/backend/emc_vnx.pp b/manifests/backend/emc_vnx.pp index f7393c9e..af8557ed 100644 --- a/manifests/backend/emc_vnx.pp +++ b/manifests/backend/emc_vnx.pp @@ -66,6 +66,12 @@ # (optional) Naviseccli Path. # 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 ( $iscsi_ip_address, $san_ip, @@ -82,6 +88,7 @@ define cinder::backend::emc_vnx ( $storage_vnx_auth_type = $::os_service_default, $storage_vnx_security_file_dir = $::os_service_default, $naviseccli_path = $::os_service_default, + $manage_volume_type = false, ) { include ::cinder::params @@ -102,6 +109,13 @@ define cinder::backend::emc_vnx ( "${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) } diff --git a/manifests/backend/eqlx.pp b/manifests/backend/eqlx.pp index 36649183..44593713 100644 --- a/manifests/backend/eqlx.pp +++ b/manifests/backend/eqlx.pp @@ -55,6 +55,12 @@ # (optional) The timeout for the Group Manager cli command execution. # 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 # # [*eqlx_use_chap*] @@ -88,6 +94,7 @@ define cinder::backend::eqlx ( $chap_password = $::os_service_default, $use_chap_auth = $::os_service_default, $ssh_conn_timeout = $::os_service_default, + $manage_volume_type = false, # Deprecated $eqlx_use_chap = undef, $eqlx_chap_login = undef, @@ -145,6 +152,13 @@ define cinder::backend::eqlx ( "${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 if !is_service_default($use_chap_auth_real) and $use_chap_auth_real == true { cinder_config { diff --git a/manifests/backend/glusterfs.pp b/manifests/backend/glusterfs.pp index f03081ee..c28fec13 100644 --- a/manifests/backend/glusterfs.pp +++ b/manifests/backend/glusterfs.pp @@ -41,6 +41,12 @@ # Example : # { '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 # # cinder::backend::glusterfs { 'myGluster': @@ -55,6 +61,7 @@ define cinder::backend::glusterfs ( $glusterfs_sparsed_volumes = $::os_service_default, $glusterfs_mount_point_base = $::os_service_default, $glusterfs_shares_config = '/etc/cinder/shares.conf', + $manage_volume_type = false, $extra_options = {}, ) { @@ -77,6 +84,13 @@ define cinder::backend::glusterfs ( "${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) } diff --git a/manifests/backend/gpfs.pp b/manifests/backend/gpfs.pp index 08efd910..72303971 100644 --- a/manifests/backend/gpfs.pp +++ b/manifests/backend/gpfs.pp @@ -64,6 +64,12 @@ # (optional) SSH port to use to connect to NAS system. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -90,6 +96,7 @@ define cinder::backend::gpfs ( $nas_password = $::os_service_default, $nas_private_key = $::os_service_default, $nas_ssh_port = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -116,6 +123,13 @@ define cinder::backend::gpfs ( "${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) } diff --git a/manifests/backend/hp3par_iscsi.pp b/manifests/backend/hp3par_iscsi.pp index 678c8a50..a7f66b29 100644 --- a/manifests/backend/hp3par_iscsi.pp +++ b/manifests/backend/hp3par_iscsi.pp @@ -53,6 +53,12 @@ # than hp3par_snapshot_retention. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -73,6 +79,7 @@ define cinder::backend::hp3par_iscsi( $hp3par_snap_cpg = 'OpenstackCPG', $hp3par_snapshot_retention = 48, $hp3par_snapshot_expiration = 72, + $manage_volume_type = false, $extra_options = {}, ) { @@ -98,6 +105,13 @@ define cinder::backend::hp3par_iscsi( "${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) } diff --git a/manifests/backend/hpe3par_iscsi.pp b/manifests/backend/hpe3par_iscsi.pp index 3895278b..08bda0b5 100644 --- a/manifests/backend/hpe3par_iscsi.pp +++ b/manifests/backend/hpe3par_iscsi.pp @@ -54,6 +54,12 @@ # than hpe3par_snapshot_retention. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -74,6 +80,7 @@ define cinder::backend::hpe3par_iscsi( $hpe3par_cpg_snap = 'userCPG', $hpe3par_snapshot_retention = 48, $hpe3par_snapshot_expiration = 72, + $manage_volume_type = false, $extra_options = {}, ) { @@ -97,6 +104,13 @@ define cinder::backend::hpe3par_iscsi( "${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) } diff --git a/manifests/backend/iscsi.pp b/manifests/backend/iscsi.pp index b5846b40..1ab4261d 100644 --- a/manifests/backend/iscsi.pp +++ b/manifests/backend/iscsi.pp @@ -30,6 +30,12 @@ # (Optional) Protocol to use as iSCSI driver # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -44,6 +50,7 @@ define cinder::backend::iscsi ( $volumes_dir = '/var/lib/cinder/volumes', $iscsi_helper = $::cinder::params::iscsi_helper, $iscsi_protocol = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -59,6 +66,13 @@ define cinder::backend::iscsi ( "${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) case $iscsi_helper { diff --git a/manifests/backend/netapp.pp b/manifests/backend/netapp.pp index a3039dcc..b6bb23e9 100644 --- a/manifests/backend/netapp.pp +++ b/manifests/backend/netapp.pp @@ -152,6 +152,12 @@ # application. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -211,6 +217,7 @@ define cinder::backend::netapp ( $netapp_storage_pools = undef, $netapp_host_type = $::os_service_default, $netapp_webservice_path = '/devmgr/v2', + $manage_volume_type = false, $extra_options = {}, # DEPRECATED PARAMETERS $netapp_eseries_host_type = undef, @@ -260,6 +267,13 @@ define cinder::backend::netapp ( "${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' { cinder_config { "${name}/use_multipath_for_image_xfer": value => true; diff --git a/manifests/backend/nexenta.pp b/manifests/backend/nexenta.pp index 0b322761..ec866e42 100644 --- a/manifests/backend/nexenta.pp +++ b/manifests/backend/nexenta.pp @@ -32,6 +32,12 @@ # [*nexenta_sparse*] # (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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -48,6 +54,7 @@ define cinder::backend::nexenta ( $nexenta_target_group_prefix = 'cinder/', $nexenta_blocksize = '8k', $nexenta_sparse = true, + $manage_volume_type = false, $extra_options = {}, ) { @@ -64,6 +71,13 @@ define cinder::backend::nexenta ( "${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) } diff --git a/manifests/backend/nfs.pp b/manifests/backend/nfs.pp index 3921fde6..4cf96939 100644 --- a/manifests/backend/nfs.pp +++ b/manifests/backend/nfs.pp @@ -49,6 +49,12 @@ # longer be valid. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -66,6 +72,7 @@ define cinder::backend::nfs ( $nfs_shares_config = '/etc/cinder/shares.conf', $nfs_used_ratio = $::os_service_default, $nfs_oversub_ratio = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -89,6 +96,13 @@ define cinder::backend::nfs ( "${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) } diff --git a/manifests/backend/pure.pp b/manifests/backend/pure.pp index 7ecc6b2a..d74dc11c 100644 --- a/manifests/backend/pure.pp +++ b/manifests/backend/pure.pp @@ -28,6 +28,12 @@ # (optional) Only affects the PureISCSIDriver. # 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*] # (optional) Hash of extra options to pass to the backend stanza. # Defaults to: {} @@ -41,6 +47,7 @@ define cinder::backend::pure( $pure_storage_protocol = 'iSCSI', $use_chap_auth = false, $use_multipath_for_image_xfer = true, + $manage_volume_type = false, $extra_options = {}, ) { @@ -58,5 +65,12 @@ define cinder::backend::pure( "${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) } diff --git a/manifests/backend/quobyte.pp b/manifests/backend/quobyte.pp index 234c5334..683e2736 100644 --- a/manifests/backend/quobyte.pp +++ b/manifests/backend/quobyte.pp @@ -34,6 +34,12 @@ # (optional) Allows for the volume_backend_name to be separate of $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 # # cinder::backend::quobyte { 'quobyte1': @@ -47,6 +53,7 @@ define cinder::backend::quobyte ( $quobyte_sparsed_volumes = undef, $quobyte_mount_point_base = undef, $volume_backend_name = $name, + $manage_volume_type = false, ) { cinder_config { @@ -60,4 +67,11 @@ define cinder::backend::quobyte ( "${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}"], + } + } + } diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index bd51bfe6..93ef9011 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -57,6 +57,12 @@ # (optional) Volumes will be chunked into objects of this size (in megabytes). # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -83,6 +89,7 @@ define cinder::backend::rbd ( $rados_connection_interval = $::os_service_default, $rados_connection_retries = $::os_service_default, $rbd_store_chunk_size = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, # DEPRECATED PARAMETERS $volume_tmp_dir = false, @@ -105,6 +112,13 @@ define cinder::backend::rbd ( "${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 { cinder_config { "${name}/backend_host": value => $backend_host; diff --git a/manifests/backend/san.pp b/manifests/backend/san.pp index 1e46a0b3..edd209b7 100644 --- a/manifests/backend/san.pp +++ b/manifests/backend/san.pp @@ -50,6 +50,12 @@ # (Optional) Maximum ssh connections in the pool. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -70,6 +76,7 @@ define cinder::backend::san ( $ssh_conn_timeout = 30, $ssh_min_pool_conn = 1, $ssh_max_pool_conn = 5, + $manage_volume_type = false, $extra_options = {}, ) { @@ -89,6 +96,13 @@ define cinder::backend::san ( "${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) } diff --git a/manifests/backend/solidfire.pp b/manifests/backend/solidfire.pp index 821d7f91..036cbc02 100644 --- a/manifests/backend/solidfire.pp +++ b/manifests/backend/solidfire.pp @@ -70,6 +70,12 @@ # (optional) Utilize volume access groups on a per-tenant basis. # 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -92,6 +98,7 @@ define cinder::backend::solidfire( $sf_svip = $::os_service_default, $sf_enable_volume_mapping = $::os_service_default, $sf_enable_vag = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -113,6 +120,13 @@ define cinder::backend::solidfire( "${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) } diff --git a/manifests/backend/vmdk.pp b/manifests/backend/vmdk.pp index d0fef7b4..a4633061 100644 --- a/manifests/backend/vmdk.pp +++ b/manifests/backend/vmdk.pp @@ -49,6 +49,12 @@ # (optional) The name for the folder in the VC datacenter that will contain 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*] # (optional) Hash of extra options to pass to the backend stanza # Defaults to: {} @@ -66,6 +72,7 @@ define cinder::backend::vmdk ( $task_poll_interval = 5, $image_transfer_timeout_secs = $::os_service_default, $wsdl_location = $::os_service_default, + $manage_volume_type = false, $extra_options = {}, ) { @@ -92,6 +99,13 @@ define cinder::backend::vmdk ( "${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': ensure => present } diff --git a/releasenotes/notes/volume_type-125be2a2e5b466aa.yaml b/releasenotes/notes/volume_type-125be2a2e5b466aa.yaml new file mode 100644 index 00000000..393be985 --- /dev/null +++ b/releasenotes/notes/volume_type-125be2a2e5b466aa.yaml @@ -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. diff --git a/spec/defines/cinder_backend_bdd_spec.rb b/spec/defines/cinder_backend_bdd_spec.rb index 65b183a8..4acf33fc 100644 --- a/spec/defines/cinder_backend_bdd_spec.rb +++ b/spec/defines/cinder_backend_bdd_spec.rb @@ -28,12 +28,13 @@ describe 'cinder::backend::bdd' do context 'with optional parameters' do before :each do params.merge!({ - :iscsi_ip_address => '10.20.0.2', - :available_devices => '/dev/sdb,/dev/sdc', - :volumes_dir => '/var/lib/cinder/bdd-volumes', - :volume_clear => 'zero', - :volume_group => 'cinder', - :iscsi_helper => 'lioadm', + :iscsi_ip_address => '10.20.0.2', + :available_devices => '/dev/sdb,/dev/sdc', + :volumes_dir => '/var/lib/cinder/bdd-volumes', + :volume_clear => 'zero', + :volume_group => 'cinder', + :iscsi_helper => 'lioadm', + :manage_volume_type => true, }) 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_clear').with_value('zero') end + it 'should create type with properties' do + should contain_cinder_type('hippo').with(:ensure => :present, :properties => ['volume_backend_name=hippo']) + end end context 'block device backend with additional configuration' do diff --git a/spec/defines/cinder_backend_dellsc_iscsi_spec.rb b/spec/defines/cinder_backend_dellsc_iscsi_spec.rb index 1ab3f4dd..fc10d952 100644 --- a/spec/defines/cinder_backend_dellsc_iscsi_spec.rb +++ b/spec/defines/cinder_backend_dellsc_iscsi_spec.rb @@ -60,4 +60,13 @@ describe 'cinder::backend::dellsc_iscsi' do 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 diff --git a/spec/defines/cinder_backend_emc_vnx_spec.rb b/spec/defines/cinder_backend_emc_vnx_spec.rb index 85c94dc9..9474073b 100644 --- a/spec/defines/cinder_backend_emc_vnx_spec.rb +++ b/spec/defines/cinder_backend_emc_vnx_spec.rb @@ -44,6 +44,7 @@ describe 'cinder::backend::emc_vnx' do :storage_vnx_auth_type => 'global', :storage_vnx_security_file_dir => '/etc/secfile/array1', :naviseccli_path => '/opt/Navisphere/bin/naviseccli', + :manage_volume_type => true, }) 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/naviseccli_path').with_value(params[:naviseccli_path]) end + + it 'should create type with properties' do + should contain_cinder_type('emc').with(:ensure => :present, :properties => ['volume_backend_name=emc']) + end end describe 'emc vnx backend with additional configuration' do diff --git a/spec/defines/cinder_backend_eqlx_spec.rb b/spec/defines/cinder_backend_eqlx_spec.rb index 91dfb573..9e34f5cc 100644 --- a/spec/defines/cinder_backend_eqlx_spec.rb +++ b/spec/defines/cinder_backend_eqlx_spec.rb @@ -47,6 +47,15 @@ describe 'cinder::backend::eqlx' do 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 before :each do params.merge!({ diff --git a/spec/defines/cinder_backend_glusterfs_spec.rb b/spec/defines/cinder_backend_glusterfs_spec.rb index 2475cdbb..9d11fa61 100644 --- a/spec/defines/cinder_backend_glusterfs_spec.rb +++ b/spec/defines/cinder_backend_glusterfs_spec.rb @@ -50,6 +50,15 @@ describe 'cinder::backend::glusterfs' do 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 on_supported_os({ diff --git a/spec/defines/cinder_backend_gpfs_spec.rb b/spec/defines/cinder_backend_gpfs_spec.rb index 6d43f8ce..62286745 100644 --- a/spec/defines/cinder_backend_gpfs_spec.rb +++ b/spec/defines/cinder_backend_gpfs_spec.rb @@ -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`/ 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 before do params.merge!({:extra_options => {'gpfs/param1' => { 'value' => 'value1' }}}) diff --git a/spec/defines/cinder_backend_hp3par_iscsi_spec.rb b/spec/defines/cinder_backend_hp3par_iscsi_spec.rb index 298b1547..48ed709c 100644 --- a/spec/defines/cinder_backend_hp3par_iscsi_spec.rb +++ b/spec/defines/cinder_backend_hp3par_iscsi_spec.rb @@ -44,4 +44,13 @@ describe 'cinder::backend::hp3par_iscsi' do 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 diff --git a/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb b/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb index 0b87065b..53a0197c 100644 --- a/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb +++ b/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb @@ -44,4 +44,13 @@ describe 'cinder::backend::hpe3par_iscsi' do 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 diff --git a/spec/defines/cinder_backend_iscsi_spec.rb b/spec/defines/cinder_backend_iscsi_spec.rb index 7337248b..68fc6e56 100644 --- a/spec/defines/cinder_backend_iscsi_spec.rb +++ b/spec/defines/cinder_backend_iscsi_spec.rb @@ -69,6 +69,15 @@ describe 'cinder::backend::iscsi' do 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 before :each do params.merge!({:extra_options => {'hippo/param1' => {'value' => 'value1'}}}) diff --git a/spec/defines/cinder_backend_netapp_spec.rb b/spec/defines/cinder_backend_netapp_spec.rb index 242f14cd..3a49e9ce 100644 --- a/spec/defines/cinder_backend_netapp_spec.rb +++ b/spec/defines/cinder_backend_netapp_spec.rb @@ -99,6 +99,15 @@ describe 'cinder::backend::netapp' do 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 before do params.merge!({:extra_options => {'netapp/param1' => { 'value' => 'value1' }}}) diff --git a/spec/defines/cinder_backend_nexenta_spec.rb b/spec/defines/cinder_backend_nexenta_spec.rb index 52acc4ff..54a4fd05 100644 --- a/spec/defines/cinder_backend_nexenta_spec.rb +++ b/spec/defines/cinder_backend_nexenta_spec.rb @@ -49,4 +49,13 @@ describe 'cinder::backend::nexenta' do 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 diff --git a/spec/defines/cinder_backend_nfs_spec.rb b/spec/defines/cinder_backend_nfs_spec.rb index 61f8da20..94749b7d 100644 --- a/spec/defines/cinder_backend_nfs_spec.rb +++ b/spec/defines/cinder_backend_nfs_spec.rb @@ -61,4 +61,13 @@ describe 'cinder::backend::nfs' do 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 diff --git a/spec/defines/cinder_backend_pure_spec.rb b/spec/defines/cinder_backend_pure_spec.rb index 3a8ae9a2..c182e4e1 100644 --- a/spec/defines/cinder_backend_pure_spec.rb +++ b/spec/defines/cinder_backend_pure_spec.rb @@ -67,4 +67,13 @@ describe 'cinder::backend::pure' do 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 diff --git a/spec/defines/cinder_backend_quobyte_spec.rb b/spec/defines/cinder_backend_quobyte_spec.rb index 7473cf95..4a6879c5 100644 --- a/spec/defines/cinder_backend_quobyte_spec.rb +++ b/spec/defines/cinder_backend_quobyte_spec.rb @@ -24,6 +24,14 @@ describe 'cinder::backend::quobyte' do true) 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 on_supported_os({ diff --git a/spec/defines/cinder_backend_rbd_spec.rb b/spec/defines/cinder_backend_rbd_spec.rb index f52b7a32..23cd19d2 100644 --- a/spec/defines/cinder_backend_rbd_spec.rb +++ b/spec/defines/cinder_backend_rbd_spec.rb @@ -97,6 +97,15 @@ describe 'cinder::backend::rbd' do 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 describe 'with RedHat' do diff --git a/spec/defines/cinder_backend_san_spec.rb b/spec/defines/cinder_backend_san_spec.rb index c0647e86..3e5208ba 100644 --- a/spec/defines/cinder_backend_san_spec.rb +++ b/spec/defines/cinder_backend_san_spec.rb @@ -50,4 +50,13 @@ describe 'cinder::backend::san' do 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 diff --git a/spec/defines/cinder_backend_solidfire_spec.rb b/spec/defines/cinder_backend_solidfire_spec.rb index 564c1b96..c3afd626 100644 --- a/spec/defines/cinder_backend_solidfire_spec.rb +++ b/spec/defines/cinder_backend_solidfire_spec.rb @@ -94,6 +94,18 @@ describe 'cinder::backend::solidfire' do 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 before do params = {} diff --git a/spec/defines/cinder_backend_vmdk_spec.rb b/spec/defines/cinder_backend_vmdk_spec.rb index 90cb0f7c..4f3d2b61 100644 --- a/spec/defines/cinder_backend_vmdk_spec.rb +++ b/spec/defines/cinder_backend_vmdk_spec.rb @@ -77,4 +77,13 @@ describe 'cinder::backend::vmdk' do 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