← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1579977] [NEW] dns_assignment is lost during port creation after VIF binding

 

Public bug reported:

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

** Affects: neutron
     Importance: Undecided
     Assignee: xagent (xagent-9)
         Status: New


** Tags: dns

** Changed in: neutron
     Assignee: (unassigned) => xagent (xagent-9)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1579977

Title:
  dns_assignment is lost during port creation after VIF binding

Status in neutron:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1579977/+subscriptions


Follow ups