cernvm/cernvm-micro — pull request #1 by berghaus (2014-08-22 19:43:51+00:00)
Title: Fix meta-data retrieval for OpenStack clouds

It looks like the context script looks for user and metadata on openstack clouds here:

fetch_openstack() {
local default_gateway=$(route | grep ^default | awk '{print $2}')
download_userdata $default_gateway http://${default_gateway}/latest/user-data
[ $? -eq 0 ] && UCONTEXT_SRC="OpenStack"
}

I've tried the route command on VMs running in various openstack clouds (UVic, CERN, GridPP). The command does not yield a valid host anywhere, at CERN for example:

```
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default l513-c-rbrmx-4- 0.0.0.0 UG 0 0 0 eth0
128.142.132.0 * 255.255.255.0 U 0 0 0 eth0
```

Such that default_gateway=l513-c-rbrmx-4-

The OpenStack docs specify that the meta-data server will be at http://169.254.169.254 (just like on EC2). If I read the script correctly though `fetch_ec2` should run on OpenStack (or any other environment), but isn't guaranteed to pick up the right meta-data or user-data since on OpenStack you are guaranteed http://169.254.169.254/latest but not http://169.254.169.254/2009-04-04.

Note that amazon also provides http://169.254.169.254/latest, so maybe we could simplify this?