vmware: Avoid hard-coding default values

... but use the service default values globally. The service defaults
are usually considered to be the reasonable base.

Change-Id: I095b0b383f4db3f2656dcea55cced262149937d0
This commit is contained in:
Takashi Kajinami 2022-03-02 00:50:44 +09:00
parent 71cd1dd31c
commit f17bfbc5d4
3 changed files with 43 additions and 27 deletions

View File

@ -19,7 +19,7 @@
# [*api_retry_count*]
# (optional) The number of times we retry on failures,
# e.g., socket error, etc.
# Defaults to 5.
# Defaults to $::os_service_default.
#
# [*maximum_objects*]
# (optional) The maximum number of ObjectContent data objects that should
@ -28,15 +28,15 @@
# objects reaches the specified maximum. The server may still
# limit the count to something less than the configured value.
# Any remaining objects may be retrieved with additional requests.
# Defaults to 100.
# Defaults to $::os_service_default.
#
# [*task_poll_interval*]
# (optional) The interval in seconds used for polling of remote tasks.
# Defaults to 5.0
# Defaults to $::os_service_default.
#
# [*use_linked_clone*]
# (optional) Whether to use linked clone strategy while creating VM's.
# Defaults to true.
# Defaults to $::os_service_default.
#
# [*compute_driver*]
# (optional) Compute driver.
@ -63,10 +63,10 @@ class nova::compute::vmware(
$host_username,
$host_password,
$cluster_name,
$api_retry_count = 5,
$maximum_objects = 100,
$task_poll_interval = 5.0,
$use_linked_clone = true,
$api_retry_count = $::os_service_default,
$maximum_objects = $::os_service_default,
$task_poll_interval = $::os_service_default,
$use_linked_clone = $::os_service_default,
$compute_driver = 'vmwareapi.VMwareVCDriver',
$insecure = $::os_service_default,
$ca_file = $::os_service_default,

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
Default values of the ``nova::compute::vmware`` class parameters have been
updated to use service defaults more globally. Because of this change,
the following parameters use effectively different default values.
- ``api_retry_count`` is changed from ``5`` to the service
default value (``10``)
- ``task_poll_interval`` is changed from ``5.0`` to the service default
value (``0.5``)

View File

@ -3,20 +3,24 @@ require 'spec_helper'
describe 'nova::compute::vmware' do
let :params do
{:host_ip => '127.0.0.1',
:host_username => 'root',
:host_password => 'passw0rd',
:cluster_name => 'cluster1'}
{
:host_ip => '127.0.0.1',
:host_username => 'root',
:host_password => 'passw0rd',
:cluster_name => 'cluster1'
}
end
let :optional_params do
{:api_retry_count => 10,
:maximum_objects => 100,
:task_poll_interval => 10.5,
:use_linked_clone => false,
:compute_driver => 'vmwareapi.FoobarDriver',
:insecure => true,
:datastore_regex => '/(?:[^:]|:[^:])+/' }
{
:api_retry_count => 10,
:maximum_objects => 100,
:task_poll_interval => 10.5,
:use_linked_clone => false,
:compute_driver => 'vmwareapi.FoobarDriver',
:insecure => true,
:datastore_regex => '/(?:[^:]|:[^:])+/'
}
end
shared_examples_for 'vmware api' do
@ -28,19 +32,19 @@ describe 'nova::compute::vmware' do
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]).with_secret(true)
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/api_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('vmware/maximum_objects').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('vmware/task_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('vmware/use_linked_clone').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('vmware/insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('vmware/ca_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('vmware/datastore_regex').with_value('<SERVICE DEFAULT>')
end
it 'installs suds python package' do
is_expected.to contain_package('python-suds').with(
:ensure => 'present'
)
is_expected.to contain_package('python-suds').with(
:ensure => 'present'
)
end
end
end
@ -55,7 +59,7 @@ describe 'nova::compute::vmware' do
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/use_linked_clone').with_value(params[:use_linked_clone])
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