Adopt to latest Puppet OpenStack modules

* puppet-cinder
 * properties property of cinder_type now requires a Hash
 * support for VMWare backend has been removed
* puppet-glance
 * properties property of glance_image now requires a Hash

Change-Id: I028178976b96199cd773022f5b8fec70cf223bde
This commit is contained in:
Takashi Kajinami 2024-10-09 22:29:25 +09:00
parent 2dfe0d2463
commit d816f6501f
10 changed files with 22 additions and 27 deletions

View File

@ -85,8 +85,7 @@ def initConfig(controller):
{"CMD_OPTION": "cinder-backend",
"PROMPT": "Enter the Cinder backend to be configured",
"OPTION_LIST": ["lvm", "nfs", "vmdk", "netapp",
"solidfire"],
"OPTION_LIST": ["lvm", "nfs", "netapp", "solidfire"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "lvm",
"MASK_INPUT": False,

View File

@ -0,0 +1,12 @@
Puppet::Functions.create_function(:parse_hash_from_string) do
def parse_hash_from_string(*args)
if args.length > 1
raise Puppet::Error, 'Argument must be one'
elsif !(args[0].kind_of?(String))
raise Puppet::Error, 'Argument must be a string'
end
value = args[0]
return Hash[value.scan(/(\S+)='([^']*)'/)]
end
end

View File

@ -8,7 +8,6 @@ class packstack::cinder ()
case $cinder_backends[0] {
'lvm': { $default_volume_type = 'iscsi' }
'nfs': { $default_volume_type = 'nfs' }
'vmdk': { $default_volume_type = 'vmdk' }
'netapp': { $default_volume_type = 'netapp' }
'solidfire': { $default_volume_type = 'solidfire' }
default: { $default_volume_type = 'iscsi' }

View File

@ -74,7 +74,7 @@ RequiredBy=openstack-cinder-volume.service",
cinder_type { 'iscsi':
ensure => present,
properties => ['volume_backend_name=lvm'],
properties => {'volume_backend_name' => 'lvm'},
require => Class['cinder::api'],
}
}

View File

@ -127,7 +127,7 @@ class packstack::cinder::backend::netapp ()
cinder_type { $netapp_backend_name:
ensure => present,
properties => ["volume_backend_name=${netapp_backend_name}"],
properties => {'volume_backend_name' => $netapp_backend_name},
require => Class['cinder::api'],
}
}

View File

@ -11,7 +11,7 @@ class packstack::cinder::backend::nfs ()
cinder_type { 'nfs':
ensure => present,
properties => ['volume_backend_name=nfs'],
properties => {'volume_backend_name' => 'nfs'},
require => Class['cinder::api'],
}
}

View File

@ -14,7 +14,7 @@ class packstack::cinder::backend::solidfire ()
cinder_type { $solidfire_backend_name:
ensure => present,
properties => ["volume_backend_name=${solidfire_backend_name}"],
properties => {'volume_backend_name' => $solidfire_backend_name },
require => Class['cinder::api'],
}
}

View File

@ -1,14 +0,0 @@
class packstack::cinder::backend::vmdk ()
{
cinder::backend::vmdk { 'vmdk':
host_ip => lookup('CONFIG_VCENTER_HOST'),
host_username => lookup('CONFIG_VCENTER_USER'),
host_password => lookup('CONFIG_VCENTER_PASSWORD'),
}
cinder_type { 'vmdk':
ensure => present,
properties => ['volume_backend_name=vmdk'],
require => Class['cinder::api'],
}
}

View File

@ -1,9 +1,9 @@
class packstack::provision::glance ()
{
$image_name = lookup('CONFIG_PROVISION_IMAGE_NAME')
$image_source = lookup('CONFIG_PROVISION_IMAGE_URL')
$image_format = lookup('CONFIG_PROVISION_IMAGE_FORMAT')
$image_properties = lookup('CONFIG_PROVISION_IMAGE_PROPERTIES')
$image_name = lookup('CONFIG_PROVISION_IMAGE_NAME')
$image_source = lookup('CONFIG_PROVISION_IMAGE_URL')
$image_format = lookup('CONFIG_PROVISION_IMAGE_FORMAT')
$image_properties = lookup('CONFIG_PROVISION_IMAGE_PROPERTIES')
glance_image { $image_name:
ensure => present,
@ -11,6 +11,6 @@ class packstack::provision::glance ()
container_format => 'bare',
disk_format => $image_format,
source => $image_source,
properties => $image_properties
properties => parse_hash_from_string($image_properties)
}
}

View File

@ -52,7 +52,6 @@ if lookup('CONFIG_CINDER_INSTALL') == 'y' {
case $cinder_backends[0] {
'lvm': { include 'packstack::cinder::backend::lvm' }
'nfs': { include 'packstack::cinder::backend::nfs' }
'vmdk': { include 'packstack::cinder::backend::vmdk' }
'netapp': { include 'packstack::cinder::backend::netapp' }
'solidfire': { include 'packstack::cinder::backend::solidfire' }
default: { include 'packstack::cinder::backend::lvm' }