openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #09520
Hostname selection
HI all,
I was looking into how hostnames are selected for an instance in openstack and there seems to be a couple+X? ways I have discovered and just wanted to see if I am correct.
1. Use the metadata api, and send in a user-data section that specifies the hostname, then use say the 'ami-launch-index' to figure out which hostname is yours (ie the vm's) in the list.
2. There also seems to be some way to use the openstack API (not the ec2 one?) to specify a display name which will eventually become the hostname, this is then stored in the DB (is this correct?)
3. Is there also a way to set the hostname in the metadata api directly, although I am not sure about this one, since cloud-init will only run once (?) and thus this metadata update won't be reflected?
A lot of this happens around https://github.com/openstack/nova/blob/master/nova/compute/api.py#L551
Is it correct to say that the hostname, if not given a display name will become something like server_$uuid where the $uuid is generated. Is this hostname then returned in the metadata (I think yes?). If say the ec2 apis are used only, how is the hostname set (since it seems like only the openstack apis can take in a display name?) How does either of these work when multiple instances are launched (especially say the openstack api one, will multiple vm's then have the same display name??)
Any input welcome. Thx!
-Josh