Remove redundant relation interfaces.

Removes the cloud-controller and network-controller relations.  All of the
functionality contained in these hooks can be easily condensed into the
cloud-compute/nova-volume-services interfaces.  This simplifies deployment,
avoids redundant and ambigious relations and makes things generally cleaner.
This commit is contained in:
Adam Gandelman 2012-10-12 12:37:13 -07:00
parent d93a1765e5
commit a4c7efdb62
9 changed files with 18 additions and 60 deletions

View File

@ -57,11 +57,17 @@ function configure_network_manager {
function trigger_remote_service_restarts() { function trigger_remote_service_restarts() {
# Trigger a service restart on all other nova nodes that have a relation # Trigger a service restart on all other nova nodes that have a relation
# via the cloud-controller interface. # via the cloud-controller interface.
local r_ids=$(relation-ids cloud-controller)
# possible relations to other nova services.
local relations="cloud-compute nova-volume-service"
for rel in $relations; do
local r_ids=$(relation-ids $rel)
for r_id in $r_ids ; do for r_id in $r_ids ; do
juju-log "$CHARM: Triggering a service restart on relation $r_id." juju-log "$CHARM: Triggering a service restart on relation $r_id."
relation-set -r $r_id restart-trigger=$(uuid) relation-set -r $r_id restart-trigger=$(uuid)
done done
done
} }
do_openstack_upgrade() { do_openstack_upgrade() {

View File

@ -45,19 +45,6 @@ function service_ctl {
done done
} }
function conditional_service_restart {
# restart specified service ($1) if contents of file differ from $2
local svc="$1"
local new_contents="$2"
local file="/var/lib/juju/$CHARM-restart"
if [[ -e "$file" ]] && [[ "$(cat $file)" == "$new_contents" ]] ; then
juju-log "$CHARM: Skipping conditional restart, not needed."
return 0
fi
echo "$new_contents" >$file
service_ctl "$svc" restart
}
function configure_install_source { function configure_install_source {
# Setup and configure installation source based on a config flag. # Setup and configure installation source based on a config flag.
local src="$1" local src="$1"

View File

@ -1 +0,0 @@
nova-cloud-controller-relations

View File

@ -18,13 +18,6 @@ PACKAGES="$SERVICES python-mysqldb python-keystone uuid"
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"
# The specific flavor of volume service that exists (if any) is tracked
# in this file. It's updated by volume-service hooks and used by controller
# hooks to inform backend nova services of how volume service is configured.
VOLUME_SERVICE_FLAG_FILE=/var/lib/juju/volume_service.conf
NETWORK_MANAGER=$(config-get network-manager)
if [[ -e $CHARM_DIR/lib/nova/nova-common ]] ; then if [[ -e $CHARM_DIR/lib/nova/nova-common ]] ; then
. $CHARM_DIR/lib/nova/nova-common . $CHARM_DIR/lib/nova/nova-common
else else

View File

@ -18,16 +18,7 @@ function install_hook {
DEBIAN_FRONTEND=noninteractive apt-get -y \ DEBIAN_FRONTEND=noninteractive apt-get -y \
install --no-install-recommends $PACKAGES || exit 1 install --no-install-recommends $PACKAGES || exit 1
configure_network_manager $NETWORK_MANAGER configure_network_manager $(config-get network-manager)
# # setup osapi extensions required for dashboard
# # these are the required middleware extensions as of 12/20/2011
# extensions="nova.api.openstack.compute.contrib.standard_extensions"
#
# for e in $extensions ; do
# grep -q "^--osapi_compute_extension=$e" "$NOVA_CONF" ||
# echo "--osapi_compute_extension=$e" >>"$NOVA_CONF"
# done
# Configure any flags specified in deployment config # Configure any flags specified in deployment config
set_config_flags set_config_flags
@ -136,16 +127,6 @@ function image-service_changed {
service_ctl all restart service_ctl all restart
} }
function nova-network_joined {
# this will be moved to its own nova-network formula when the
# time comes. for now, tell peer what network manager we are
# using, and let them configure accordingly. we may want to also
# take care of assigning non-conflicting IPs to compute nodes
manager=$(cat $NOVA_CONF | grep network_manager | cut -d= -f2)
manager=$(echo $manager | sed -e 's/\./ /g' | awk '{ print $4 }')
relation-set network_manager=$manager ec2_host=$(unit-get private-address)
}
function keystone_joined { function keystone_joined {
# we need to get two entries into keystone's catalog, nova + ec2 # we need to get two entries into keystone's catalog, nova + ec2
# group, them by prepending $service_ to each setting. the keystone # group, them by prepending $service_ to each setting. the keystone
@ -254,15 +235,11 @@ volume_joined() {
fi fi
} }
volume_changed() { compute_joined() {
# nothing to do here, yet. # Inform remote unit of the network manager we've been configured to use.
exit 0 # nova-compute should configure itself accordingly.
} relation-set network_manager=$(config-get network-manager)
relation-set ec2_host=$(unit-get private-address)
controller_joined() {
# this interface is used primarily trigger events on other nova units.
# it used currently to trigger service restarts on other nodes
return 0
} }
arg0=$(basename $0) arg0=$(basename $0)
@ -276,12 +253,10 @@ case $arg0 in
"shared-db-relation-changed") db_changed ;; "shared-db-relation-changed") db_changed ;;
"image-service-relation-joined") exit 0 ;; "image-service-relation-joined") exit 0 ;;
"image-service-relation-changed") image-service_changed ;; "image-service-relation-changed") image-service_changed ;;
"network-manager-relation-joined") nova-network_joined ;;
"identity-service-relation-joined") keystone_joined ;; "identity-service-relation-joined") keystone_joined ;;
"identity-service-relation-changed") keystone_changed ;; "identity-service-relation-changed") keystone_changed ;;
"cloud-controller-relation-joined") controller_joined ;;
"cloud-controller-relation-changed") exit 0 ;;
"cinder-volume-service-relation-joined") volume_joined ;; "cinder-volume-service-relation-joined") volume_joined ;;
"nova-volume-service-relation-joined") volume_joined ;; "nova-volume-service-relation-joined") volume_joined ;;
"cloud-compute-relation-joined") compute_joined ;;
*) exit 0 ;; *) exit 0 ;;
esac esac

View File

@ -7,8 +7,6 @@ description: |
provides: provides:
cloud-controller: cloud-controller:
interface: nova interface: nova
network-manager:
interface: nova-network
requires: requires:
shared-db: shared-db:
interface: mysql-shared interface: mysql-shared

View File

@ -1 +1 @@
138 141