~openstack-ubuntu-testing/charms/precise/nova-cloud-controller/trunk

« back to all changes in this revision

Viewing changes to hooks/lib/nova/grizzly

  • Committer: Adam Gandelman
  • Date: 2013-03-21 22:20:28 UTC
  • mfrom: (22.6.21 nova-cloud-controller)
  • Revision ID: adamg@canonical.com-20130321222028-lpuefuno3vzp0nl9
Merge current ha-support work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
}
74
74
 
75
75
nova_post_upgrade() {
 
76
  local upgrade_from="$1"
76
77
  # Post-upgrade helper.  Caller should pass the version of OpenStack we are
77
78
  # upgrading from.
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"
 
82
 
 
83
  # nova-volume is gone. ensure nova.conf is not set to try to import it.
 
84
  configure_volume_service "cinder"
 
85
 
 
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
 
90
 
 
91
    # Trigger a service restart on all other nova nodes.
 
92
    trigger_remote_service_restarts
 
93
  fi
 
94
 
 
95
  # Use the latest api-paste.ini, repopulate from an existing
 
96
  # identity-service.
 
97
  local r_id=$(relation-ids identity-service)
 
98
  local unit=""
 
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)
 
109
    done
 
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"
 
120
  fi
 
121
  juju-log "$CHARM: Post-upgrade hook complete: $upgrade_from -> folsom."
80
122
}