From a4c7efdb62163c51c2ce210faed113f84d16a863 Mon Sep 17 00:00:00 2001 From: Adam Gandelman Date: Fri, 12 Oct 2012 12:37:13 -0700 Subject: [PATCH] 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. --- ...changed => cloud-compute-relation-changed} | 0 ...n-joined => cloud-compute-relation-joined} | 0 hooks/lib/nova/nova-common | 14 +++++-- hooks/lib/openstack-common | 13 ------- hooks/network-manager-relation-joined | 1 - hooks/nova-cloud-controller-common | 7 ---- hooks/nova-cloud-controller-relations | 39 ++++--------------- metadata.yaml | 2 - revision | 2 +- 9 files changed, 18 insertions(+), 60 deletions(-) rename hooks/{cloud-controller-relation-changed => cloud-compute-relation-changed} (100%) rename hooks/{cloud-controller-relation-joined => cloud-compute-relation-joined} (100%) delete mode 120000 hooks/network-manager-relation-joined diff --git a/hooks/cloud-controller-relation-changed b/hooks/cloud-compute-relation-changed similarity index 100% rename from hooks/cloud-controller-relation-changed rename to hooks/cloud-compute-relation-changed diff --git a/hooks/cloud-controller-relation-joined b/hooks/cloud-compute-relation-joined similarity index 100% rename from hooks/cloud-controller-relation-joined rename to hooks/cloud-compute-relation-joined diff --git a/hooks/lib/nova/nova-common b/hooks/lib/nova/nova-common index d7baeba6..e3307aca 100644 --- a/hooks/lib/nova/nova-common +++ b/hooks/lib/nova/nova-common @@ -57,10 +57,16 @@ function configure_network_manager { function trigger_remote_service_restarts() { # Trigger a service restart on all other nova nodes that have a relation # via the cloud-controller interface. - local r_ids=$(relation-ids cloud-controller) - for r_id in $r_ids ; do - juju-log "$CHARM: Triggering a service restart on relation $r_id." - relation-set -r $r_id restart-trigger=$(uuid) + + # 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 + juju-log "$CHARM: Triggering a service restart on relation $r_id." + relation-set -r $r_id restart-trigger=$(uuid) + done done } diff --git a/hooks/lib/openstack-common b/hooks/lib/openstack-common index 16858be6..7ce1bddf 100644 --- a/hooks/lib/openstack-common +++ b/hooks/lib/openstack-common @@ -45,19 +45,6 @@ function service_ctl { 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 { # Setup and configure installation source based on a config flag. local src="$1" diff --git a/hooks/network-manager-relation-joined b/hooks/network-manager-relation-joined deleted file mode 120000 index ed780797..00000000 --- a/hooks/network-manager-relation-joined +++ /dev/null @@ -1 +0,0 @@ -nova-cloud-controller-relations \ No newline at end of file diff --git a/hooks/nova-cloud-controller-common b/hooks/nova-cloud-controller-common index 68c69a28..2a064a52 100755 --- a/hooks/nova-cloud-controller-common +++ b/hooks/nova-cloud-controller-common @@ -18,13 +18,6 @@ PACKAGES="$SERVICES python-mysqldb python-keystone uuid" NOVA_CONF=$(config-get nova-config) 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 . $CHARM_DIR/lib/nova/nova-common else diff --git a/hooks/nova-cloud-controller-relations b/hooks/nova-cloud-controller-relations index 403d8dfb..6d108977 100755 --- a/hooks/nova-cloud-controller-relations +++ b/hooks/nova-cloud-controller-relations @@ -18,16 +18,7 @@ function install_hook { DEBIAN_FRONTEND=noninteractive apt-get -y \ install --no-install-recommends $PACKAGES || exit 1 - configure_network_manager $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_network_manager $(config-get network-manager) # Configure any flags specified in deployment config set_config_flags @@ -136,16 +127,6 @@ function image-service_changed { 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 { # we need to get two entries into keystone's catalog, nova + ec2 # group, them by prepending $service_ to each setting. the keystone @@ -254,15 +235,11 @@ volume_joined() { fi } -volume_changed() { - # nothing to do here, yet. - exit 0 -} - -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 +compute_joined() { + # Inform remote unit of the network manager we've been configured to use. + # nova-compute should configure itself accordingly. + relation-set network_manager=$(config-get network-manager) + relation-set ec2_host=$(unit-get private-address) } arg0=$(basename $0) @@ -276,12 +253,10 @@ case $arg0 in "shared-db-relation-changed") db_changed ;; "image-service-relation-joined") exit 0 ;; "image-service-relation-changed") image-service_changed ;; - "network-manager-relation-joined") nova-network_joined ;; "identity-service-relation-joined") keystone_joined ;; "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 ;; "nova-volume-service-relation-joined") volume_joined ;; + "cloud-compute-relation-joined") compute_joined ;; *) exit 0 ;; esac diff --git a/metadata.yaml b/metadata.yaml index ca2f3db0..42dbd373 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -7,8 +7,6 @@ description: | provides: cloud-controller: interface: nova - network-manager: - interface: nova-network requires: shared-db: interface: mysql-shared diff --git a/revision b/revision index 93e78032..b4f334f2 100644 --- a/revision +++ b/revision @@ -1 +1 @@ -138 +141