From 5075d8b7e8d8d13804503101d0999c499307f2af Mon Sep 17 00:00:00 2001 From: Iury Gregory Melo Ferreira Date: Fri, 19 Aug 2016 01:23:15 -0300 Subject: [PATCH] Fix vmware manifest -Add missing attributes -Fix section name Change-Id: I4f5b7530ae9b725241397ef546ad455243f5f5b7 Closes-bug: #1614646 --- manifests/compute/vmware.pp | 59 +++++++++++------ .../vmware_updates-9ead09cc33383d5f.yaml | 4 ++ spec/classes/nova_compute_vmware_spec.rb | 65 +++++++++++++------ 3 files changed, 87 insertions(+), 41 deletions(-) create mode 100644 releasenotes/notes/vmware_updates-9ead09cc33383d5f.yaml diff --git a/manifests/compute/vmware.pp b/manifests/compute/vmware.pp index e72f78046..ee43a9c36 100644 --- a/manifests/compute/vmware.pp +++ b/manifests/compute/vmware.pp @@ -41,43 +41,60 @@ # (optional) VIM Service WSDL Location e.g # http:///vimService.wsdl. Optional over-ride to # default location for bug work-arounds. -# Defaults to None. +# Defaults to $::os_service_default # # [*compute_driver*] # (optional) Compute driver. # Defaults to 'vmwareapi.VMwareVCDriver' # +# [*insecure*] +# (optional) Allow insecure conections. +# 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 “ca_file” is set. +# Defaults to $::os_service_default +# +# [*ca_file*] +# (optional) Specify a CA bundle file to use in verifying the vCenter server +# certificate. +# Defaults to $::os_service_default +# +# [*datastore_regex*] +# (optional) Regex to match the name of a datastore. +# Defaults to $::os_service_default +# class nova::compute::vmware( $host_ip, $host_username, $host_password, $cluster_name, - $api_retry_count = 5, - $maximum_objects = 100, + $api_retry_count = 5, + $maximum_objects = 100, $task_poll_interval = 5.0, - $use_linked_clone = true, - $wsdl_location = undef, - $compute_driver = 'vmwareapi.VMwareVCDriver' + $use_linked_clone = true, + $wsdl_location = $::os_service_default, + $compute_driver = 'vmwareapi.VMwareVCDriver', + $insecure = $::os_service_default, + $ca_file = $::os_service_default, + $datastore_regex = $::os_service_default, ) { include ::nova::deps nova_config { - 'DEFAULT/compute_driver': value => $compute_driver; - 'VMWARE/host_ip': value => $host_ip; - 'VMWARE/host_username': value => $host_username; - 'VMWARE/host_password': value => $host_password; - 'VMWARE/cluster_name': value => $cluster_name; - 'VMWARE/api_retry_count' : value => $api_retry_count; - 'VMWARE/maximum_objects' : value => $maximum_objects; - 'VMWARE/task_poll_interval' : value => $task_poll_interval; - 'VMWARE/use_linked_clone': value => $use_linked_clone; - } - - if $wsdl_location { - nova_config { - 'VMWARE/wsdl_location' : value => $wsdl_location; - } + 'DEFAULT/compute_driver': value => $compute_driver; + 'vmware/host_ip': value => $host_ip; + 'vmware/host_username': value => $host_username; + 'vmware/host_password': value => $host_password; + 'vmware/cluster_name': value => $cluster_name; + 'vmware/api_retry_count': value => $api_retry_count; + 'vmware/maximum_objects': value => $maximum_objects; + 'vmware/task_poll_interval': value => $task_poll_interval; + 'vmware/use_linked_clone': value => $use_linked_clone; + 'vmware/wsdl_location': value => $wsdl_location; + 'vmware/insecure': value => $insecure; + 'vmware/ca_file': value => $ca_file; + 'vmware/datastore_regex': value => $datastore_regex; } package { 'python-suds': diff --git a/releasenotes/notes/vmware_updates-9ead09cc33383d5f.yaml b/releasenotes/notes/vmware_updates-9ead09cc33383d5f.yaml new file mode 100644 index 000000000..c2db4e62f --- /dev/null +++ b/releasenotes/notes/vmware_updates-9ead09cc33383d5f.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fix vmware section name, should be vmware and not VMWARE. + - Add missing insecure, ca_file and datastore_regex parameters diff --git a/spec/classes/nova_compute_vmware_spec.rb b/spec/classes/nova_compute_vmware_spec.rb index 9bd295045..6e854723b 100644 --- a/spec/classes/nova_compute_vmware_spec.rb +++ b/spec/classes/nova_compute_vmware_spec.rb @@ -15,26 +15,36 @@ describe 'nova::compute::vmware' do :task_poll_interval => 10.5, :use_linked_clone => false, :wsdl_location => 'http://127.0.0.1:8080/vmware/SDK/wsdl/vim25/vimService.wsdl', - :compute_driver => 'vmwareapi.FoobarDriver' } + :compute_driver => 'vmwareapi.FoobarDriver', + :insecure => true, + :datastore_regex => '/(?:[^:]|:[^:])+/' } end - it 'configures vmwareapi in nova.conf' do - is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('vmwareapi.VMwareVCDriver') - is_expected.to contain_nova_config('VMWARE/host_ip').with_value(params[:host_ip]) - is_expected.to contain_nova_config('VMWARE/host_username').with_value(params[:host_username]) - is_expected.to contain_nova_config('VMWARE/host_password').with_value(params[:host_password]) - is_expected.to contain_nova_config('VMWARE/cluster_name').with_value(params[:cluster_name]) - is_expected.to contain_nova_config('VMWARE/api_retry_count').with_value(5) - is_expected.to contain_nova_config('VMWARE/maximum_objects').with_value(100) - is_expected.to contain_nova_config('VMWARE/task_poll_interval').with_value(5.0) - is_expected.to contain_nova_config('VMWARE/use_linked_clone').with_value(true) - is_expected.to_not contain_nova_config('VMWARE/wsdl_location') - end + shared_examples_for 'vmware api' do - it 'installs suds python package' do - is_expected.to contain_package('python-suds').with( + context 'with default parameters' do + it 'configures vmwareapi in nova.conf' do + is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('vmwareapi.VMwareVCDriver') + is_expected.to contain_nova_config('vmware/host_ip').with_value(params[:host_ip]) + is_expected.to contain_nova_config('vmware/host_username').with_value(params[:host_username]) + is_expected.to contain_nova_config('vmware/host_password').with_value(params[:host_password]) + is_expected.to contain_nova_config('vmware/cluster_name').with_value(params[:cluster_name]) + is_expected.to contain_nova_config('vmware/api_retry_count').with_value(5) + is_expected.to contain_nova_config('vmware/maximum_objects').with_value(100) + is_expected.to contain_nova_config('vmware/task_poll_interval').with_value(5.0) + is_expected.to contain_nova_config('vmware/use_linked_clone').with_value(true) + is_expected.to contain_nova_config('vmware/wsdl_location').with_value('') + is_expected.to contain_nova_config('vmware/insecure').with_value('') + is_expected.to contain_nova_config('vmware/ca_file').with_value('') + is_expected.to contain_nova_config('vmware/datastore_regex').with_value('') + end + + it 'installs suds python package' do + is_expected.to contain_package('python-suds').with( :ensure => 'present' ) + end + end end context 'with optional parameters' do @@ -44,11 +54,26 @@ describe 'nova::compute::vmware' do it 'configures vmwareapi in nova.conf' do is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value(params[:compute_driver]) - is_expected.to contain_nova_config('VMWARE/api_retry_count').with_value(params[:api_retry_count]) - is_expected.to contain_nova_config('VMWARE/maximum_objects').with_value(params[:maximum_objects]) - is_expected.to contain_nova_config('VMWARE/task_poll_interval').with_value(params[:task_poll_interval]) - is_expected.to contain_nova_config('VMWARE/use_linked_clone').with_value(false) - is_expected.to contain_nova_config('VMWARE/wsdl_location').with_value(params[:wsdl_location]) + is_expected.to contain_nova_config('vmware/api_retry_count').with_value(params[:api_retry_count]) + is_expected.to contain_nova_config('vmware/maximum_objects').with_value(params[:maximum_objects]) + is_expected.to contain_nova_config('vmware/task_poll_interval').with_value(params[:task_poll_interval]) + is_expected.to contain_nova_config('vmware/use_linked_clone').with_value(false) + is_expected.to contain_nova_config('vmware/wsdl_location').with_value(params[:wsdl_location]) + is_expected.to contain_nova_config('vmware/insecure').with_value(params[:insecure]) + is_expected.to contain_nova_config('vmware/datastore_regex').with_value(params[:datastore_regex]) end end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os, facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'vmware api' + end + end + end