Is there a way to get the tenant/project from inside a spawned instance

asked 2014-09-01 04:21:20 -0600

Remko Duppen gravatar image

We're looking into a way to automatically register new spawned instances in DNS (with designate or some dnsmasq hack)

The idea is to have a subdomain per tenant/project and use the designate api to manage these during the first boot with cloud-init. To do that I would need the project id in the metadata or some way to retrieve the tenant id based on the instance id. But the compute rest API is tenant based which get's me into a catch 22

We're running icehouse

edit retag flag offensive close merge delete


Ok, this is a dirty hack, but I temporarily fixed this by adding python metadata['project_id' ] = self.instance['project_id'] in nova/api/metadata/ InstanceMetadata::_metadata_as_json() Is there a rational why not to add this info to the metadata ?

Remko Duppen gravatar imageRemko Duppen ( 2014-09-01 06:53:23 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-01 11:40:54 -0600

grahamhayes gravatar image

You could try adding it manually to the metadata of the instance after it boots

edit flag offensive delete link more


yeah, but that would entail an extra manual step if I use the horizon dashboard, or scripting the instance creating using the rest api with an homemade frontend. I already thought about using user data for this info, but that has the same drawbacks imho

Remko Duppen gravatar imageRemko Duppen ( 2014-09-01 16:56:11 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2014-09-01 04:21:20 -0600

Seen: 774 times

Last updated: Sep 01 '14