Skip to content

Commit 35f2526

Browse files
committed
Add RabbitMQ as option for Qpid
Adds the rabbitmq puppet module and configures all the plugins to use it. Change-Id: I5e25ec75689aaf63b8c3938fbe845785b964b7fb
1 parent e34b032 commit 35f2526

34 files changed

+386
-253
lines changed

packstack/modules/shortcuts.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
def get_mq(config, plugin):
5+
return plugin + "_%s.pp" % config.get('CONFIG_AMQP_SERVER')

packstack/plugins/qpid_002.py renamed to packstack/plugins/amqp_002.py

Lines changed: 91 additions & 92 deletions
Large diffs are not rendered by default.

packstack/plugins/ceilometer_800.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from packstack.installer import utils
1212
from packstack.installer import validators
13+
from packstack.modules.shortcuts import get_mq
1314
from packstack.modules.ospluginutils import (getManifestTemplate,
1415
appendManifestFile)
1516

@@ -93,7 +94,8 @@ def initSequences(controller):
9394

9495
def create_manifest(config):
9596
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CEILOMETER_HOST']
96-
manifestdata = getManifestTemplate("ceilometer.pp")
97+
manifestdata = getManifestTemplate(get_mq(config, "ceilometer"))
98+
manifestdata += getManifestTemplate("ceilometer.pp")
9799
config['FIREWALL_ALLOWED'] = "'ALL'"
98100
config['FIREWALL_SERVICE_NAME'] = 'ceilometer-api'
99101
config['FIREWALL_PORTS'] = "'8777'"

packstack/plugins/cinder_250.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from packstack.installer import basedefs
1616
from packstack.installer import utils
1717

18+
from packstack.modules.shortcuts import get_mq
1819
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
1920
from packstack.installer import exceptions
2021
from packstack.installer import output_messages
@@ -355,8 +356,9 @@ def create_keystone_manifest(config):
355356

356357

357358
def create_manifest(config):
359+
manifestdata = getManifestTemplate(get_mq(config, "cinder"))
358360
manifestfile = "%s_cinder.pp" % controller.CONF['CONFIG_CINDER_HOST']
359-
manifestdata = getManifestTemplate("cinder.pp")
361+
manifestdata += getManifestTemplate("cinder.pp")
360362

361363
if config['CONFIG_CINDER_BACKEND'] == "gluster":
362364
manifestdata += getManifestTemplate("cinder_gluster.pp")

packstack/plugins/glance_200.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from packstack.installer import utils
1111
from packstack.installer.utils import split_hosts
1212

13+
from packstack.modules.shortcuts import get_mq
1314
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
1415

1516
# Controller object will be initialized from main flow
@@ -97,7 +98,8 @@ def createmanifest(config):
9798
manifestfile = "%s_glance.pp" % controller.CONF['CONFIG_GLANCE_HOST']
9899
manifestdata = getManifestTemplate("glance.pp")
99100
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
100-
manifestdata += getManifestTemplate('glance_ceilometer.pp')
101+
manifestdata += getManifestTemplate(get_mq(config, "glance_ceilometer"))
102+
101103
hosts = set()
102104
if config['CONFIG_NOVA_INSTALL'] == 'y':
103105
hosts = split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS'])

packstack/plugins/heat_750.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from packstack.installer import utils
1010
from packstack.installer import validators
1111

12+
from packstack.modules.shortcuts import get_mq
1213
from packstack.modules.ospluginutils import (getManifestTemplate,
1314
manifestfiles,
1415
appendManifestFile)
@@ -190,7 +191,8 @@ def create_manifest(config):
190191
config['CONFIG_HEAT_METADATA_HOST'] = config['CONFIG_HEAT_HOST']
191192

192193
manifestfile = "%s_heat.pp" % controller.CONF['CONFIG_HEAT_HOST']
193-
manifestdata = getManifestTemplate("heat.pp")
194+
manifestdata = getManifestTemplate(get_mq(config, "heat"))
195+
manifestdata += getManifestTemplate("heat.pp")
194196
appendManifestFile(manifestfile, manifestdata)
195197

196198

packstack/plugins/neutron_350.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from packstack.installer import validators
1212
from packstack.installer.utils import split_hosts
1313

14+
from packstack.modules.shortcuts import get_mq
1415
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
1516

1617
# Controller object will be initialized from main flow
@@ -482,11 +483,8 @@ def use_openvswitch_agent_tunnel(config):
482483
return use_openvswitch_plugin_tunnel(config) or use_ml2_with_ovs(config)
483484

484485
def use_openvswitch_vxlan(config):
485-
return ((use_openvswitch_plugin_tunnel(config) and
486-
config['CONFIG_NEUTRON_OVS_TENANT_NETWORK_TYPE'] == 'vxlan')
487-
or
488-
(use_ml2_with_ovs(config) and
489-
'vxlan' in config['CONFIG_NEUTRON_ML2_TYPE_DRIVERS']))
486+
return (use_openvswitch_plugin_tunnel(config) and
487+
config['CONFIG_NEUTRON_OVS_TENANT_NETWORK_TYPE'] == 'vxlan')
490488

491489

492490
conf_groups = [
@@ -643,6 +641,7 @@ def create_manifests(config):
643641
for host in q_hosts:
644642
manifest_file = "%s_neutron.pp" % (host,)
645643
manifest_data = getManifestTemplate("neutron.pp")
644+
manifest_data += getManifestTemplate(get_mq(config, "neutron"))
646645
appendManifestFile(manifest_file, manifest_data, 'neutron')
647646

648647
if host in api_hosts:

packstack/plugins/nova_300.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from packstack.installer import processors, utils, validators
1111
from packstack.installer.exceptions import ScriptRuntimeError
1212

13+
from packstack.modules.shortcuts import get_mq
1314
from packstack.modules.ospluginutils import NovaConfig, getManifestTemplate, appendManifestFile, manifestfiles
1415

1516
# Controller object will be initialized from main flow
@@ -465,7 +466,7 @@ def createcomputemanifest(config):
465466
controller.MESSAGES.append(str(ex))
466467

467468
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
468-
manifestdata += getManifestTemplate("nova_ceilometer.pp")
469+
manifestdata += getManifestTemplate(get_mq(config, "nova_ceilometer"))
469470

470471
# According to the docs the only element that connects directly to nova compute
471472
# is nova scheduler
@@ -567,7 +568,8 @@ def createcommonmanifest(config):
567568
metadata = config['CONFIG_NOVA_API_HOST']
568569
config['CONFIG_NOVA_METADATA_HOST'] = metadata
569570

570-
data = getManifestTemplate("nova_common.pp")
571+
data = getManifestTemplate(get_mq(config, "nova_common"))
572+
data += getManifestTemplate("nova_common.pp")
571573
appendManifestFile(os.path.split(manifestfile)[1], data)
572574

573575

packstack/plugins/puppet_950.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def copyPuppetModules(config):
8585
'concat', 'firewall', 'glance', 'heat', 'horizon',
8686
'inifile', 'keystone', 'memcached', 'mongodb',
8787
'mysql', 'neutron', 'nova', 'nssdb', 'openstack',
88-
'packstack', 'qpid', 'rsync', 'ssh', 'stdlib',
88+
'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh', 'stdlib',
8989
'swift', 'sysctl', 'tempest', 'vcsrepo', 'vlan',
9090
'vswitch', 'xinetd'))
9191

packstack/puppet/templates/amqp.pp

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
$amqp = '%(CONFIG_AMQP_SERVER)s'
2+
case $amqp {
3+
'qpid': {
4+
enable_qpid {"qpid":
5+
enable_ssl => %(CONFIG_AMQP_ENABLE_SSL)s,
6+
enable_auth => '%(CONFIG_AMQP_ENABLE_AUTH)s',
7+
}
8+
}
9+
'rabbitmq': {
10+
enable_rabbitmq {"rabbitmq":}
11+
12+
}
13+
}
14+
15+
16+
define enable_rabbitmq {
17+
package { "erlang":
18+
ensure => "installed"
19+
}
20+
21+
class {"rabbitmq":
22+
port => '%(CONFIG_AMQP_CLIENTS_PORT)s',
23+
ssl_management_port => '%(CONFIG_AMQP_SSL_PORT)s',
24+
ssl => %(CONFIG_AMQP_ENABLE_SSL)s,
25+
ssl_cert => '%(CONFIG_AMQP_SSL_CERT_FILE)s',
26+
ssl_key => '%(CONFIG_AMQP_SSL_KEY_FILE)s',
27+
default_user => '%(CONFIG_AMQP_AUTH_USER)s',
28+
default_pass => '%(CONFIG_AMQP_AUTH_PASSWORD)s',
29+
package_provider => 'yum',
30+
admin_enable => false,
31+
}
32+
33+
Package['erlang']->Class['rabbitmq']
34+
}
35+
36+
define enable_qpid($enable_ssl = 'n', $enable_auth = 'n') {
37+
38+
class {"qpid::server":
39+
config_file => $::operatingsystem? {
40+
'Fedora' => '/etc/qpid/qpidd.conf',
41+
default => '/etc/qpidd.conf',
42+
},
43+
auth => $enable_auth ? {
44+
'y' => 'yes',
45+
default => 'no',
46+
},
47+
clustered => false,
48+
ssl_port => '%(CONFIG_AMQP_SSL_PORT)s',
49+
ssl => %(CONFIG_AMQP_ENABLE_SSL)s,
50+
ssl_cert => '%(CONFIG_AMQP_SSL_CERT_FILE)s',
51+
ssl_key => '%(CONFIG_AMQP_SSL_KEY_FILE)s',
52+
ssl_database_password => '%(CONFIG_AMQP_NSS_CERTDB_PW)s',
53+
}
54+
55+
if $enable_ssl {
56+
enable_qpid_ssl {"qpid":}
57+
}
58+
if $enable_auth == 'y' {
59+
add_qpid_user {"qpid_user":}
60+
}
61+
62+
}
63+
64+
define enable_qpid_ssl {
65+
# User and group for the nss database
66+
group { 'qpidd':
67+
ensure => 'present',
68+
}
69+
70+
exec { 'stop_qpid' :
71+
command => '/sbin/service qpidd stop',
72+
onlyif => '/sbin/service qpidd status',
73+
}
74+
75+
user { 'qpidd':
76+
ensure => 'present',
77+
managehome => true,
78+
home => '/var/run/qpidd',
79+
gid => 'qpidd',
80+
before => Class['qpid::server']
81+
}
82+
83+
Exec['stop_qpid']->User['qpidd']
84+
85+
file { 'pid_dir':
86+
path => '/var/run/qpidd',
87+
ensure => directory,
88+
owner => 'qpidd',
89+
group => 'qpidd',
90+
require => User['qpidd'],
91+
}
92+
93+
file_line { 'pid_dir_conf':
94+
path => $qpid::server::config_file,
95+
line => 'pid-dir=/var/run/qpidd',
96+
require => File['pid_dir'],
97+
}
98+
}
99+
100+
define add_qpid_user {
101+
qpid_user { '%(CONFIG_AMQP_AUTH_USER)s':
102+
password => '%(CONFIG_AMQP_AUTH_PASSWORD)s',
103+
file => '/var/lib/qpidd/qpidd.sasldb',
104+
realm => 'AMQP',
105+
provider => 'saslpasswd2',
106+
require => Class['qpid::server'],
107+
}
108+
109+
file { 'sasldb_file':
110+
path => '/var/lib/qpidd/qpidd.sasldb',
111+
ensure => file,
112+
owner => 'qpidd',
113+
group => 'qpidd',
114+
}
115+
}

0 commit comments

Comments
 (0)