neutron.pp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. include ::nova::deps
  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. nova_config {
  27. 'libvirt/vif_driver': value => $libvirt_vif_driver;
  28. }
  29. if $libvirt_vif_driver == 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' and $force_snat_range {
  30. # Validate ip and mask for force_snat_range
  31. $force_snat_range_array = split($force_snat_range, '/')
  32. if is_ip_address($force_snat_range_array[0]) and is_integer($force_snat_range_array[1]) {
  33. nova_config {
  34. 'DEFAULT/force_snat_range': value => $force_snat_range;
  35. }
  36. } else {
  37. fail('force_snat_range should be IPv4 or IPv6 CIDR notation')
  38. }
  39. } else {
  40. nova_config {
  41. 'DEFAULT/force_snat_range': ensure => absent;
  42. }
  43. }
  44. }