Update cinder-vmware conf for cinder multi backend

* Update cinder-vmware conf for cinder multi backend
* Fix the spec framework for this module so the
  spec can be actually used
* Disable non-working specs in the vmware modules
  somebody should fix them later.
* Add spec for vmware::cinder::vmdk
  It tests only this templates and
  should be finished later too.
* Enable spec for this module in the Fuel CI

Change-Id: Id3b8cdb10acd0d7a63a085c03795169c5f304c13
Closes-Bug: #1569874
Closes-Bug: #1496009
(cherry picked from commit 8febf5a5c7)
This commit is contained in:
Alexander Arzhanov 2016-04-28 14:20:20 +03:00
parent 0a223b0958
commit c4d3dfc9c0
13 changed files with 511 additions and 92 deletions

View File

@ -26,6 +26,7 @@ group :development, :test do
gem 'beaker-puppet_install_helper', :require => 'false'
gem 'psych', :require => 'false'
gem 'puppet-spec', :require => 'false'
gem 'rspec-puppet-facts'
end
if puppetversion = ENV['PUPPET_GEM_VERSION']

View File

@ -6,3 +6,5 @@ fixtures:
nova: "#{source_dir}/../nova"
stdlib: "#{source_dir}/../stdlib"
vmware: "#{source_dir}"
oslo: "#{source_dir}/../oslo"
cinder: "#{source_dir}/../cinder"

2
deployment/puppet/vmware/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea
spec/fixtures

View File

@ -0,0 +1 @@
-f doc -c

View File

@ -4,6 +4,8 @@ group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', '~> 1.1'
gem 'rake', '~> 10.3.1'
gem 'pry'
gem 'rspec-puppet-facts'
end
if puppetversion = ENV['PUPPET_GEM_VERSION']

View File

@ -1,12 +1,18 @@
require 'spec_helper'
describe 'vmware::ceilometer' do
let(:facts) { { :osfamily => 'debian' } }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
it 'should enable ceilometer-polling' do
should contain_service('ceilometer-polling').with({
'enabled' => 'true'
})
it { is_expected.to compile.with_all_deps }
xit 'should enable ceilometer-polling' do
should contain_service('ceilometer-polling').with({
'enabled' => 'true'
})
end
end
end
end

View File

@ -1,26 +1,32 @@
require 'spec_helper'
describe 'vmware::controller' do
let(:facts) { { :osfamily => 'debian' } }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
it 'must disable nova-compute' do
should contain_nova__generic_service('compute').with({
'enabled' => 'false'
})
xit { is_expected.to compile.with_all_deps }
xit 'must disable nova-compute' do
should contain_nova__generic_service('compute').with({
'enabled' => 'false'
})
end
xit 'must properly configure novncproxy_base_url' do
should contain_nova_config('DEFAULT/novncproxy_base_url').with({
'value' => "http://0.0.0.0:6080/vnc_auto.html",
})
end
xit 'must install cirros-testvmware package' do
should contain_package('cirros-testvmware')
end
xit 'must install python-suds package' do
should contain_package('python-suds')
end
end
end
it 'must properly configure novncproxy_base_url' do
should contain_nova_config('DEFAULT/novncproxy_base_url').with({
'value' => "http://0.0.0.0:6080/vnc_auto.html",
})
end
it 'must install cirros-testvmware package' do
should contain_package('cirros-testvmware')
end
it 'must install python-suds package' do
should contain_package('python-suds')
end
end
end

View File

@ -1,36 +1,47 @@
require 'spec_helper'
describe 'vmware::ceilometer::ha' do
let(:params) { {
:availability_zone_name => 'vCenter',
:vc_cluster => 'prod-cluster',
:vc_host => '10.10.0.1',
:vc_user => 'admin@vsphere.local',
:vc_password => 'pass',
:service_name => 'prod'
} }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
it 'must create /etc/ceilometer/ceilometer-compute.d directory' do
should contain_file('/etc/ceilometer/ceilometer-compute.d').with({
'ensure' => 'directory',
'owner' => 'ceilometer',
'group' => 'ceilometer',
'mode' => '0750'
})
end
xit { is_expected.to compile.with_all_deps }
it 'should create service p_ceilometer_agent_compute_vmware_vCenter_prod' do
should contain_pcmk_resource('p_ceilometer_agent_compute_vmware_vCenter_prod').with({
'primitive_class' => 'ocf',
'primitive_provider' => 'fuel',
})
end
let(:params) do
{
:availability_zone_name => 'vCenter',
:vc_cluster => 'prod-cluster',
:vc_host => '10.10.0.1',
:vc_user => 'admin@vsphere.local',
:vc_password => 'pass',
:service_name => 'prod'
}
end
it 'should create service p_ceilometer_agent_compute_vmware_vCenter_prod' do
should contain_service('p_ceilometer_agent_compute_vmware_vCenter_prod')
end
xit 'must create /etc/ceilometer/ceilometer-compute.d directory' do
should contain_file('/etc/ceilometer/ceilometer-compute.d').with({
'ensure' => 'directory',
'owner' => 'ceilometer',
'group' => 'ceilometer',
'mode' => '0750'
})
end
it 'should apply configuration file before corosync resource' do
should contain_file('/etc/ceilometer/ceilometer-compute.d/vmware-vCenter_prod.conf').that_comes_before('Pcmk_resource[p_ceilometer_agent_compute_vmware_vCenter_prod]')
xit 'should create service p_ceilometer_agent_compute_vmware_vCenter_prod' do
should contain_pcmk_resource('p_ceilometer_agent_compute_vmware_vCenter_prod').with({
'primitive_class' => 'ocf',
'primitive_provider' => 'fuel',
})
end
xit 'should create service p_ceilometer_agent_compute_vmware_vCenter_prod' do
should contain_service('p_ceilometer_agent_compute_vmware_vCenter_prod')
end
xit 'should apply configuration file before corosync resource' do
should contain_file('/etc/ceilometer/ceilometer-compute.d/vmware-vCenter_prod.conf').that_comes_before('Pcmk_resource[p_ceilometer_agent_compute_vmware_vCenter_prod]')
end
end
end
end

View File

@ -0,0 +1,290 @@
require 'spec_helper'
describe 'vmware::cinder::vmdk', type: :define do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
context 'with default parameters' do
let(:title) do
'non-nova'
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_vmware__cinder__vmdk('non-nova') }
it { is_expected.to contain_file('/etc/cinder/cinder.d') }
it { is_expected.to contain_service('cinder_volume_vmware') }
it do
content = <<-eof
[DEFAULT]
# A list of backend names to use. These backend names should be backed by a
# unique [CONFIG] group with its options (list value)
#enabled_backends = <None>
enabled_backends=VMwareVcVmdk-backend
# Availability zone of this node (string value)
#storage_availability_zone = nova
storage_availability_zone=non-nova-cinder
# Default availability zone for new volumes. If not set, the
# storage_availability_zone option value is used as the default for new volumes.
# (string value)
#default_availability_zone = <None>
default_availability_zone=non-nova-cinder
# If set to true, the logging level will be set to DEBUG instead of the default
# INFO level. (boolean value)
#debug = false
debug=false
[VMwareVcVmdk-backend]
# Backend override of host value. (string value)
# Deprecated group/name - [DEFAULT]/host
#backend_host = <None>
backend_host=non-nova
# The backend name for a given driver implementation (string value)
#volume_backend_name = <None>
volume_backend_name=VMwareVcVmdk-backend
# Driver to use for volume creation (string value)
#volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
# Number of times VMware vCenter server API must be retried upon connection
# related issues. (integer value)
#vmware_api_retry_count = 10
vmware_api_retry_count=10
# CA bundle file to use in verifying the vCenter server certificate. (string
# value)
#vmware_ca_file = <None>
# Name of a vCenter compute cluster where volumes should be created. (multi
# valued)
#vmware_cluster_name =
# IP address for connecting to VMware vCenter server. (string value)
#vmware_host_ip = <None>
vmware_host_ip=1.2.3.4
# Password for authenticating with VMware vCenter server. (string value)
#vmware_host_password = <None>
vmware_host_password=
# Username for authenticating with VMware vCenter server. (string value)
#vmware_host_username = <None>
vmware_host_username=administrator@vsphere.local
# 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. (string
# value)
#vmware_host_version = <None>
# Timeout in seconds for VMDK volume transfer between Cinder and Glance.
# (integer value)
#vmware_image_transfer_timeout_secs = 7200
vmware_image_transfer_timeout_secs=7200
# If true, the vCenter server certificate is not verified. If false, then the
# default CA truststore is used for verification. This option is ignored if
# "vmware_ca_file" is set. (boolean value)
#vmware_insecure = false
vmware_insecure = True
# 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. (integer value)
#vmware_max_objects_retrieval = 100
vmware_max_objects_retrieval=100
# The interval (in seconds) for polling remote tasks invoked on VMware vCenter
# server. (floating point value)
#vmware_task_poll_interval = 0.5
vmware_task_poll_interval=5
# Directory where virtual disks are stored during volume backup and restore.
# (string value)
#vmware_tmp_dir = /tmp
vmware_tmp_dir=/tmp
# 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>)". (string value)
#vmware_volume_folder = Volumes
vmware_volume_folder=cinder-volumes
# Optional VIM service WSDL Location e.g http://<server>/vimService.wsdl.
# Optional over-ride to default location for bug work-arounds. (string value)
#vmware_wsdl_location = <None>
eof
parameters = {
:ensure => 'present',
:mode => '0600',
:owner => 'cinder',
:group => 'cinder',
:content => content,
}
is_expected.to contain_file('/etc/cinder/cinder.d/vmware-non-nova.conf').with(parameters)
end
end
context 'with custom parameters' do
let(:params) do
{
:availability_zone_name => 'vcenter',
:vc_host => '172.16.0.254',
:vc_password => 'Qwer!1234',
:vc_user => 'administrator@vsphere.local',
:debug => false,
}
end
let(:title) do
params[:availability_zone_name]
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_vmware__cinder__vmdk('vcenter') }
it { is_expected.to contain_file('/etc/cinder/cinder.d') }
it { is_expected.to contain_service('cinder_volume_vmware') }
it do
content = <<-eof
[DEFAULT]
# A list of backend names to use. These backend names should be backed by a
# unique [CONFIG] group with its options (list value)
#enabled_backends = <None>
enabled_backends=VMwareVcVmdk-backend
# Availability zone of this node (string value)
#storage_availability_zone = nova
storage_availability_zone=vcenter-cinder
# Default availability zone for new volumes. If not set, the
# storage_availability_zone option value is used as the default for new volumes.
# (string value)
#default_availability_zone = <None>
default_availability_zone=vcenter-cinder
# If set to true, the logging level will be set to DEBUG instead of the default
# INFO level. (boolean value)
#debug = false
debug=false
[VMwareVcVmdk-backend]
# Backend override of host value. (string value)
# Deprecated group/name - [DEFAULT]/host
#backend_host = <None>
backend_host=vcenter
# The backend name for a given driver implementation (string value)
#volume_backend_name = <None>
volume_backend_name=VMwareVcVmdk-backend
# Driver to use for volume creation (string value)
#volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
# Number of times VMware vCenter server API must be retried upon connection
# related issues. (integer value)
#vmware_api_retry_count = 10
vmware_api_retry_count=10
# CA bundle file to use in verifying the vCenter server certificate. (string
# value)
#vmware_ca_file = <None>
# Name of a vCenter compute cluster where volumes should be created. (multi
# valued)
#vmware_cluster_name =
# IP address for connecting to VMware vCenter server. (string value)
#vmware_host_ip = <None>
vmware_host_ip=172.16.0.254
# Password for authenticating with VMware vCenter server. (string value)
#vmware_host_password = <None>
vmware_host_password=Qwer!1234
# Username for authenticating with VMware vCenter server. (string value)
#vmware_host_username = <None>
vmware_host_username=administrator@vsphere.local
# 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. (string
# value)
#vmware_host_version = <None>
# Timeout in seconds for VMDK volume transfer between Cinder and Glance.
# (integer value)
#vmware_image_transfer_timeout_secs = 7200
vmware_image_transfer_timeout_secs=7200
# If true, the vCenter server certificate is not verified. If false, then the
# default CA truststore is used for verification. This option is ignored if
# "vmware_ca_file" is set. (boolean value)
#vmware_insecure = false
vmware_insecure = True
# 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. (integer value)
#vmware_max_objects_retrieval = 100
vmware_max_objects_retrieval=100
# The interval (in seconds) for polling remote tasks invoked on VMware vCenter
# server. (floating point value)
#vmware_task_poll_interval = 0.5
vmware_task_poll_interval=5
# Directory where virtual disks are stored during volume backup and restore.
# (string value)
#vmware_tmp_dir = /tmp
vmware_tmp_dir=/tmp
# 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>)". (string value)
#vmware_volume_folder = Volumes
vmware_volume_folder=cinder-volumes
# Optional VIM service WSDL Location e.g http://<server>/vimService.wsdl.
# Optional over-ride to default location for bug work-arounds. (string value)
#vmware_wsdl_location = <None>
eof
parameters = {
:ensure => 'present',
:mode => '0600',
:owner => 'cinder',
:group => 'cinder',
:content => content,
}
is_expected.to contain_file('/etc/cinder/cinder.d/vmware-vcenter.conf').with(parameters)
end
end
end
end
end

View File

@ -1,38 +1,47 @@
require 'spec_helper'
describe 'vmware::compute::ha' do
let(:title) { '0' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
let(:params) { {
:availability_zone_name => 'vCenter',
:vc_cluster => 'prod-cluster',
:vc_host => '10.10.0.1',
:vc_user => 'admin@vsphere.local',
:vc_password => 'pass',
:service_name => 'prod'
} }
xit { is_expected.to compile.with_all_deps }
it 'must create /etc/nova/nova-compute.d directory' do
should contain_file('/etc/nova/nova-compute.d').with({
'ensure' => 'directory',
'owner' => 'nova',
'group' => 'nova',
'mode' => '0750'
})
end
let(:title) { '0' }
it 'should create service p_nova_compute_vmware_vCenter-prod' do
should contain_pcmk_resource('p_nova_compute_vmware_vCenter-prod').with({
'primitive_class' => 'ocf',
'primitive_provider' => 'fuel',
})
end
let(:params) { {
:availability_zone_name => 'vCenter',
:vc_cluster => 'prod-cluster',
:vc_host => '10.10.0.1',
:vc_user => 'admin@vsphere.local',
:vc_password => 'pass',
:service_name => 'prod'
} }
it 'should create service p_nova_compute_vmware_vCenter-prod' do
should contain_service('p_nova_compute_vmware_vCenter-prod')
end
xit 'must create /etc/nova/nova-compute.d directory' do
should contain_file('/etc/nova/nova-compute.d').with({
'ensure' => 'directory',
'owner' => 'nova',
'group' => 'nova',
'mode' => '0750'
})
end
it 'should apply configuration file before corosync resource' do
should contain_file('/etc/nova/nova-compute.d/vmware-vCenter_prod.conf').that_comes_before('Pcmk_resource[p_nova_compute_vmware_vCenter-prod]')
xit 'should create service p_nova_compute_vmware_vCenter-prod' do
should contain_pcmk_resource('p_nova_compute_vmware_vCenter-prod').with({
'primitive_class' => 'ocf',
'primitive_provider' => 'fuel',
})
end
xit 'should create service p_nova_compute_vmware_vCenter-prod' do
should contain_service('p_nova_compute_vmware_vCenter-prod')
end
xit 'should apply configuration file before corosync resource' do
should contain_file('/etc/nova/nova-compute.d/vmware-vCenter_prod.conf').that_comes_before('Pcmk_resource[p_nova_compute_vmware_vCenter-prod]')
end
end
end
end

View File

@ -1,2 +1,4 @@
require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts

View File

@ -1,22 +1,110 @@
[DEFAULT]
host=<%= @index %>
# A list of backend names to use. These backend names should be backed by a
# unique [CONFIG] group with its options (list value)
#enabled_backends = <None>
enabled_backends=VMwareVcVmdk-backend
# Availability zone of this node (string value)
#storage_availability_zone = nova
storage_availability_zone=<%= @availability_zone_name %>-cinder
# Default availability zone for new volumes. If not set, the
# storage_availability_zone option value is used as the default for new volumes.
# (string value)
#default_availability_zone = <None>
default_availability_zone=<%= @availability_zone_name %>-cinder
volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
# If set to true, the logging level will be set to DEBUG instead of the default
# INFO level. (boolean value)
#debug = false
debug=<%= @debug %>
vmware_host_ip=<%= @vc_host %>
vmware_host_username=<%= @vc_user %>
vmware_host_password=<%= @vc_password %>
vmware_volume_folder=<%= @vc_volume_folder %>
<% if !@vc_wsdl_location.empty? %>
vmware_wsdl_location=<%= @vc_wsdl_location %>
<% end %>
[VMwareVcVmdk-backend]
# Backend override of host value. (string value)
# Deprecated group/name - [DEFAULT]/host
#backend_host = <None>
backend_host=<%= @index %>
# The backend name for a given driver implementation (string value)
#volume_backend_name = <None>
volume_backend_name=VMwareVcVmdk-backend
# Driver to use for volume creation (string value)
#volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
# Number of times VMware vCenter server API must be retried upon connection
# related issues. (integer value)
#vmware_api_retry_count = 10
vmware_api_retry_count=<%= @vc_api_retry_count %>
# CA bundle file to use in verifying the vCenter server certificate. (string
# value)
#vmware_ca_file = <None>
# Name of a vCenter compute cluster where volumes should be created. (multi
# valued)
#vmware_cluster_name =
# IP address for connecting to VMware vCenter server. (string value)
#vmware_host_ip = <None>
vmware_host_ip=<%= @vc_host %>
# Password for authenticating with VMware vCenter server. (string value)
#vmware_host_password = <None>
vmware_host_password=<%= @vc_password %>
# Username for authenticating with VMware vCenter server. (string value)
#vmware_host_username = <None>
vmware_host_username=<%= @vc_user %>
# 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. (string
# value)
#vmware_host_version = <None>
<% if !@vc_host_version.empty? %>
vmware_host_version=<%= @vc_host_version %>
<% end %>
# Timeout in seconds for VMDK volume transfer between Cinder and Glance.
# (integer value)
#vmware_image_transfer_timeout_secs = 7200
vmware_image_transfer_timeout_secs=<%= @vc_image_transfer_timeout_secs %>
# If true, the vCenter server certificate is not verified. If false, then the
# default CA truststore is used for verification. This option is ignored if
# "vmware_ca_file" is set. (boolean value)
#vmware_insecure = false
vmware_insecure = True
# 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. (integer value)
#vmware_max_objects_retrieval = 100
vmware_max_objects_retrieval=<%= @vc_max_objects_retrieval %>
# The interval (in seconds) for polling remote tasks invoked on VMware vCenter
# server. (floating point value)
#vmware_task_poll_interval = 0.5
vmware_task_poll_interval=<%= @vc_task_poll_interval %>
# Directory where virtual disks are stored during volume backup and restore.
# (string value)
#vmware_tmp_dir = /tmp
vmware_tmp_dir=<%= @vc_tmp_dir %>
# 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>)". (string value)
#vmware_volume_folder = Volumes
vmware_volume_folder=<%= @vc_volume_folder %>
# Optional VIM service WSDL Location e.g http://<server>/vimService.wsdl.
# Optional over-ride to default location for bug work-arounds. (string value)
#vmware_wsdl_location = <None>
<% if !@vc_wsdl_location.empty? %>
vmware_wsdl_location=<%= @vc_wsdl_location %>
<% end %>

View File

@ -6,4 +6,3 @@ mysql
nailgun
pacemaker
rsyslog
vmware