Different tenants can assign the same hostname to different machines without an error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Won't Fix
|
High
|
Unassigned |
Bug Description
nova version 2.15.0
My openstack deployment is relatively simple. It uses FlatDHCPManager and a single vlan. Multiple tenants exist and all are on the same vlan. Now consider the following situation:
1. tenant A and tenant B exist.
2. tenant A logs into horizon dashboard and launches an instance into vlan 192.168.50.X.
3. tenant A gives the instance a display name of "test". As a result, the DHCP server assigns the hostname "test" to the VM and an IP address of 192.168.50.2.
4. tenent B sometime later logs into the horizon dashboard.
5. tenant B has no visibility and consequently does not know that tenant A has a machine with a hostname of test in the 192.168.50 vlan.
6. tenant B launches an instance into vlan 192.168.50.X.
7. tenant B gives the instance a display name of "test". As a result, the DHCP server assigns the hostname "test" to the VM and an IP address of 192.168.50.3.
As a result, now when a nslookup is done on the hostname, two A records are returned instead of one. This situation would be far worse if each tenant launched multiple instances instead of just one. I don't know of a situation where anyone would want to automatically assign the same hostname to multiple IP addresses, especially when this behavior would be unknown to the tenants and would result in all kinds of bizarre networking behavior depending on the applications deployed in the vlan.
My expectation is that at a minimum if tenant B attempts to launch an instance with a hostname that already exists in the DHCP server's records, then that launch should fail and the tenant should be forced to change the display they tried to give the VM before a launch would be successful.
tags: | added: compute |
Changed in nova: | |
importance: | Undecided → High |
status: | New → Confirmed |
Changed in nova: | |
assignee: | nobody → Simon Chang (changsimon) |
Changed in nova: | |
assignee: | Simon Chang (changsimon) → nobody |
Changed in nova: | |
assignee: | nobody → Samuel de Medeiros Queiroz (samuel-z) |
Classes that inherit from NetworkManager, e.g. FlatDHCPManager, use the attribute instance_ dns_manager to handle DNS service operations, such as creating new DNS entries.
This attribute is an instance of the class defined at CONF.instance_ dns_manager, that is, by default, 'nova.network. noop_dns_ driver. NoopDNSDriver' .
NoopDNSDriver, as suggested, does not do anything. However, other DNSDriver implementations like MiniDNS do. They verify if a DNS entry name is unique into the domain before adding the new DNS entry.
Changing this default configuration to 'nova.network. minidns. MiniDNS' at nova/network/ floating_ ips.py solved this issue:
cfg. StrOpt( 'instance_ dns_manager' ,
default= 'nova.network. minidns. MiniDNS' ,
help=' Full class name for the DNS Manager for instance IPs'),
When trying to reproduce the bug after the modifications through Horizon, I got:
Error: Failed to launch instance "instance-name": Please try again later [Error: No valid host was found. ].
What do you think about this approach?