Add ability to override compute_driver
This change introduces a new compute_driver parameter for all compute driver manifests. This will allow a user to override the compute_driver config value by its own instead of forking or monkey-patching the manifests. It also changes the compute_driver config value of Ironic for ironic.IronicDriver which also works and better fit the config value style already used in the other manifests. Common use case for this parameter is to allow the use of a local or derivative version of a driver which adds features and/or bug fixes. Closes-bug: #1472445 Change-Id: I4cd211b389303c22f4c2aa6db7592cc9861d4f40
This commit is contained in:
parent
c1afc9ec65
commit
7a7051ab48
|
@ -24,13 +24,16 @@
|
|||
# The url for Ironic api endpoint.
|
||||
# Defaults to 'http://127.0.0.1:6385/v1'
|
||||
#
|
||||
# [*compute_driver*]
|
||||
# (optional) Compute driver.
|
||||
# Defaults to 'ironic.IronicDriver'
|
||||
#
|
||||
# [*admin_user*]
|
||||
# (optional) DEPRECATED: Use admin_username instead.
|
||||
#
|
||||
# [*admin_passwd*]
|
||||
# (optional) DEPRECATED: Use admin_password instead.
|
||||
#
|
||||
|
||||
class nova::compute::ironic (
|
||||
$admin_username = 'admin',
|
||||
$admin_password = 'ironic',
|
||||
|
@ -40,6 +43,7 @@ class nova::compute::ironic (
|
|||
# DEPRECATED PARAMETERS
|
||||
$admin_user = undef,
|
||||
$admin_passwd = undef,
|
||||
$compute_driver = 'ironic.IronicDriver'
|
||||
) {
|
||||
|
||||
if $admin_user {
|
||||
|
@ -59,6 +63,6 @@ class nova::compute::ironic (
|
|||
'ironic/admin_url': value => $admin_url;
|
||||
'ironic/admin_tenant_name': value => $admin_tenant_name;
|
||||
'ironic/api_endpoint': value => $api_endpoint;
|
||||
'DEFAULT/compute_driver': value => 'nova.virt.ironic.IronicDriver';
|
||||
'DEFAULT/compute_driver': value => $compute_driver;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,10 @@
|
|||
# (optional) libvirt service name.
|
||||
# Defaults to $::nova::params::libvirt_service_name
|
||||
#
|
||||
# [*compute_driver*]
|
||||
# (optional) Compute driver.
|
||||
# Defaults to 'libvirt.LibvirtDriver'
|
||||
#
|
||||
class nova::compute::libvirt (
|
||||
$libvirt_virt_type = 'kvm',
|
||||
$vncserver_listen = '127.0.0.1',
|
||||
|
@ -92,6 +96,7 @@ class nova::compute::libvirt (
|
|||
$remove_unused_resized_minimum_age_seconds = undef,
|
||||
$remove_unused_original_minimum_age_seconds = undef,
|
||||
$libvirt_service_name = $::nova::params::libvirt_service_name,
|
||||
$compute_driver = 'libvirt.LibvirtDriver'
|
||||
) inherits nova::params {
|
||||
|
||||
include ::nova::params
|
||||
|
@ -171,7 +176,7 @@ class nova::compute::libvirt (
|
|||
}
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/compute_driver': value => 'libvirt.LibvirtDriver';
|
||||
'DEFAULT/compute_driver': value => $compute_driver;
|
||||
'DEFAULT/vncserver_listen': value => $vncserver_listen;
|
||||
'libvirt/virt_type': value => $libvirt_virt_type;
|
||||
'libvirt/cpu_mode': value => $libvirt_cpu_mode_real;
|
||||
|
|
|
@ -43,21 +43,25 @@
|
|||
# default location for bug work-arounds.
|
||||
# Defaults to None.
|
||||
#
|
||||
|
||||
# [*compute_driver*]
|
||||
# (optional) Compute driver.
|
||||
# Defaults to 'vmwareapi.VMwareVCDriver'
|
||||
#
|
||||
class nova::compute::vmware(
|
||||
$host_ip,
|
||||
$host_username,
|
||||
$host_password,
|
||||
$cluster_name,
|
||||
$api_retry_count=5,
|
||||
$maximum_objects=100,
|
||||
$task_poll_interval=5.0,
|
||||
$use_linked_clone=true,
|
||||
$wsdl_location=undef
|
||||
$api_retry_count = 5,
|
||||
$maximum_objects = 100,
|
||||
$task_poll_interval = 5.0,
|
||||
$use_linked_clone = true,
|
||||
$wsdl_location = undef,
|
||||
$compute_driver = 'vmwareapi.VMwareVCDriver'
|
||||
) {
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/compute_driver': value => 'vmwareapi.VMwareVCDriver';
|
||||
'DEFAULT/compute_driver': value => $compute_driver;
|
||||
'VMWARE/host_ip': value => $host_ip;
|
||||
'VMWARE/host_username': value => $host_username;
|
||||
'VMWARE/host_password': value => $host_password;
|
||||
|
|
|
@ -17,15 +17,20 @@
|
|||
# (optional) This parameter was removed in Diablo and does nothing.
|
||||
# Defaults to false
|
||||
#
|
||||
# [*compute_driver*]
|
||||
# (optional) Compute driver.
|
||||
# Defaults to 'xenapi.XenAPIDriver'
|
||||
#
|
||||
class nova::compute::xenserver(
|
||||
$xenapi_connection_url,
|
||||
$xenapi_connection_username,
|
||||
$xenapi_connection_password,
|
||||
$xenapi_inject_image=false
|
||||
$xenapi_inject_image = false,
|
||||
$compute_driver = 'xenapi.XenAPIDriver'
|
||||
) {
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/compute_driver': value => 'xenapi.XenAPIDriver';
|
||||
'DEFAULT/compute_driver': value => $compute_driver;
|
||||
'DEFAULT/connection_type': value => 'xenapi';
|
||||
'DEFAULT/xenapi_connection_url': value => $xenapi_connection_url;
|
||||
'DEFAULT/xenapi_connection_username': value => $xenapi_connection_username;
|
||||
|
|
|
@ -2,13 +2,37 @@ require 'spec_helper'
|
|||
|
||||
describe 'nova::compute::ironic' do
|
||||
|
||||
it 'configures ironic in nova.conf' do
|
||||
is_expected.to contain_nova_config('ironic/admin_username').with_value('admin')
|
||||
is_expected.to contain_nova_config('ironic/admin_password').with_value('ironic')
|
||||
is_expected.to contain_nova_config('ironic/admin_url').with_value('http://127.0.0.1:35357/v2.0')
|
||||
is_expected.to contain_nova_config('ironic/admin_tenant_name').with_value('services')
|
||||
is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://127.0.0.1:6385/v1')
|
||||
is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('nova.virt.ironic.IronicDriver')
|
||||
context 'with default parameters' do
|
||||
it 'configures ironic in nova.conf' do
|
||||
is_expected.to contain_nova_config('ironic/admin_username').with_value('admin')
|
||||
is_expected.to contain_nova_config('ironic/admin_password').with_value('ironic')
|
||||
is_expected.to contain_nova_config('ironic/admin_url').with_value('http://127.0.0.1:35357/v2.0')
|
||||
is_expected.to contain_nova_config('ironic/admin_tenant_name').with_value('services')
|
||||
is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://127.0.0.1:6385/v1')
|
||||
is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('ironic.IronicDriver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with overridden parameters' do
|
||||
let :params do
|
||||
{
|
||||
:admin_username => 'ironic',
|
||||
:admin_password => 's3cr3t',
|
||||
:admin_url => 'http://10.0.0.10:35357/v2.0',
|
||||
:admin_tenant_name => 'services2',
|
||||
:api_endpoint => 'http://10.0.0.10:6385/v1',
|
||||
:compute_driver => 'ironic.FoobarDriver'
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures ironic in nova.conf' do
|
||||
is_expected.to contain_nova_config('ironic/admin_username').with_value('ironic')
|
||||
is_expected.to contain_nova_config('ironic/admin_password').with_value('s3cr3t')
|
||||
is_expected.to contain_nova_config('ironic/admin_url').with_value('http://10.0.0.10:35357/v2.0')
|
||||
is_expected.to contain_nova_config('ironic/admin_tenant_name').with_value('services2')
|
||||
is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://10.0.0.10:6385/v1')
|
||||
is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('ironic.FoobarDriver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with deprecated parameters' do
|
||||
|
|
|
@ -58,10 +58,12 @@ describe 'nova::compute::libvirt' do
|
|||
:remove_unused_kernels => true,
|
||||
:remove_unused_resized_minimum_age_seconds => 3600,
|
||||
:remove_unused_original_minimum_age_seconds => 3600,
|
||||
:libvirt_service_name => 'custom_service'
|
||||
:libvirt_service_name => 'custom_service',
|
||||
:compute_driver => 'libvirt.FoobarDriver',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.FoobarDriver')}
|
||||
it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('qemu')}
|
||||
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')}
|
||||
it { is_expected.to contain_nova_config('libvirt/disk_cachemodes').with_value('file=directsync,block=none')}
|
||||
|
|
|
@ -14,7 +14,8 @@ describe 'nova::compute::vmware' do
|
|||
:maximum_objects => 100,
|
||||
:task_poll_interval => 10.5,
|
||||
:use_linked_clone => false,
|
||||
:wsdl_location => 'http://127.0.0.1:8080/vmware/SDK/wsdl/vim25/vimService.wsdl'}
|
||||
:wsdl_location => 'http://127.0.0.1:8080/vmware/SDK/wsdl/vim25/vimService.wsdl',
|
||||
:compute_driver => 'vmwareapi.FoobarDriver' }
|
||||
end
|
||||
|
||||
it 'configures vmwareapi in nova.conf' do
|
||||
|
@ -42,6 +43,7 @@ describe 'nova::compute::vmware' do
|
|||
end
|
||||
|
||||
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])
|
||||
|
|
|
@ -26,4 +26,14 @@ describe 'nova::compute::xenserver' do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with overridden parameters' do
|
||||
before do
|
||||
params.merge!({:compute_driver => 'xenapi.FoobarDriver'})
|
||||
end
|
||||
|
||||
it 'configures xenapi in nova.conf' do
|
||||
is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('xenapi.FoobarDriver')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue