~ivoks/charms/precise/nova-cloud-controller/fix-neutron-url

« back to all changes in this revision

Viewing changes to hooks/nova-cloud-controller-relations

  • Committer: Juan L. Negron
  • Date: 2012-11-29 19:16:02 UTC
  • mfrom: (46.2.2 nova-cloud-controller)
  • Revision ID: juan.negron@canonical.com-20121129191602-if6gx66co55a4ot5
* Some fixes for handling of repo URLs via 'openstack-origin' config. Courtesy of James Page.

* Allows the nova-cloud-controller service to inform nova-compute, via the cloud-compute relation, of the configured volume service so nova-compute can configure itself accordingly. The volume service changes depending on what has been deployed and related (nova-volume or cinder).  Fixed (negronjl) the ensemble left-overs from metadata.yaml. MP:136821

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
function install_hook {
13
13
  juju-log "$CHARM: Installing nova packages"
14
14
  apt-get -y install python-software-properties || exit 1
15
 
  configure_install_source $(config-get openstack-origin)
 
15
  configure_install_source "$(config-get openstack-origin)"
16
16
  apt-get update || exit 1
17
17
 
18
18
  DEBIAN_FRONTEND=noninteractive apt-get -y \
220
220
  # configured in keystone.
221
221
  if [[ "$svc" == "nova-volume" ]] ; then
222
222
    apt-get -y install nova-api-os-volume
223
 
    nova_vol_url="http://$(unit-get private-address):8776/v1/\$(tenant_id)s"
224
 
    r_ids=$(relation-ids identity-service)
 
223
    local nova_vol_url="http://$(unit-get private-address):8776/v1/\$(tenant_id)s"
 
224
    local r_ids=$(relation-ids identity-service)
225
225
    for id in $r_ids ; do
226
226
      juju-log "$CHARM: Registering new endpoint for nova-volume API on "\
227
227
               "existing identity-service relation: $id"
233
233
        nova-volume_internal_url="$nova_vol_url"
234
234
    done
235
235
  fi
 
236
 
 
237
  if [[ "$svc" == "cinder" ]] ; then
 
238
    # Compute nodes need to be notified to set their volume
 
239
    # driver accordingly.
 
240
    r_ids=$(relation-ids cloud-compute)
 
241
    for id in $r_ids ; do
 
242
      relation-set -r $id volume_service="cinder"
 
243
    done
 
244
  fi
236
245
}
237
246
 
238
247
compute_joined() {
240
249
  # nova-compute should configure itself accordingly.
241
250
  relation-set network_manager=$(config-get network-manager)
242
251
  relation-set ec2_host=$(unit-get private-address)
 
252
 
 
253
  # Compute's volume driver is dependent on volume service deployed.
 
254
  local r_ids=$(relation-ids cinder-volume-service)
 
255
  if [[ -n "$r_ids" ]] ; then
 
256
    relation-set volume_service="cinder"
 
257
  else
 
258
    relation-set volume_service="nova-volume"
 
259
  fi
243
260
}
244
261
 
245
262
arg0=$(basename $0)