Merge CONFIG_CHANGED.

This commit is contained in:
Adam Gandelman
2013-04-09 11:03:36 -07:00
7 changed files with 21 additions and 5 deletions

View File

@@ -39,4 +39,5 @@ nova_set_or_update() {
juju-log "$CHARM: Setting new option $key=$value in $conf_file"
echo "$out$value" >>$conf_file
fi
CONFIG_CHANGED=True
}

View File

@@ -62,6 +62,7 @@ with open('$conf_file', 'wb') as configfile:
fi
;;
esac
CONFIG_CHANGED="True"
}
# Upgrade Helpers

View File

@@ -63,6 +63,7 @@ with open('$conf_file', 'wb') as configfile:
fi
;;
esac
CONFIG_CHANGED="True"
}
# Upgrade Helpers

View File

@@ -2,6 +2,8 @@
# Common utility functions used across all nova charms.
CONFIG_CHANGED=False
# Load the common OpenStack helper library.
if [[ -e $CHARM_DIR/lib/openstack-common ]] ; then
. $CHARM_DIR/lib/openstack-common

View File

@@ -20,6 +20,9 @@ function service_ctl_status {
function service_ctl {
# control a specific service, or all (as defined by $SERVICES)
# service restarts will only occur depending on global $CONFIG_CHANGED,
# which should be updated in charm's set_or_update().
local config_changed=${CONFIG_CHANGED:-True}
if [[ $1 == "all" ]] ; then
ctl="$SERVICES"
else
@@ -37,12 +40,21 @@ function service_ctl {
"stop")
service_ctl_status $i && service $i stop || return 0 ;;
"restart")
service_ctl_status $i && service $i restart || service $i start ;;
if [[ "$config_changed" == "True" ]] ; then
service_ctl_status $i && service $i restart || service $i start
fi
;;
esac
if [[ $? != 0 ]] ; then
juju-log "$CHARM: service_ctl ERROR - Service $i failed to $action"
fi
done
# all configs should have been reloaded on restart of all services, reset
# flag if its being used.
if [[ "$action" == "restart" ]] && [[ -n "$CONFIG_CHANGED" ]] &&
[[ "$ctl" == "all" ]]; then
CONFIG_CHANGED="False"
fi
}
function configure_install_source {

View File

@@ -183,12 +183,11 @@ function db_changed {
set_or_update sql_connection "mysql://quantum:$quantum_db_password@$db_host/quantum?charset=utf8" \
$QUANTUM_PLUGIN_CONF "DATABASE"
fi
determine_services
service_ctl all stop
eligible_leader 'res_nova_vip' && /usr/bin/nova-manage db sync
service_ctl all start
determine_services
service_ctl all restart
if [ "$NET_MANAGER" == "Quantum" ]; then
configure_quantum_networking

View File

@@ -1 +1 @@
240
261