Mere from trunk.

This commit is contained in:
Hui Xiang 2014-09-17 22:34:37 +08:00
commit 3f9e05c67e
2 changed files with 92 additions and 79 deletions

View File

@ -3,7 +3,6 @@ options:
type: boolean
default: False
description: enable the management plugin
# SSL Configuration options
ssl:
type: string
@ -25,18 +24,17 @@ options:
ssl_key:
type: string
description: private unencrypted key in base64 PEM format (starts "-----BEGIN RSA PRIVATE KEY-----")
default: ""
default:
ssl_cert:
type: string
description: X.509 certificate in base64 PEM format (starts "-----BEGIN CERTIFICATE-----")
default: ""
default:
ssl_ca:
type: string
description: |
Certificate authority cert that the cert. Optional if the ssl_cert is signed by a ca
recognized by the os. Format is base64 PEM (concatenated certs if needed).
default: ""
default:
nagios_context:
default: "juju"
type: string
@ -49,62 +47,62 @@ options:
this allows you to differentiate between them.
# HA configuration settings
vip:
type: string
description: "Virtual IP to use to front rabbitmq in ha configuration"
default: ""
type: string
description: "Virtual IP to use to front rabbitmq in ha configuration"
default:
vip_iface:
type: string
default: eth0
description: "Network Interface where to place the Virtual IP"
type: string
default: eth0
description: "Network Interface where to place the Virtual IP"
vip_cidr:
type: int
default: 24
description: "Netmask that will be used for the Virtual IP"
type: int
default: 24
description: "Netmask that will be used for the Virtual IP"
ha-bindiface:
type: string
default: eth0
description: |
Default network interface on which HA cluster will bind to communication
with the other members of the HA Cluster.
type: string
default: eth0
description: |
Default network interface on which HA cluster will bind to communication
with the other members of the HA Cluster.
ha-mcastport:
type: int
default: 5406
description: |
Default multicast port number that will be used to communicate between
HA Cluster nodes.
type: int
default: 5406
description: |
Default multicast port number that will be used to communicate between
HA Cluster nodes.
ha-vip-only:
type: boolean
default: False
description: |
By default, without pairing with hacluster charm, rabbitmq will deploy
in active/active/active... HA. When pairied with hacluster charm, it
will deploy as active/passive. By enabling this option, pairing with
hacluster charm will keep rabbit in active/active setup, but in addition
it will deploy a VIP that can be used by services that cannot work
with mutiple AMQPs (like Glance in pre-Icehouse).
type: boolean
default: False
description: |
By default, without pairing with hacluster charm, rabbitmq will deploy
in active/active/active... HA. When pairied with hacluster charm, it
will deploy as active/passive. By enabling this option, pairing with
hacluster charm will keep rabbit in active/active setup, but in addition
it will deploy a VIP that can be used by services that cannot work
with mutiple AMQPs (like Glance in pre-Icehouse).
rbd-size:
type: string
default: 5G
description: |
Default rbd storage size to create when setting up block storage.
This value should be specified in GB (e.g. 100G).
type: string
default: 5G
description: |
Default rbd storage size to create when setting up block storage.
This value should be specified in GB (e.g. 100G).
rbd-name:
type: string
default: rabbitmq1
description: |
The name that will be used to create the Ceph's RBD image with. If the
image name exists in Ceph, it will be re-used and the data will be
overwritten.
type: string
default: rabbitmq1
description: |
The name that will be used to create the Ceph's RBD image with. If the
image name exists in Ceph, it will be re-used and the data will be
overwritten.
ceph-osd-replication-count:
default: 2
type: int
description: |
This value dictates the number of replicas ceph must make of any
object it stores within the rabbitmq rbd pool. Of course, this only
applies if using Ceph as a backend store. Note that once the rabbitmq
rbd pool has been created, changing this value will not have any
effect (although it can be changed in ceph by manually configuring
your ceph cluster).
default: 2
type: int
description: |
This value dictates the number of replicas ceph must make of any
object it stores within the rabbitmq rbd pool. Of course, this only
applies if using Ceph as a backend store. Note that once the rabbitmq
rbd pool has been created, changing this value will not have any
effect (although it can be changed in ceph by manually configuring
your ceph cluster).
use-syslog:
type: boolean
default: False
@ -112,27 +110,29 @@ options:
If True, services that support it will log to syslog instead of their normal
log location.
max-cluster-tries:
type: int
default: 3
description: |
Number of tries to cluster with other units before giving up and throwing
a hook error.
type: int
default: 3
description: |
Number of tries to cluster with other units before giving up and throwing
a hook error.
source:
type: string
description: |
Optional configuration to support use of additional sources such as:
.
- ppa:myteam/ppa
- cloud:precise-proposed/folsom
- http://my.archive.com/ubuntu main
.
The last option should be used in conjunction with the key configuration
option.
type: string
default:
description: |
Optional configuration to support use of additional sources such as:
.
- ppa:myteam/ppa
- cloud:precise-proposed/folsom
- http://my.archive.com/ubuntu main
.
The last option should be used in conjunction with the key configuration
option.
key:
type: string
description: |
Key ID to import to the apt keyring to support use with arbitary source
configuration from outside of Launchpad archives or PPA's.
type: string
default:
description: |
Key ID to import to the apt keyring to support use with arbitary source
configuration from outside of Launchpad archives or PPA's.
prefer-ipv6:
type: boolean
default: False

View File

@ -72,13 +72,13 @@ def install():
# NOTE(jamespage) install actually happens in config_changed hook
def configure_amqp(username, vhost):
def configure_amqp(username, vhost, admin=False):
# get and update service password
password = rabbit.get_rabbit_password(username)
# update vhost
rabbit.create_vhost(vhost)
rabbit.create_user(username, password)
rabbit.create_user(username, password, admin)
rabbit.grant_permissions(username, vhost)
return password
@ -109,7 +109,8 @@ def amqp_changed(relation_id=None, remote_unit=None):
relation_settings['password'] = configure_amqp(
username=settings['username'],
vhost=settings['vhost'])
vhost=settings['vhost'],
admin=settings.get('admin', False))
else:
queues = {}
for k, v in settings.iteritems():
@ -536,6 +537,10 @@ def configure_rabbit_ssl():
open_port(ssl_port)
def restart_rabbit_update_nrpe():
service_restart('rabbitmq-server')
update_nrpe_checks()
@hooks.hook('config-changed')
def config_changed():
# Add archive source if provided
@ -566,11 +571,19 @@ def config_changed():
configure_rabbit_ssl()
if eligible_leader('res_rabbitmq_vip') or \
config('ha-vip-only') is True:
service_restart('rabbitmq-server')
if is_relation_made("ha"):
ha_is_active_active = config("ha-vip-only")
update_nrpe_checks()
if ha_is_active_active:
restart_rabbit_update_nrpe()
else:
if eligible_leader('res_rabbitmq_vip'):
restart_rabbit_update_nrpe()
else:
log("hacluster relation is present but this node is not active"
" skipping update nrpe checks")
else:
restart_rabbit_update_nrpe()
def pre_install_hooks():