'dns_assignment' is not transmitted to neutron-dhcp-agent when new port is created with 'dns_name' set

Bug #1531426 reported by Christoph Fiehe on 2016-01-06
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Anand Shanmugam

Bug Description

When a port is created, a notify message gets sent to the neutron-dhcp-agent. It contains the 'dns_name' but misses 'dns_assignment' causing that internal DNS resolution (added in Liberty) not to work as expected. Only a restart of the neutron-dhcp-agent helps when the ports are directly read from the database. I spent a lot of time in debugging, but was not able to locate the specific section where the notify message gets created.

I have enabled tracing in RabbitMQ and this is the problematic message. The port information is extracted by the neutron-dhcp-agent and checked against the existence of 'dns_assignment'. Because the field is missing, a standard DNS entry in the form of 'host-xxx-xxx-xxx-xxx.%{domain_id}' is created and added to the Dnsmasq resolution file.

Node: rabbit@os-controller02
Connection: ->
Virtual host: openstack
User: neutron
Channel: 1
Exchange: neutron
Routing keys: [<<"dhcp_agent.os-network02">>]
Queue: dhcp_agent.os-network02
Properties: [{<<"priority">>,signedint,0},
{"oslo.message": "{\"_context_domain\": null, \"_context_request_id\": \"req-1d44fd59-e38a-4d44-b195-58bdcfa94045\", \"_context_auth_token\": \"e511c54d625a4d4ca480cea94c173123\", \"_context_resource_uuid\": null, \"_context_tenant_name\": \"service\", \"_context_user\": \"36c4334c1d01456ebab7041c669d40a3\", \"_context_user_id\": \"36c4334c1d01456ebab7041c669d40a3\", \"_context_show_deleted\": false, \"_context_is_admin\": true, \"version\": \"1.0\", \"_context_project_domain\": null, \"_context_timestamp\": \"2016-01-06 07:49:49.293954\", \"method\": \"port_create_end\", \"_context_roles\": [\"admin\"], \"args\": {\"payload\": {\"port\": {\"status\": \"DOWN\", \"binding:host_id\": \"os-compute01\", \"allowed_address_pairs\": [], \"extra_dhcp_opts\": [], \"device_owner\": \"compute:nova\", \"port_security_enabled\": true, \"binding:profile\": {}, \"qos_policy_id\": null, \"fixed_ips\": [{\"subnet_id\": \"f07588e4-ffb2-4199-b679-03fd4e814ddb\", \"ip_address\": \"\"}], \"id\": \"0a651aa4-b83f-463b-b9f2-35751e9268a2\", \"security_groups\": [\"0ac4af90-4efb-4819-a522-b3cc53b37f92\"], \"device_id\": \"776a524b-bdd6-468d-9845-099df156ca56\", \"name\": \"\", \"admin_state_up\": true, \"network_id\": \"38ef3fd3-d80f-4eb0-9bbb-2e995b711e07\", \"dns_name\": \"test-vm2\", \"binding:vif_details\": {\"port_filter\": true, \"ovs_hybrid_plug\": true}, \"binding:vnic_type\": \"normal\", \"binding:vif_type\": \"ovs\", \"tenant_id\": \"7fdd23889b214e66b94f498c9529fbd6\", \"mac_address\": \"fa:16:3e:d7:07:7a\"}}}, \"_unique_id\": \"71a75d632a004e11a2029e8bb44c8220\", \"_context_tenant_id\": \"9ed3902618c54b84a0e23dc1eb827dec\", \"_context_project_name\": \"service\", \"_context_user_identity\": \"36c4334c1d01456ebab7041c669d40a3 9ed3902618c54b84a0e23dc1eb827dec - - -\", \"_context_tenant\": \"9ed3902618c54b84a0e23dc1eb827dec\", \"_context_project_id\": \"9ed3902618c54b84a0e23dc1eb827dec\", \"_context_read_only\": false, \"_context_user_domain\": null, \"_context_user_name\": \"neutron\"}", "oslo.version": "2.0"}

Christoph Fiehe (cfiehe) on 2016-01-06
description: updated
description: updated
Changed in neutron:
assignee: nobody → Anand Shanmugam (anand1712)

i created network test and subnet

when i create port i get following result.


when you create a port on net which don't have subnet yet then
dns_assignment is empty.

I don't feel like it is a bug.

I tried it on origin/master. not sure which branch you've tried on

Anand Shanmugam (anand1712) wrote :
Download full text (5.6 KiB)

Hi Jens,

I tried creating a port in master and was able to see that the dhcp_agent is getting the dns_assignment correctly and it is also adding the entries in the dnsmasq file properly. I set the dns_domain config option in neutron.conf to "mylocal" to try to reproduce this issue.

curl -g -i -X POST -H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: b357946e24d84fa18697df70cff1924b" -d '{"port": {"network_id": "46822df1-7b31-47bf-9331-bebf83b5d890", "admin_state_up": true, "dns_name":"test1-vm2"}}

{"port": {"status": "DOWN", "binding:host_id": "", "allowed_address_pairs": [], "dns_assignment": [{"hostname": "test1-vm2", "ip_address": "", "fqdn": "test1-vm2.mylocal."}, {"hostname": "test1-vm2", "ip_address": "fde5:ba01:556e:0:f816:3eff:feae:1b8c", "fqdn": "test1-vm2.mylocal."}], "device_owner": "", "binding:profile": {}, "port_security_enabled": true, "fixed_ips": [{"subnet_id": "ef731cd4-9eaf-45ce-b9dc-b622e8ec5521", "ip_address": ""}, {"subnet_id": "32215369-3c1f-4366-99a1-50923f946373", "ip_address": "fde5:ba01:556e:0:f816:3eff:feae:1b8c"}], "id": "ee63422f-7341-4b45-a383-5200f7aca108", "security_groups": ["e9144244-deae-4a49-ad5f-e03c2fb1dad5"], "device_id": "", "name": "", "admin_state_up": false, "network_id": "46822df1-7b31-47bf-9331-bebf83b5d890", "dns_name": "test1-vm2", "binding:vif_details": {}, "binding:vnic_type": "normal", "binding:vif_type": "unbound", "tenant_id": "6614b7a7a0194be5be558b6e25fe52e6", "mac_address": "fa:16:3e:ae:1b:8c"}}

neutron port-show "ee63422f-7341-4b45-a383-5200f7aca108"
| Field | Value |
| admin_state_up | False |
| allowed_address_pairs | |
| binding:host_id | |
| binding:profile | {} |
| binding:vif_details | {} |
| binding:vif_type | unbound |
| binding:vnic_type | normal |
| device_id | |
| device_owner ...


Changed in neutron:
status: New → Incomplete
Christoph Fiehe (cfiehe) wrote :

I think, I shot too fast. I have checked if the issue also occurs when I create a port with a "dns_name" set using
neutron port-create demo-net --dns_name test-dns

Everything is working as expected: The "dns_assignment" is set and transferred via RabbitMQ to dnsmasq which inserts the resolution correctly into the resolution file.

What have we done:
Our OpenStack Liberty cloud depends on AutoDNS-assignment which means that when a VM gets created the mapping hostname.domain_id -> Fixed-IP must be added to dnsmasq without any human intervention. We have modified the sources at /neutron/plugins/ml2/plugin.py and inserted some code in the method "create_port" that uses a novaclient to lookup the hostname of the "device_id" present in the port definition hash. Unfortunatly, this must be the wrong place... The result is that only the "dns_name" gets set and misses the "dns_assignment" causing that dnsmasq does not add the mapping entry.

We were not able to find the correct place for code injection. Could you help us getting AutoDNS-assignment working?

 There seems to be only little code necessary. Hopefully, the external DNS blueprint gets added to Mikata avoiding this ugly code modification.

Christoph Fiehe (cfiehe) on 2016-11-03
Changed in neutron:
status: Incomplete → Fix Released
Christoph Fiehe (cfiehe) wrote :

The bug is fixed in OpenStack Newton.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers