75
75
nova_post_upgrade() {
76
local upgrade_from="$1"
76
77
# Post-upgrade helper. Caller should pass the version of OpenStack we are
78
juju-log "$CHARM: Running post-upgrade hook: $upgrade_from -> folsom."
79
# nothing to do here yet.
79
juju-log "$CHARM: Running post-upgrade hook: $upgrade_from -> Grizzly"
80
[[ "$upgrade_from" != "folsom" ]] &&
81
error_out "Unsupported upgrade: $upgrade_from -> Grizzly"
83
# nova-volume is gone. ensure nova.conf is not set to try to import it.
84
configure_volume_service "cinder"
86
if [[ "$CHARM" == "nova-cloud-controller" ]] &&
87
eligible_leader 'res_nova_vip'; then
88
juju-log "$CHARM: Migrating nova database."
89
/usr/bin/nova-manage db sync
91
# Trigger a service restart on all other nova nodes.
92
trigger_remote_service_restarts
95
# Use the latest api-paste.ini, repopulate from an existing
97
local r_id=$(relation-ids identity-service)
99
if [[ -n "$r_id" ]] ; then
100
mv $API_CONF $CONF_DIR/api-paste.ini.juju-last
101
mv $CONF_DIR/api-paste.ini.dpkg-dist $CONF_DIR/api-paste.ini
102
for unit in $(relation-list -r $r_id) ; do
103
local service_port=$(relation-get -r $r_id service_port $unit)
104
local auth_port=$(relation-get -r $r_id auth_port $unit)
105
local service_username=$(relation-get -r $r_id service_username $unit)
106
local service_password=$(relation-get -r $r_id service_password $unit)
107
local service_tenant=$(relation-get -r $r_id service_tenant $unit)
108
local keystone_host=$(relation-get -r $r_id auth_host $unit)
110
juju-log "$CHARM: Updating new api-paste.ini with keystone data."
111
juju-log "$CHARM: Updating new api-paste.ini with keystone data from $unit:$r_id"
112
set_or_update "service_host" "$keystone_host" "$API_CONF"
113
set_or_update "service_port" "$service_port" "$API_CONF"
114
set_or_update "auth_host" "$keystone_host" "$API_CONF"
115
set_or_update "auth_port" "$auth_port" "$API_CONF"
116
set_or_update "auth_uri" "http://$keystone_host:$service_port/" "$API_CONF"
117
set_or_update "admin_tenant_name" "$service_tenant" "$API_CONF"
118
set_or_update "admin_user" "$service_username" "$API_CONF"
119
set_or_update "admin_password" "$service_password" "$API_CONF"
121
juju-log "$CHARM: Post-upgrade hook complete: $upgrade_from -> folsom."