Fix for the case with ceph and cinder-vmware
- For base configuration we use cinder.pp,
but ceph for volume uses
"::openstack_tasks::openstack_cinder::openstack_cinder" and
configure volume only on controllers node. This patch fixes
error in case with ceph with volume and assign cinder-vmware
on controllers node.
- Describe parameters
- Fix typos
- Update noop tests
- Update spec
Change-Id: I1746dcd93f86ff4e1308d917d4a07dab7a5f1075
Closes-Bug: #1582113
(cherry picked from commit c33e619124
)
This commit is contained in:
parent
c7f2e767f9
commit
19b518018f
|
@ -1,49 +1,139 @@
|
||||||
# Copyright 2015 Mirantis, Inc.
|
# Copyright 2015 Mirantis, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
# == Class: vmware::cinder::vmdk
|
||||||
|
#
|
||||||
|
# This type creates cinder-volume service with VMDK backend,
|
||||||
|
# which provides block storage solution for
|
||||||
|
# vSphere's virtual machine instances.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*vc_host*]
|
||||||
|
# (required) IP address for connecting to VMware vCenter server.
|
||||||
|
# Defaults to '1.2.3.4'.
|
||||||
|
#
|
||||||
|
# [*vc_user*]
|
||||||
|
# (required) Username for authenticating with VMware vCenter server.
|
||||||
|
# Defaults to 'user'.
|
||||||
|
#
|
||||||
|
# [*vc_password*]
|
||||||
|
# (required) Password for authenticating with VMware vCenter server.
|
||||||
|
# Defaults to 'password'.
|
||||||
|
#
|
||||||
|
# [*availability_zone_name*]
|
||||||
|
# (required) Availability zone of this node and value is used as
|
||||||
|
# the default for new volumes.
|
||||||
|
# Defaults to 'non-nova'.
|
||||||
|
#
|
||||||
|
# [*vc_volume_folder*]
|
||||||
|
# (optional) Name of the vCenter inventory folder that will contain
|
||||||
|
# Cinder volumes. This folder will be created under
|
||||||
|
# "OpenStack/<project_folder>", where project_folder is of format
|
||||||
|
# "Project (<volume_project_id>)".
|
||||||
|
# Defaults to 'cinder-volumes'.
|
||||||
|
#
|
||||||
|
# [*vc_wsdl_location*]
|
||||||
|
# (optional) Optional VIM service WSDL Location e.g
|
||||||
|
# http://<server>/vimService.wsdl. Optional over-ride to default
|
||||||
|
# location for bug work-arounds.
|
||||||
|
# Defaults to empty.
|
||||||
|
#
|
||||||
|
# [*vc_api_retry_count*]
|
||||||
|
# (optional) Number of times VMware vCenter server API must be
|
||||||
|
# retried upon connection related issues.
|
||||||
|
# Defaults to '10'.
|
||||||
|
#
|
||||||
|
# [*vc_host_version*]
|
||||||
|
# (optional) Optional string specifying the VMware vCenter
|
||||||
|
# server version. The driver attempts to retrieve the version from
|
||||||
|
# VMware vCenter server. Set this configuration only if you want
|
||||||
|
# to override the vCenter server version.
|
||||||
|
# Defaults to empty.
|
||||||
|
#
|
||||||
|
# [*vc_image_transfer_timeout_secs*]
|
||||||
|
# (optional) Timeout in seconds for VMDK volume transfer
|
||||||
|
# between Cinder and Glance.
|
||||||
|
# Defaults to '7200'.
|
||||||
|
#
|
||||||
|
# [*vc_max_objects_retrieval*]
|
||||||
|
# (optional) Max number of objects to be retrieved per batch.
|
||||||
|
# Query results will be obtained in batches from the server
|
||||||
|
# and not in one shot. Server may still limit the count to
|
||||||
|
# something less than the configured value.
|
||||||
|
# Defaults to '100'.
|
||||||
|
#
|
||||||
|
# [*vc_task_poll_interval*]
|
||||||
|
# (optional) The interval (in seconds) for polling remote
|
||||||
|
# tasks invoked on VMware vCenter server.
|
||||||
|
# Defaults to '5'.
|
||||||
|
#
|
||||||
|
# [*vc_tmp_dir*]
|
||||||
|
# (optional) Directory where virtual disks are stored during
|
||||||
|
# volume backup and restore.
|
||||||
|
# Defaults to '/tmp'.
|
||||||
|
#
|
||||||
|
# [*cinder_conf_dir*]
|
||||||
|
# (optional) The base directory used for cinder-vmware configs.
|
||||||
|
# Defaults to '/etc/cinder/cinder.d'.
|
||||||
|
#
|
||||||
|
# [*cinder_log_dir*]
|
||||||
|
# (optional) The base directory used for relative --log-file paths.
|
||||||
|
# Defaults to '/var/log/cinder'.
|
||||||
|
#
|
||||||
|
# [*debug*]
|
||||||
|
# (optional) Print debugging output (set logging level to DEBUG instead
|
||||||
|
# of default WARNING level).
|
||||||
|
# Defaults to false.
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
# This type creates cinder-volume service with VMDK backend, which provides
|
|
||||||
# block storage solution for vSphere's virtual machine instances.
|
|
||||||
|
|
||||||
define vmware::cinder::vmdk(
|
define vmware::cinder::vmdk(
|
||||||
$vc_host = '1.2.3.4',
|
$vc_host = '1.2.3.4',
|
||||||
$vc_user = 'administrator@vsphere.local',
|
$vc_user = 'user',
|
||||||
$vc_password = '',
|
$vc_password = 'password',
|
||||||
$availability_zone_name = 'non-nova',
|
$availability_zone_name = 'non-nova',
|
||||||
$vc_volume_folder = 'cinder-volumes',
|
$vc_volume_folder = 'cinder-volumes',
|
||||||
$vc_wsdl_location = '',
|
$vc_wsdl_location = '',
|
||||||
$vc_api_retry_count = 10,
|
$vc_api_retry_count = '10',
|
||||||
$vc_host_version = '',
|
$vc_host_version = '',
|
||||||
$vc_image_transfer_timeout_secs = 7200,
|
$vc_image_transfer_timeout_secs = '7200',
|
||||||
$vc_max_objects_retrieval = 100,
|
$vc_max_objects_retrieval = '100',
|
||||||
$vc_task_poll_interval = 5,
|
$vc_task_poll_interval = '5',
|
||||||
$vc_tmp_dir = '/tmp',
|
$vc_tmp_dir = '/tmp',
|
||||||
$cinder_conf_dir = '/etc/cinder/cinder.d',
|
$cinder_conf_dir = '/etc/cinder/cinder.d',
|
||||||
$cinder_log_dir = '/var/log/cinder',
|
$cinder_log_dir = '/var/log/cinder',
|
||||||
$debug = false,
|
$debug = false,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
include cinder::params
|
|
||||||
$index = $availability_zone_name
|
include ::cinder::params
|
||||||
|
$index = $availability_zone_name
|
||||||
$cinder_volume_conf = "${cinder_conf_dir}/vmware-${index}.conf"
|
$cinder_volume_conf = "${cinder_conf_dir}/vmware-${index}.conf"
|
||||||
$cinder_volume_vmware = "${::cinder::params::volume_service}-vmware"
|
$cinder_volume_vmware = "${::cinder::params::volume_service}-vmware"
|
||||||
|
$storage_hash = hiera_hash('storage', {})
|
||||||
|
|
||||||
|
if ($storage_hash['volumes_ceph']) and
|
||||||
|
(roles_include(['primary-controller']) or
|
||||||
|
roles_include(['controller'])) {
|
||||||
|
class { '::openstack_tasks::openstack_cinder::openstack_cinder': }
|
||||||
|
}
|
||||||
|
|
||||||
if ! defined(File[$cinder_conf_dir]) {
|
if ! defined(File[$cinder_conf_dir]) {
|
||||||
file { $cinder_conf_dir:
|
file { $cinder_conf_dir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'cinder',
|
owner => 'cinder',
|
||||||
group => 'cinder',
|
group => 'cinder',
|
||||||
mode => '0750'
|
mode => '0750',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +149,11 @@ define vmware::cinder::vmdk(
|
||||||
|
|
||||||
File[$cinder_conf_dir]->File[$cinder_volume_conf]
|
File[$cinder_conf_dir]->File[$cinder_volume_conf]
|
||||||
|
|
||||||
if ! defined(Service["cinder_volume_vmware"]) {
|
if ! defined(Service['cinder_volume_vmware']) {
|
||||||
service { "cinder_volume_vmware":
|
service { 'cinder_volume_vmware':
|
||||||
enable => false,
|
|
||||||
ensure => stopped,
|
ensure => stopped,
|
||||||
name => "${cinder_volume_vmware}",
|
enable => false,
|
||||||
|
name => $cinder_volume_vmware,
|
||||||
hasstatus => true,
|
hasstatus => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,21 +162,21 @@ define vmware::cinder::vmdk(
|
||||||
service { "cinder_volume_vmware_${index}":
|
service { "cinder_volume_vmware_${index}":
|
||||||
ensure => running,
|
ensure => running,
|
||||||
name => "${cinder_volume_vmware}-${index}",
|
name => "${cinder_volume_vmware}-${index}",
|
||||||
enable => true
|
enable => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
$src_init = $cinder_volume_vmware
|
$src_init = $cinder_volume_vmware
|
||||||
$dst_init = '/etc/init.d'
|
$dst_init = '/etc/init.d'
|
||||||
$file_perm = '0755'
|
$file_perm = '0755'
|
||||||
$cinder_volume_vmware_init = "${dst_init}/${cinder_volume_vmware}"
|
$cinder_volume_vmware_init = "${dst_init}/${cinder_volume_vmware}"
|
||||||
$init_link = "${cinder_volume_vmware_init}-${index}"
|
$init_link = "${cinder_volume_vmware_init}-${index}"
|
||||||
if ! defined(File[$init_link]) {
|
if ! defined(File[$init_link]) {
|
||||||
file { $init_link:
|
file { $init_link:
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => $cinder_volume_vmware_init
|
target => $cinder_volume_vmware_init,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,13 +189,13 @@ define vmware::cinder::vmdk(
|
||||||
}
|
}
|
||||||
File[$cinder_volume_default]~>
|
File[$cinder_volume_default]~>
|
||||||
Service["cinder_volume_vmware_${index}"]->
|
Service["cinder_volume_vmware_${index}"]->
|
||||||
Service["cinder_volume_vmware"]
|
Service['cinder_volume_vmware']
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$cinder_volume_default = "/etc/default/${cinder_volume_vmware}-${index}"
|
$cinder_volume_default = "/etc/default/${cinder_volume_vmware}-${index}"
|
||||||
$src_init = "${cinder_volume_vmware}.conf"
|
$src_init = "${cinder_volume_vmware}.conf"
|
||||||
$dst_init = '/etc/init'
|
$dst_init = '/etc/init'
|
||||||
$file_perm = '0644'
|
$file_perm = '0644'
|
||||||
|
|
||||||
ensure_packages($::cinder::params::volume_package)
|
ensure_packages($::cinder::params::volume_package)
|
||||||
Package[$::cinder::params::volume_package] -> File[$src_init]
|
Package[$::cinder::params::volume_package] -> File[$src_init]
|
||||||
|
@ -122,23 +212,23 @@ define vmware::cinder::vmdk(
|
||||||
if ! defined(File[$init_link]) {
|
if ! defined(File[$init_link]) {
|
||||||
file { $init_link:
|
file { $init_link:
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => $cinder_volume_vmware_init
|
target => $cinder_volume_vmware_init,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$init_reload_cmd = '/sbin/initctl reload-configuration'
|
$init_reload_cmd = '/sbin/initctl reload-configuration'
|
||||||
$init_reload = 'initctl reload-configuration'
|
$init_reload = 'initctl reload-configuration'
|
||||||
if ! defined(Exec[$init_reload]) {
|
if ! defined(Exec[$init_reload]) {
|
||||||
exec { $init_reload:
|
exec { $init_reload:
|
||||||
command => $init_reload_cmd,
|
command => $init_reload_cmd,
|
||||||
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ]
|
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File[$cinder_volume_default]~>
|
File[$cinder_volume_default]~>
|
||||||
Exec[$init_reload]->
|
Exec[$init_reload]->
|
||||||
Service["cinder_volume_vmware_${index}"]->
|
Service["cinder_volume_vmware_${index}"]->
|
||||||
Service["cinder_volume_vmware"]
|
Service['cinder_volume_vmware']
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail { "Unsupported OS family (${::osfamily})": }
|
fail { "Unsupported OS family (${::osfamily})": }
|
||||||
|
|
|
@ -76,11 +76,11 @@ vmware_host_ip=1.2.3.4
|
||||||
|
|
||||||
# Password for authenticating with VMware vCenter server. (string value)
|
# Password for authenticating with VMware vCenter server. (string value)
|
||||||
#vmware_host_password = <None>
|
#vmware_host_password = <None>
|
||||||
vmware_host_password=
|
vmware_host_password=password
|
||||||
|
|
||||||
# Username for authenticating with VMware vCenter server. (string value)
|
# Username for authenticating with VMware vCenter server. (string value)
|
||||||
#vmware_host_username = <None>
|
#vmware_host_username = <None>
|
||||||
vmware_host_username=administrator@vsphere.local
|
vmware_host_username=user
|
||||||
|
|
||||||
# Optional string specifying the VMware vCenter server version. The driver
|
# Optional string specifying the VMware vCenter server version. The driver
|
||||||
# attempts to retrieve the version from VMware vCenter server. Set this
|
# attempts to retrieve the version from VMware vCenter server. Set this
|
||||||
|
@ -287,4 +287,4 @@ vmware_volume_folder=cinder-volumes
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,88 @@ require 'shared-examples'
|
||||||
manifest = 'vmware/cinder-vmware.pp'
|
manifest = 'vmware/cinder-vmware.pp'
|
||||||
|
|
||||||
describe manifest do
|
describe manifest do
|
||||||
|
shared_examples 'catalog' do
|
||||||
|
|
||||||
|
storage_hash = Noop.hiera 'storage'
|
||||||
|
node_name = Noop.hiera('node_name')
|
||||||
|
network_metadata = Noop.hiera_hash 'network_metadata', {}
|
||||||
|
roles = network_metadata['nodes'][node_name]['node_roles']
|
||||||
|
vc_cinder_hash = Noop.hiera_structure('cinder/instances', [])
|
||||||
|
vc_instance = vc_cinder_hash[0]
|
||||||
|
vcenter_availability_zone_name = vc_instance['availability_zone_name']
|
||||||
|
vcenter_host = vc_instance['vc_host']
|
||||||
|
vcenter_password = vc_instance['vc_password']
|
||||||
|
vcenter_user = vc_instance['vc_user']
|
||||||
|
|
||||||
|
if storage_hash['debug']
|
||||||
|
debug = storage_hash['debug']
|
||||||
|
else
|
||||||
|
debug = Noop.hiera 'debug', true
|
||||||
|
end
|
||||||
|
|
||||||
|
if storage_hash['volumes_ceph']
|
||||||
|
if Noop.puppet_function 'member', roles, 'primary-controller' or Noop.puppet_function 'member', roles, 'controller'
|
||||||
|
it 'should declare cinder vmware' do
|
||||||
|
should contain_class('openstack_tasks::openstack_cinder::openstack_cinder')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should configure /etc/cinder/cinder.d/vmware-vcenter.conf' do
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*enabled_backends=VMwareVcVmdk-backend\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*storage_availability_zone=#{vcenter_availability_zone_name}-cinder\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*default_availability_zone=#{vcenter_availability_zone_name}-cinder\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*debug=#{debug}\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*backend_host=#{vcenter_availability_zone_name}\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*volume_backend_name=VMwareVcVmdk-backend\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_api_retry_count=10\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_host_ip=#{vcenter_host}\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_host_password=#{vcenter_password}\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_host_username=#{vcenter_user}\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_image_transfer_timeout_secs=7200\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_insecure = True\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_max_objects_retrieval=100\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_task_poll_interval=5\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_tmp_dir=/tmp\n}
|
||||||
|
)
|
||||||
|
should contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with_content(
|
||||||
|
%r{\n\s*vmware_volume_folder=cinder-volumes\n}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end # end of shared_examples
|
||||||
|
|
||||||
test_ubuntu_and_centos manifest
|
test_ubuntu_and_centos manifest
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue