Make multi_host configurable, add support for the nrpe-external-master subordinate.
Add workaround for when the mon_hosts relation returns host names and not IP addresses.
This commit is contained in:
parent
7297fd44a4
commit
29770073b2
14
config.yaml
14
config.yaml
@ -38,6 +38,10 @@ options:
|
|||||||
default: kvm
|
default: kvm
|
||||||
type: string
|
type: string
|
||||||
description: "Virtualization flavor. Supported: kvm, xen, uml, lxc. qemu"
|
description: "Virtualization flavor. Supported: kvm, xen, uml, lxc. qemu"
|
||||||
|
multi-host:
|
||||||
|
default: "yes"
|
||||||
|
type: string
|
||||||
|
description: Whether to run nova-api and nova-network on the compute nodes.
|
||||||
# needed if using flatmanager
|
# needed if using flatmanager
|
||||||
bridge-interface:
|
bridge-interface:
|
||||||
default: br100
|
default: br100
|
||||||
@ -60,3 +64,13 @@ options:
|
|||||||
default: None
|
default: None
|
||||||
type: string
|
type: string
|
||||||
description: Comma separated list of key=value config flags to be set in nova.conf.
|
description: Comma separated list of key=value config flags to be set in nova.conf.
|
||||||
|
nagios_context:
|
||||||
|
default: "juju"
|
||||||
|
type: string
|
||||||
|
description: |
|
||||||
|
Used by the nrpe-external-master subordinate charm.
|
||||||
|
A string that will be prepended to instance name to set the host name
|
||||||
|
in nagios. So for instance the hostname would be something like:
|
||||||
|
juju-myservice-0
|
||||||
|
If you're running multiple environments with the same services in them
|
||||||
|
this allows you to differentiate between them.
|
||||||
|
@ -7,6 +7,7 @@ CONF_DIR="/etc/nova"
|
|||||||
NOVA_CONF=$(config-get nova-config)
|
NOVA_CONF=$(config-get nova-config)
|
||||||
API_CONF="/etc/nova/api-paste.ini"
|
API_CONF="/etc/nova/api-paste.ini"
|
||||||
QUANTUM_CONF="/etc/quantum/quantum.conf"
|
QUANTUM_CONF="/etc/quantum/quantum.conf"
|
||||||
|
MULTI_HOST=$(config-get multi-host)
|
||||||
|
|
||||||
if [ -f /etc/nova/nm.conf ]; then
|
if [ -f /etc/nova/nm.conf ]; then
|
||||||
NET_MANAGER=$(cat /etc/nova/nm.conf)
|
NET_MANAGER=$(cat /etc/nova/nm.conf)
|
||||||
@ -28,7 +29,9 @@ case $NET_MANAGER in
|
|||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"FlatManager"|"FlatDHCPManager")
|
"FlatManager"|"FlatDHCPManager")
|
||||||
|
if [[ "$MULTI_HOST" == "yes" ]] ; then
|
||||||
SERVICES="$SERVICES nova-api nova-network"
|
SERVICES="$SERVICES nova-api nova-network"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -102,8 +105,10 @@ function configure_network_manager {
|
|||||||
|
|
||||||
case $net_manager in
|
case $net_manager in
|
||||||
"FlatManager"|"FlatDHCPManager")
|
"FlatManager"|"FlatDHCPManager")
|
||||||
|
if [[ "$MULTI_HOST" == "yes" ]] ; then
|
||||||
apt-get -y install nova-api nova-network
|
apt-get -y install nova-api nova-network
|
||||||
SERVICES="$SERVICES nova-api nova-network"
|
SERVICES="$SERVICES nova-api nova-network"
|
||||||
|
fi
|
||||||
;;&
|
;;&
|
||||||
"FlatManager")
|
"FlatManager")
|
||||||
local bridge_ip=$(config-get bridge-ip)
|
local bridge_ip=$(config-get bridge-ip)
|
||||||
@ -177,3 +182,30 @@ cgroup_device_acl = [
|
|||||||
EOF
|
EOF
|
||||||
service libvirt-bin reload
|
service libvirt-bin reload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function give_me_numbers {
|
||||||
|
local name="$1"
|
||||||
|
local address=
|
||||||
|
|
||||||
|
case "$name" in
|
||||||
|
[A-Za-z]*)
|
||||||
|
address=$(getent hosts "$name" | awk '{print $1}')
|
||||||
|
case "$address" in
|
||||||
|
127.*)
|
||||||
|
address=$(dig +short "$name")
|
||||||
|
if [ -z "$address" ]; then
|
||||||
|
echo "$name"
|
||||||
|
fi
|
||||||
|
echo "$address"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$address"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# not a name, maybe it's an address?
|
||||||
|
echo "$name"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
@ -9,6 +9,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
function install_hook {
|
function install_hook {
|
||||||
|
[ -d exec.d ] && ( for f in exec.d/*/charm-pre-install; do [ -x $f ] && /bin/sh -c "$f";done )
|
||||||
local virt_type=$(config-get virt-type)
|
local virt_type=$(config-get virt-type)
|
||||||
local compute_pkg=$(determine_compute_package "$virt_type")
|
local compute_pkg=$(determine_compute_package "$virt_type")
|
||||||
apt-get -y install python-software-properties || exit 1
|
apt-get -y install python-software-properties || exit 1
|
||||||
@ -20,6 +21,10 @@ function install_hook {
|
|||||||
configure_libvirt
|
configure_libvirt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function upgrade_hook {
|
||||||
|
[ -d exec.d ] && ( for f in exec.d/*/charm-pre-install; do [ -x $f ] && /bin/sh -c "$f";done )
|
||||||
|
}
|
||||||
|
|
||||||
function config_changed() {
|
function config_changed() {
|
||||||
|
|
||||||
# Determine whether or not we should do an upgrade, based on whether or not
|
# Determine whether or not we should do an upgrade, based on whether or not
|
||||||
@ -203,7 +208,7 @@ function ceph_changed {
|
|||||||
MONS=`relation-list`
|
MONS=`relation-list`
|
||||||
mon_hosts=""
|
mon_hosts=""
|
||||||
for mon in $MONS; do
|
for mon in $MONS; do
|
||||||
mon_hosts="$mon_hosts `relation-get private-address $mon`:6789"
|
mon_hosts="$mon_hosts $(give_me_numbers $(relation-get private-address $mon)):6789"
|
||||||
done
|
done
|
||||||
cat > /etc/ceph/ceph.conf << EOF
|
cat > /etc/ceph/ceph.conf << EOF
|
||||||
[global]
|
[global]
|
||||||
@ -234,6 +239,7 @@ EOF
|
|||||||
|
|
||||||
case $ARG0 in
|
case $ARG0 in
|
||||||
"install") install_hook ;;
|
"install") install_hook ;;
|
||||||
|
"upgrade-charm") upgrade_hook ;;
|
||||||
"start"|"stop") exit 0 ;;
|
"start"|"stop") exit 0 ;;
|
||||||
"config-changed") config_changed ;;
|
"config-changed") config_changed ;;
|
||||||
"amqp-relation-joined") amqp_joined ;;
|
"amqp-relation-joined") amqp_joined ;;
|
||||||
|
@ -8,6 +8,9 @@ description: |
|
|||||||
provides:
|
provides:
|
||||||
cloud-compute:
|
cloud-compute:
|
||||||
interface: nova-compute
|
interface: nova-compute
|
||||||
|
nrpe-external-master:
|
||||||
|
interface: nrpe-external-master
|
||||||
|
scope: container
|
||||||
requires:
|
requires:
|
||||||
shared-db:
|
shared-db:
|
||||||
interface: mysql-shared
|
interface: mysql-shared
|
||||||
|
Loading…
x
Reference in New Issue
Block a user