Add nameservers (dns) parameters
Implement ability to use dns servers for nova network deployments. dns1: new parameter (first dns server) dns2: add ability to define it (second dns server) Defaults to undef because these dns options are optional Change-Id: Id26c2784178990652197aa9af3fd19d949339d58
This commit is contained in:

committed by
Ivan Berezovskiy

parent
196dce78ad
commit
be84925e32
@@ -27,6 +27,7 @@ Puppet::Type.type(:nova_network).provide(:nova_manage) do
|
||||
{
|
||||
# this needs to be converted from a project name to an id
|
||||
:project => '--project_id',
|
||||
:dns1 => '--dns1',
|
||||
:dns2 => '--dns2',
|
||||
:gateway => '--gateway',
|
||||
:bridge => '--bridge',
|
||||
|
@@ -34,7 +34,12 @@ Puppet::Type.newtype(:nova_network) do
|
||||
newparam(:gateway) do
|
||||
end
|
||||
|
||||
newparam(:dns1) do
|
||||
desc 'first dns server'
|
||||
end
|
||||
|
||||
newparam(:dns2) do
|
||||
desc 'second dns server'
|
||||
end
|
||||
|
||||
newparam(:allowed_start) do
|
||||
|
@@ -31,6 +31,14 @@
|
||||
# (optional) Project that network should be associated with
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*dns1*]
|
||||
# (optional) First DNS server
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*dns2*]
|
||||
# (optional) Second DNS server
|
||||
# Defaults to undef
|
||||
#
|
||||
define nova::manage::network (
|
||||
$network,
|
||||
$label = 'novanetwork',
|
||||
@@ -40,6 +48,8 @@ define nova::manage::network (
|
||||
$project = undef,
|
||||
$allowed_start = undef,
|
||||
$allowed_end = undef,
|
||||
$dns1 = undef,
|
||||
$dns2 = undef
|
||||
) {
|
||||
|
||||
File['/etc/nova/nova.conf'] -> Nova_network[$name]
|
||||
@@ -55,6 +65,8 @@ define nova::manage::network (
|
||||
vlan_start => $vlan_start,
|
||||
allowed_start => $allowed_start,
|
||||
allowed_end => $allowed_end,
|
||||
dns1 => $dns1,
|
||||
dns2 => $dns2,
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -67,7 +67,14 @@
|
||||
# (optional) End of allowed addresses for instances
|
||||
# Defaults to undef
|
||||
#
|
||||
|
||||
# [*dns1*]
|
||||
# (optional) First DNS server
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*dns2*]
|
||||
# (optional) Second DNS server
|
||||
# Defaults to undef
|
||||
#
|
||||
class nova::network(
|
||||
$private_interface = undef,
|
||||
$fixed_range = '10.0.0.0/8',
|
||||
@@ -83,6 +90,8 @@ class nova::network(
|
||||
$install_service = true,
|
||||
$allowed_start = undef,
|
||||
$allowed_end = undef,
|
||||
$dns1 = undef,
|
||||
$dns2 = undef
|
||||
) {
|
||||
|
||||
include ::nova::params
|
||||
@@ -124,6 +133,8 @@ class nova::network(
|
||||
vlan_start => $vlan_start,
|
||||
allowed_start => $allowed_start,
|
||||
allowed_end => $allowed_end,
|
||||
dns1 => $dns1,
|
||||
dns2 => $dns2,
|
||||
}
|
||||
if $floating_range {
|
||||
nova::manage::floating { 'nova-vm-floating':
|
||||
|
@@ -199,6 +199,26 @@ describe 'nova::network' do
|
||||
'ensure' => '2012.1-2'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when creating network with nameservers' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
{
|
||||
:create_networks => true,
|
||||
:dns1 => '8.8.8.8',
|
||||
:dns2 => '8.8.4.4'
|
||||
}
|
||||
)
|
||||
end
|
||||
it { is_expected.to contain_class('nova::network').with(
|
||||
:dns1 => '8.8.8.8',
|
||||
:dns2 => '8.8.4.4'
|
||||
) }
|
||||
it { is_expected.to contain_nova__manage__network('nova-vm-net').with(
|
||||
:dns1 => '8.8.8.8',
|
||||
:dns2 => '8.8.4.4'
|
||||
) }
|
||||
end
|
||||
end
|
||||
describe 'on rhel' do
|
||||
let :facts do
|
||||
|
Reference in New Issue
Block a user