try again, with puppetforge modules, correctly included now
[mirror/dsa-puppet.git] / 3rdparty / modules / nova / manifests / compute / neutron.pp
1 # == Class: nova::compute::neutron
2 #
3 # Manage the network driver to use for compute guests
4 # This will use virtio for VM guests and the
5 # specified driver for the VIF
6 #
7 # === Parameters
8 #
9 # [*libvirt_vif_driver*]
10 #   (optional) The libvirt VIF driver to configure the VIFs.
11 #   Defaults to 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'.
12 #
13 # [*force_snat_range*]
14 #  (optional) Force SNAT rule to specified network for nova-network
15 #  Default to 0.0.0.0/0
16 #  Due to architecture constraints in nova_config, it's not possible to setup
17 #  more than one SNAT rule though initial parameter is MultiStrOpt
18 class nova::compute::neutron (
19   $libvirt_vif_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver',
20   $force_snat_range   = '0.0.0.0/0',
21 ) {
22
23   if $libvirt_vif_driver == 'nova.virt.libvirt.vif.LibvirtOpenVswitchDriver' {
24     fail('nova.virt.libvirt.vif.LibvirtOpenVswitchDriver as vif_driver is removed from Icehouse')
25   }
26
27   nova_config {
28     'libvirt/vif_driver': value => $libvirt_vif_driver;
29   }
30
31   if $libvirt_vif_driver == 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' and $force_snat_range {
32     # Validate ip and mask for force_snat_range
33     $force_snat_range_array = split($force_snat_range, '/')
34     if is_ip_address($force_snat_range_array[0]) and is_integer($force_snat_range_array[1])  {
35       nova_config {
36         'DEFAULT/force_snat_range': value => $force_snat_range;
37       }
38     } else {
39       fail('force_snat_range should be IPv4 or IPv6 CIDR notation')
40     }
41   } else {
42     nova_config {
43       'DEFAULT/force_snat_range': ensure => absent;
44     }
45   }
46
47 }