dns_assignment is lost during port creation after VIF binding

Bug #1579977 reported by Arjun Baindur
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
bin Yu

Bug Description

DESCRIPTION: The dns_assignment attribute is not actually part of the port's DB schema. It is a field that is populated on the fly during port creation (if dns_domain is set in neutron.conf and the port has a dns_name set), in order to send port information to DHCP agent, for example. This occurs in create_port in db_base_plugin_v2.py

In our ML2 plugin for create_port (create_port in plugins/ml2/plugin.py), However, DNS assignment lost when attempting VIF binding. If VIF binding is committed, a new context created from Port DB - dns_assignment not a DB field. As such, any dns_assignment that was previously populated is lost.

Please see: https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/plugin.py#1130

The dns_assignment from incoming mech_context needs to be copied over to the new bound_context. Else DHCP will receive an empty dns_assignment and VM DNS resolution will not work.

PRE-CONDITIONS:

1. I have a small local changes to Nova's network/neutronv2/api.py (allocate_for_instance), in which it sends the dns_name as the instance's name, in the port_req_body during VM instance creation. This part of the Nova neutron API code triggers a port_create via neutron client.

This enables setting DNS automatically during instance creation

2. In neutron.conf, must set the dns_domain to some non-default value. Else, DNS resolution is disabled.

REPRODUCTION STEPS:

I just created a VM like normal (via GUI or NOVA CLI), and don't attach it to exist port. I verified that neutron server API for port creation was correctly getting the instance hostname as the dns_name in the port request payload. However, DHCP agent was receiving an empty dns_assignment.

EXPECTED OUTPUT: Creating a VM should set DNS for the port, the DHCP agent and hosts file should have correct entries.

ACTUAL OUTPUT: the DHCP host file entry has default "host-IP-openstack.local" format, and does not use DNS resolution of "hostname.domain.com"

Version: Liberty, Centos 7.1

Tags: dns
Arjun Baindur (abaindur)
Changed in neutron:
assignee: nobody → xagent (xagent-9)
Revision history for this message
Ryan Moats (rmoats) wrote :

Miguel, another one for you to triage - thanks.

Changed in neutron:
assignee: xagent (xagent-9) → Miguel Lavalle (minsel)
Revision history for this message
Arjun Baindur (abaindur) wrote :

FYI, I have fixed this locally in our liberty deployment (along w/ Nova side changes described to set dns_name in port), and it is working. Havent been able to test on master or M release, but I can try using Devstack

Revision history for this message
Miguel Lavalle (minsel) wrote :

I can confirm that this is also happening in master. One of my team members is already working on a fix for this.

I also want to mention that the functionality to use the dns_name attribute in Nova boots was merged in Mitaka: http://git.openstack.org/cgit/openstack/nova/commit/?id=30ba0c5eb19a9c9628957ac8e617ae78c0c1fa84

Changed in neutron:
assignee: Miguel Lavalle (minsel) → James Anziano (janzian)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/319457

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by James Anziano (<email address hidden>) on branch: master
Review: https://review.openstack.org/319457
Reason: The bug referenced by this patch is fixed elsewhere: https://review.openstack.org/#/c/301809/

Revision history for this message
James Anziano (janzian) wrote :

Abandoning my change as there is another patchset in review that includes a fix for this bug.

That patchset can be found here: https://review.openstack.org/#/c/301809/

Revision history for this message
James Anziano (janzian) wrote :

Apologies, wrong link. The real patchset to fix this bug is here: https://review.openstack.org/#/c/313291/

Changed in neutron:
assignee: James Anziano (janzian) → nobody
Miguel Lavalle (minsel)
Changed in neutron:
assignee: nobody → bin Yu (froyo-bin)
Changed in neutron:
assignee: bin Yu (froyo-bin) → Carl Baldwin (carl-baldwin)
Miguel Lavalle (minsel)
Changed in neutron:
assignee: Carl Baldwin (carl-baldwin) → bin Yu (froyo-bin)
Changed in neutron:
assignee: bin Yu (froyo-bin) → Manjeet Singh Bhatia (manjeet-s-bhatia)
Changed in neutron:
assignee: Manjeet Singh Bhatia (manjeet-s-bhatia) → bin Yu (froyo-bin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/313291
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=64f5fc82596ec6b78b76ca5d9cfc1d4b5a0b975d
Submitter: Jenkins
Branch: master

commit 64f5fc82596ec6b78b76ca5d9cfc1d4b5a0b975d
Author: Bin Yu <email address hidden>
Date: Fri May 6 17:20:04 2016 +0800

    Refactor DNS integration out of DB core plugin

    This patch set aims to move all the code related to DNS integration
    from the DB core plugin to the DNS ML2 extension module.

    By doing this, this patchset removes the dns related code in
    db_base_plugin_v2 and the dns exteions module talks with core plugin
    only through the method extension_manager and apply_dict_extend_functions

    By properly implementing the generation of the dns_assignment attribute
    for ports in the DNS ML2 extension module, this patchset also fixes
    https://bugs.launchpad.net/neutron/+bug/1579977

    Change-Id: I63afb1a1bfeeb14eefb54681dc64959144deeb25
    Closes-Bug: #1579601
    Closes-Bug: #1579977

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 9.0.0.0b3

This issue was fixed in the openstack/neutron 9.0.0.0b3 development milestone.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.