From 29770073b214667269f947c4e3048089fe40b88d Mon Sep 17 00:00:00 2001 From: "andrew.glen-young@canonical.com" <> Date: Fri, 1 Mar 2013 17:10:38 -0500 Subject: [PATCH 1/3] 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. --- config.yaml | 14 +++++++++++++ hooks/nova-compute-common | 38 +++++++++++++++++++++++++++++++++--- hooks/nova-compute-relations | 8 +++++++- metadata.yaml | 3 +++ 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/config.yaml b/config.yaml index 9ee036c..122eab5 100644 --- a/config.yaml +++ b/config.yaml @@ -38,6 +38,10 @@ options: default: kvm type: string 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 bridge-interface: default: br100 @@ -60,3 +64,13 @@ options: default: None type: string 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. diff --git a/hooks/nova-compute-common b/hooks/nova-compute-common index 2faf19f..2ce0454 100755 --- a/hooks/nova-compute-common +++ b/hooks/nova-compute-common @@ -7,6 +7,7 @@ CONF_DIR="/etc/nova" NOVA_CONF=$(config-get nova-config) API_CONF="/etc/nova/api-paste.ini" QUANTUM_CONF="/etc/quantum/quantum.conf" +MULTI_HOST=$(config-get multi-host) if [ -f /etc/nova/nm.conf ]; then NET_MANAGER=$(cat /etc/nova/nm.conf) @@ -28,7 +29,9 @@ case $NET_MANAGER in esac ;; "FlatManager"|"FlatDHCPManager") - SERVICES="$SERVICES nova-api nova-network" + if [[ "$MULTI_HOST" == "yes" ]] ; then + SERVICES="$SERVICES nova-api nova-network" + fi ;; esac @@ -102,8 +105,10 @@ function configure_network_manager { case $net_manager in "FlatManager"|"FlatDHCPManager") - apt-get -y install nova-api nova-network - SERVICES="$SERVICES nova-api nova-network" + if [[ "$MULTI_HOST" == "yes" ]] ; then + apt-get -y install nova-api nova-network + SERVICES="$SERVICES nova-api nova-network" + fi ;;& "FlatManager") local bridge_ip=$(config-get bridge-ip) @@ -177,3 +182,30 @@ cgroup_device_acl = [ EOF 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 +} diff --git a/hooks/nova-compute-relations b/hooks/nova-compute-relations index 976bc9b..a1c449c 100755 --- a/hooks/nova-compute-relations +++ b/hooks/nova-compute-relations @@ -9,6 +9,7 @@ else fi 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 compute_pkg=$(determine_compute_package "$virt_type") apt-get -y install python-software-properties || exit 1 @@ -20,6 +21,10 @@ function install_hook { 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() { # Determine whether or not we should do an upgrade, based on whether or not @@ -203,7 +208,7 @@ function ceph_changed { MONS=`relation-list` mon_hosts="" 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 cat > /etc/ceph/ceph.conf << EOF [global] @@ -234,6 +239,7 @@ EOF case $ARG0 in "install") install_hook ;; + "upgrade-charm") upgrade_hook ;; "start"|"stop") exit 0 ;; "config-changed") config_changed ;; "amqp-relation-joined") amqp_joined ;; diff --git a/metadata.yaml b/metadata.yaml index ef7235b..4542120 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -8,6 +8,9 @@ description: | provides: cloud-compute: interface: nova-compute + nrpe-external-master: + interface: nrpe-external-master + scope: container requires: shared-db: interface: mysql-shared From e42c1eda15c29b1633a2d7e0e459fc4c22841f87 Mon Sep 17 00:00:00 2001 From: "andrew.glen-young@canonical.com" <> Date: Mon, 4 Mar 2013 14:58:18 -0500 Subject: [PATCH 2/3] Use get_ip function in place of give_me_numbers. Remove give_me_numbers as it is no longer needed. --- hooks/nova-compute-common | 27 --------------------------- hooks/nova-compute-relations | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/hooks/nova-compute-common b/hooks/nova-compute-common index 2ce0454..0126bd2 100755 --- a/hooks/nova-compute-common +++ b/hooks/nova-compute-common @@ -182,30 +182,3 @@ cgroup_device_acl = [ EOF 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 -} diff --git a/hooks/nova-compute-relations b/hooks/nova-compute-relations index a1c449c..e0a0fef 100755 --- a/hooks/nova-compute-relations +++ b/hooks/nova-compute-relations @@ -208,7 +208,7 @@ function ceph_changed { MONS=`relation-list` mon_hosts="" for mon in $MONS; do - mon_hosts="$mon_hosts $(give_me_numbers $(relation-get private-address $mon)):6789" + mon_hosts="$mon_hosts $(get_ip $(relation-get private-address $mon)):6789" done cat > /etc/ceph/ceph.conf << EOF [global] From cc3995e02dd23c986a600c696fa4a2170b2b5c54 Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Thu, 25 Apr 2013 20:22:48 -0400 Subject: [PATCH 3/3] Added icon.svg --- icon.svg | 769 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 769 insertions(+) create mode 100644 icon.svg diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..e88ea62 --- /dev/null +++ b/icon.svg @@ -0,0 +1,769 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +