From 6764986b46155487c6bac9be9f28a85417786c26 Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Mon, 8 Jul 2013 15:06:11 +0000 Subject: [PATCH] Add Quantum API configuration --- manifests/init.pp | 2 ++ manifests/params.pp | 14 ++++++++++ manifests/quantum/config.pp | 56 +++++++++++++++++++++++++++++++++++++ manifests/quantum/server.pp | 15 ++++++++++ 4 files changed, 87 insertions(+) create mode 100644 manifests/quantum/config.pp create mode 100644 manifests/quantum/server.pp diff --git a/manifests/init.pp b/manifests/init.pp index 28e1817..a23d39f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -38,6 +38,8 @@ class kickstack ( $cinder_lvm_vg = $kickstack::params::cinder_lvm_vg, $cinder_rbd_pool = $kickstack::params::cinder_rbd_pool, $cinder_rbd_user = $kickstack::params::cinder_rbd_user, + $quantum_network_type = $kickstack::params::quantum_network_type, + $quantum_plugin = $kickstack::params::quantum_plugin, ) inherits kickstack::params { include exportfact diff --git a/manifests/params.pp b/manifests/params.pp index b4dc632..ad59d7b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -90,4 +90,18 @@ class kickstack::params { # The RADOS user to use for volumes. Ignored unless $cinder_backend==rbd. $cinder_rbd_user = pick(getvar("::${variable_prefix}cinder_rbd_pool"),"cinder") + + # The network type to configure for Quantum. + # See http://docs.openstack.org/grizzly/openstack-network/admin/content/use_cases.html + # Supported: + # single-flat (default) + # provider-router + # per-tenant-router + $quantum_network_type = pick(getvar("::${variable_prefix}quantum_network_type"),"single-flat") + + # The plugin to use with Quantum. + # Supported: + # linuxbridge + # ovs (default) + $quantum_plugin = pick(getvar("::${variable_prefix}quantum_plugin"),"ovs") } diff --git a/manifests/quantum/config.pp b/manifests/quantum/config.pp new file mode 100644 index 0000000..7368463 --- /dev/null +++ b/manifests/quantum/config.pp @@ -0,0 +1,56 @@ +class kickstack::quantum::config inherits kickstack { + + $allow_overlapping_ips = "$::kickstack::quantum_network_type" ? { + 'single-flat' => false, + 'provider-router' => false, + 'per-tenant-router' => true, + } + + $core_plugin = "$::kickstack::quantum_plugin" ? { + 'ovs' => 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2', + 'linuxbridge'=> 'quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2' + } + + case "$::kickstack::rpc" { + "rabbitmq": { + $rabbit_host = getvar("${fact_prefix}rabbit_host") + $rabbit_password = getvar("${fact_prefix}rabbit_password") + if $rabbit_host and $rabbit_password { + class { 'quantum': + rpc_backend => 'quantum.openstack.common.rpc.impl_kombu', + rabbit_host => "$rabbit_host", + rabbit_virtual_host => "$::kickstack::rabbit_virtual_host", + rabbit_user => "$::kickstack::rabbit_userid", + rabbit_password => $rabbit_password, + verbose => $::kickstack::verbose, + debug => $::kickstack::debug, + allow_overlapping_ips => $allow_overlapping_ips, + core_plugin => $core_plugin, + } + } + else { + warning("Facts ${fact_prefix}rabbit_host or ${fact_prefix}rabbit_password unset, cannot configure quantum") + } + } + "qpid": { + $qpid_hostname = getvar("${fact_prefix}qpid_hostname") + $qpid_password = getvar("${fact_prefix}rabbit_password") + if $qpid_hostname and $qpid_password { + class { 'quantum': + rpc_backend => 'quantum.openstack.common.rpc.impl_qpid', + qpid_hostname => "$qpid_hostname", + qpid_realm => "$::kickstack::qpid_realm", + qpid_username => "$::kickstack::qpid_username", + qpid_password => $qpid_password, + verbose => $::kickstack::verbose, + debug => $::kickstack::debug, + allow_overlapping_ips => $allow_overlapping_ips, + core_plugin => $core_plugin, + } + } + else { + warning("Facts ${fact_prefix}qpid_hostname or ${fact_prefix}qpid_password unset, cannot configure quantum") + } + } + } +} diff --git a/manifests/quantum/server.pp b/manifests/quantum/server.pp new file mode 100644 index 0000000..bc2b981 --- /dev/null +++ b/manifests/quantum/server.pp @@ -0,0 +1,15 @@ +class kickstack::quantum::server inherits kickstack { + + include kickstack::quantum::config + + $service_password = getvar("${fact_prefix}quantum_keystone_password") + $keystone_internal_address = getvar("${fact_prefix}keystone_internal_address") + + class { '::quantum::server': + auth_tenant => $kickstack::keystone_service_tenant, + auth_user => 'quantum', + auth_password => $service_password, + auth_host => $keystone_internal_address + } + +}