Remove Class nova::network
nova-network is deprecated in Newton and will be removed in the future. Change-Id: I96bce988c5a4c1750d5142911bd5261bd3277796
This commit is contained in:
parent
c60b1b3534
commit
774e97bde7
@ -1,210 +0,0 @@
|
||||
# == Class: nova::network
|
||||
#
|
||||
# Manages nova-network.
|
||||
#
|
||||
# An OpenStack deployment that includes compute and networking will use either
|
||||
# nova-network or Neutron. Neutron is newer and nova-network is the legacy
|
||||
# networking support built directly into Nova. However, nova-network is still
|
||||
# fully supported, is not feature frozen, and is not yet officially deprecated.
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*private_interface*]
|
||||
# (optional) Interface used by private network.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*fixed_range*]
|
||||
# (optional) Fixed private network range.
|
||||
# Defaults to '10.0.0.0/8'
|
||||
#
|
||||
# [*public_interface*]
|
||||
# (optional) Interface used to connect vms to public network.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*num_networks*]
|
||||
# (optional) Number of networks that fixed range network should be
|
||||
# split into.
|
||||
# Defaults to 1
|
||||
#
|
||||
# [*network_size*]
|
||||
# (optional) Number of addresses in each private subnet.
|
||||
# Defaults to 255
|
||||
#
|
||||
# [*floating_range*]
|
||||
# (optional) Range of floating ip addresses to create.
|
||||
# Defaults to false
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Whether the network service should be enabled.
|
||||
# Defaults to true
|
||||
#
|
||||
# [*network_manager*]
|
||||
# (optional) The type of network manager to use.
|
||||
# Defaults to 'nova.network.manager.FlatDHCPManager'
|
||||
#
|
||||
# [*config_overrides*]
|
||||
# (optional) Additional parameters to pass to the network manager class
|
||||
# Defaults to {}
|
||||
#
|
||||
# [*create_networks*]
|
||||
# (optional) Whether actual nova networks should be created using
|
||||
# the fixed and floating ranges provided.
|
||||
# Defaults to true
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) The state of the nova network package
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*install_service*]
|
||||
# (optional) Whether to install and enable the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*allowed_start*]
|
||||
# (optional) Start of allowed addresses for instances
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*allowed_end*]
|
||||
# (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
|
||||
#
|
||||
# [*multi_host*]
|
||||
# (optional) Default value for multi_host in networks.
|
||||
# Also, if set, some rpc network calls will be sent directly to host.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*auto_assign_floating_ip*]
|
||||
# (optional) Autoassigning floating IP to VM
|
||||
# Defaults to false.
|
||||
#
|
||||
class nova::network(
|
||||
$private_interface = undef,
|
||||
$fixed_range = '10.0.0.0/8',
|
||||
$public_interface = undef,
|
||||
$num_networks = 1,
|
||||
$network_size = 255,
|
||||
$floating_range = false,
|
||||
$enabled = true,
|
||||
$network_manager = 'nova.network.manager.FlatDHCPManager',
|
||||
$config_overrides = {},
|
||||
$create_networks = true,
|
||||
$ensure_package = 'present',
|
||||
$install_service = true,
|
||||
$allowed_start = undef,
|
||||
$allowed_end = undef,
|
||||
$dns1 = undef,
|
||||
$dns2 = undef,
|
||||
$multi_host = false,
|
||||
$auto_assign_floating_ip = false,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
include ::nova::params
|
||||
|
||||
warning('nova-network is deprecated in Newton and will be removed in the future.')
|
||||
|
||||
# forward all ipv4 traffic
|
||||
# this is required for the vms to pass through the gateways
|
||||
# public interface
|
||||
Exec {
|
||||
path => $::path
|
||||
}
|
||||
|
||||
ensure_resource('sysctl::value', 'net.ipv4.ip_forward', { value => '1' })
|
||||
|
||||
if $floating_range {
|
||||
nova_config {
|
||||
'DEFAULT/floating_range': value => $floating_range;
|
||||
'DEFAULT/auto_assign_floating_ip': value => $auto_assign_floating_ip;
|
||||
}
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/multi_host': value => $multi_host;
|
||||
}
|
||||
|
||||
if has_key($config_overrides, 'vlan_start') {
|
||||
$vlan_start = $config_overrides['vlan_start']
|
||||
} else {
|
||||
$vlan_start = undef
|
||||
}
|
||||
|
||||
if $install_service {
|
||||
nova::generic_service { 'network':
|
||||
enabled => $enabled,
|
||||
package_name => $::nova::params::network_package_name,
|
||||
service_name => $::nova::params::network_service_name,
|
||||
ensure_package => $ensure_package,
|
||||
before => Exec['networking-refresh']
|
||||
}
|
||||
|
||||
# because nova_network provider uses nova client, so it assumes
|
||||
# that nova-network service is running already
|
||||
Service<| title == 'nova-network' |> -> Nova_network<| |>
|
||||
if $create_networks {
|
||||
if $enabled {
|
||||
nova::manage::network { 'nova-vm-net':
|
||||
network => $fixed_range,
|
||||
num_networks => $num_networks,
|
||||
network_size => $network_size,
|
||||
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':
|
||||
network => $floating_range,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warning('Can not create networks, when nova-network service is disabled.')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case $network_manager {
|
||||
|
||||
'nova.network.manager.FlatDHCPManager': {
|
||||
# I am not proud of this
|
||||
$parameters = { fixed_range => $fixed_range,
|
||||
public_interface => $public_interface,
|
||||
flat_interface => $private_interface
|
||||
}
|
||||
$resource_parameters = merge($config_overrides, $parameters)
|
||||
$flatdhcp_resource = {'nova::network::flatdhcp' => $resource_parameters }
|
||||
create_resources('class', $flatdhcp_resource)
|
||||
}
|
||||
'nova.network.manager.FlatManager': {
|
||||
$parameters = { fixed_range => $fixed_range,
|
||||
public_interface => $public_interface,
|
||||
flat_interface => $private_interface
|
||||
}
|
||||
$resource_parameters = merge($config_overrides, $parameters)
|
||||
$flat_resource = {'nova::network::flat' => $resource_parameters }
|
||||
create_resources('class', $flat_resource)
|
||||
}
|
||||
'nova.network.manager.VlanManager': {
|
||||
$parameters = { fixed_range => $fixed_range,
|
||||
public_interface => $public_interface,
|
||||
vlan_interface => $private_interface
|
||||
}
|
||||
$resource_parameters = merge($config_overrides, $parameters)
|
||||
$vlan_resource = { 'nova::network::vlan' => $resource_parameters }
|
||||
create_resources('class', $vlan_resource)
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported network manager: ${nova::network_manager} The supported network managers are \
|
||||
nova.network.manager.FlatManager, nova.network.FlatDHCPManager and nova.network.manager.VlanManager")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
upgrade:
|
||||
- Remove Class nova::network
|
||||
nova-network is deprecated in Newton and will be removed in the future.
|
@ -1,246 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::network' do
|
||||
|
||||
let :pre_condition do
|
||||
'include nova'
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
{
|
||||
:private_interface => 'eth1',
|
||||
:fixed_range => '10.0.0.0/32',
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
default_params
|
||||
end
|
||||
|
||||
describe 'on debian platforms' do
|
||||
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'Debian' })
|
||||
end
|
||||
|
||||
it { is_expected.to contain_sysctl__value('net.ipv4.ip_forward').with_value('1') }
|
||||
|
||||
describe 'when installing service' do
|
||||
|
||||
it { is_expected.to contain_package('nova-network').with(
|
||||
'name' => 'nova-network',
|
||||
'ensure' => 'present',
|
||||
'notify' => ['Anchor[nova::install::end]'],
|
||||
) }
|
||||
|
||||
describe 'with enabled as true' do
|
||||
it { is_expected.to contain_service('nova-network').with(
|
||||
'name' => 'nova-network',
|
||||
'ensure' => 'running',
|
||||
'hasstatus' => true,
|
||||
'enable' => true
|
||||
)}
|
||||
end
|
||||
describe 'when enabled is set to false' do
|
||||
let :params do
|
||||
default_params.merge(:enabled => false)
|
||||
end
|
||||
it { is_expected.to contain_service('nova-network').with(
|
||||
'name' => 'nova-network',
|
||||
'ensure' => 'stopped',
|
||||
'hasstatus' => true,
|
||||
'enable' => false
|
||||
)}
|
||||
end
|
||||
end
|
||||
describe 'when not installing service' do
|
||||
|
||||
let :params do
|
||||
default_params.merge(:install_service => false)
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_package('nova-network') }
|
||||
it { is_expected.to_not contain_service('nova-network') }
|
||||
|
||||
end
|
||||
|
||||
describe 'when not creating networks' do
|
||||
let :params do
|
||||
default_params.merge(:create_networks => false)
|
||||
end
|
||||
it { is_expected.to_not contain_nova__manage__network('nova-vm-net') }
|
||||
it { is_expected.to_not contain_nova__manage__floating('nova-vm-floating') }
|
||||
end
|
||||
|
||||
describe 'when creating networks' do
|
||||
it { is_expected.to contain_nova__manage__network('nova-vm-net').with(
|
||||
:network => '10.0.0.0/32',
|
||||
:num_networks => '1'
|
||||
) }
|
||||
it { is_expected.to_not contain__nova__manage__floating('nova-vm-floating') }
|
||||
describe 'when number of networks is set' do
|
||||
let :params do
|
||||
default_params.merge(:num_networks => '2')
|
||||
end
|
||||
it { is_expected.to contain_nova__manage__network('nova-vm-net').with(
|
||||
:num_networks => '2'
|
||||
) }
|
||||
end
|
||||
describe 'when floating range is set' do
|
||||
let :params do
|
||||
default_params.merge(:floating_range => '10.0.0.0/30')
|
||||
end
|
||||
it { is_expected.to contain_nova_config('DEFAULT/floating_range').with_value('10.0.0.0/30') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/auto_assign_floating_ip').with_value('false') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/multi_host').with_value('false') }
|
||||
it { is_expected.to contain_nova__manage__floating('nova-vm-floating').with_network('10.0.0.0/30') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when creating networks, but service nova-network is disabled' do
|
||||
let :params do
|
||||
default_params.merge(:enabled => false)
|
||||
end
|
||||
it { is_expected.to_not contain_nova__manage__network('nova-vm-net') }
|
||||
it { is_expected.to_not contain_nova__manage__floating('nova-vm-floating') }
|
||||
end
|
||||
|
||||
describe 'when configuring networks' do
|
||||
describe 'when configuring flatdhcpmanager' do
|
||||
let :params do
|
||||
default_params.merge(:network_manager => 'nova.network.manager.FlatDHCPManager')
|
||||
end
|
||||
it { is_expected.to contain_class('nova::network::flatdhcp').with(
|
||||
:fixed_range => '10.0.0.0/32',
|
||||
:public_interface => nil,
|
||||
:flat_interface => 'eth1',
|
||||
:flat_network_bridge => 'br100',
|
||||
:force_dhcp_release => true,
|
||||
:flat_injected => false,
|
||||
:dhcp_domain => 'novalocal',
|
||||
:dhcpbridge => '/usr/bin/nova-dhcpbridge',
|
||||
:dhcpbridge_flagfile => '/etc/nova/nova.conf'
|
||||
) }
|
||||
describe 'when overriding parameters' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
{
|
||||
:network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
:public_interface => 'eth0',
|
||||
:config_overrides =>
|
||||
{
|
||||
'flat_network_bridge' => 'br400',
|
||||
'force_dhcp_release' => false,
|
||||
'flat_injected' => true,
|
||||
'dhcp_domain' => 'not-novalocal',
|
||||
'dhcpbridge' => '/tmp/bridge',
|
||||
'dhcpbridge_flagfile' => '/tmp/file',
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
it { is_expected.to contain_class('nova::network::flatdhcp').with(
|
||||
:fixed_range => '10.0.0.0/32',
|
||||
:public_interface => 'eth0',
|
||||
:flat_interface => 'eth1',
|
||||
:flat_network_bridge => 'br400',
|
||||
#:force_dhcp_release => false,
|
||||
:flat_injected => true,
|
||||
:dhcp_domain => 'not-novalocal',
|
||||
:dhcpbridge => '/tmp/bridge',
|
||||
:dhcpbridge_flagfile => '/tmp/file'
|
||||
) }
|
||||
|
||||
end
|
||||
end
|
||||
describe 'when configuring flatmanager' do
|
||||
let :params do
|
||||
default_params.merge(:network_manager => 'nova.network.manager.FlatManager')
|
||||
end
|
||||
it { is_expected.to contain_class('nova::network::flat').with(
|
||||
:fixed_range => '10.0.0.0/32',
|
||||
:public_interface => nil,
|
||||
:flat_interface => 'eth1',
|
||||
:flat_network_bridge => 'br100'
|
||||
) }
|
||||
describe 'when overriding flat network params' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
{
|
||||
:network_manager => 'nova.network.manager.FlatManager',
|
||||
:public_interface => 'eth0',
|
||||
:config_overrides => {'flat_network_bridge' => 'br400' }
|
||||
}
|
||||
)
|
||||
end
|
||||
it { is_expected.to contain_class('nova::network::flat').with(
|
||||
:public_interface => 'eth0',
|
||||
:flat_network_bridge => 'br400'
|
||||
) }
|
||||
end
|
||||
end
|
||||
describe 'when configuring vlan' do
|
||||
let :params do
|
||||
default_params.merge(:network_manager => 'nova.network.manager.VlanManager')
|
||||
end
|
||||
it { is_expected.to contain_class('nova::network::vlan').with(
|
||||
:fixed_range => '10.0.0.0/32',
|
||||
:public_interface => nil,
|
||||
:vlan_interface => 'eth1',
|
||||
:force_dhcp_release => true,
|
||||
:dhcp_domain => 'novalocal',
|
||||
:dhcpbridge => '/usr/bin/nova-dhcpbridge',
|
||||
:dhcpbridge_flagfile => '/etc/nova/nova.conf'
|
||||
) }
|
||||
describe 'when overriding parameters' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
{
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'with package version' do
|
||||
let :params do
|
||||
default_params.merge(:ensure_package => '2012.1-2')
|
||||
end
|
||||
it { is_expected.to contain_package('nova-network').with(
|
||||
'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
|
||||
@default_facts.merge({ :osfamily => 'RedHat' })
|
||||
end
|
||||
it { is_expected.to contain_service('nova-network').with(
|
||||
'name' => 'openstack-nova-network',
|
||||
'ensure' => 'running',
|
||||
'hasstatus' => true,
|
||||
'enable' => true
|
||||
)}
|
||||
it { is_expected.to contain_package('nova-network').with_name('openstack-nova-network') }
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user