BadRequest: Invalid input for dns_name. Name must not start or end with a hyphen.

Bug #1545153 reported by Matt Riedemann
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Matt Riedemann

Bug Description

I'm seeing this in a tempest job run:

http://logs.openstack.org/21/279721/3/check/gate-tempest-dsvm-neutron-full/8292a4a/logs/screen-n-cpu.txt.gz?level=TRACE#_2016-02-12_19_46_26_529

2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [req-bb911afc-2a34-4812-8c83-0bb6eabc527f tempest-TestSecurityGroupsBasicOps-630833589 tempest-TestSecurityGroupsBasicOps-22256548] [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] Neutron error creating port on network 6796595c-c739-4080-b8a9-997f6936208c
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] Traceback (most recent call last):
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/opt/stack/new/nova/nova/network/neutronv2/api.py", line 255, in _create_port
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] port = port_client.create_port(port_req_body)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 100, in with_params
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] ret = self.function(instance, *args, **kwargs)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 525, in create_port
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] return self.post(self.ports_path, body=body)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 271, in post
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] headers=headers, params=params)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 206, in do_request
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] self._handle_fault_response(status_code, replybody)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 182, in _handle_fault_response
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] exception_handler_v20(status_code, des_error_body)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 69, in exception_handler_v20
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] status_code=status_code)
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b] BadRequest: Invalid input for dns_name. Reason: 'tempest-server-tempest-testsecuritygroupsbasicops-22256548-gen-' not a valid PQDN or FQDN. Reason: Name 'tempest-server-tempest-testsecuritygroupsbasicops-22256548-gen-' must not start or end with a hyphen..
2016-02-12 19:46:26.529 19015 ERROR nova.network.neutronv2.api [instance: 25bf790e-cc4b-42fa-99f2-38f9bb7a004b]
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager [req-bb911afc-2a34-4812-8c83-0bb6eabc527f tempest-TestSecurityGroupsBasicOps-630833589 tempest-TestSecurityGroupsBasicOps-22256548] Instance failed network setup after 1 attempt(s)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager Traceback (most recent call last):
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/opt/stack/new/nova/nova/compute/manager.py", line 1564, in _allocate_network_async
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager bind_host_id=bind_host_id)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/opt/stack/new/nova/nova/network/neutronv2/api.py", line 662, in allocate_for_instance
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager self._delete_ports(neutron, instance, created_port_ids)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager self.force_reraise()
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager six.reraise(self.type_, self.value, self.tb)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/opt/stack/new/nova/nova/network/neutronv2/api.py", line 651, in allocate_for_instance
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager security_group_ids, available_macs, dhcp_opts)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/opt/stack/new/nova/nova/network/neutronv2/api.py", line 296, in _create_port
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager network_id, instance=instance)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager self.force_reraise()
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager six.reraise(self.type_, self.value, self.tb)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/opt/stack/new/nova/nova/network/neutronv2/api.py", line 255, in _create_port
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager port = port_client.create_port(port_req_body)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 100, in with_params
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager ret = self.function(instance, *args, **kwargs)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 525, in create_port
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager return self.post(self.ports_path, body=body)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 271, in post
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager headers=headers, params=params)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 206, in do_request
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager self._handle_fault_response(status_code, replybody)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 182, in _handle_fault_response
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager exception_handler_v20(status_code, des_error_body)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 69, in exception_handler_v20
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager status_code=status_code)
2016-02-12 19:46:26.553 19015 ERROR nova.compute.manager BadRequest: Invalid input for dns_name. Reason: 'tempest-server-tempest-testsecuritygroupsbasicops-22256548-gen-' not a valid PQDN or FQDN. Reason: Name 'tempest-server-tempest-testsecuritygroupsbasicops-22256548-gen-' must not start or end with a hyphen..

Setting the dns_name on the port was added to nova today:

https://review.openstack.org/#/c/271578/

We must be getting lucky because this isn't showing up a ton yet:

http://logstash.openstack.org/#dashboard/file/logstash.json?query=message%3A%5C%22BadRequest%3A%20Invalid%20input%20for%20dns_name.%5C%22%20AND%20message%3A%5C%22not%20a%20valid%20PQDN%20or%20FQDN%5C%22%20AND%20message%3A%5C%22must%20not%20start%20or%20end%20with%20a%20hyphen..%5C%22%20AND%20message%3A%5C%22create_port%5C%22%20AND%20tags%3A%5C%22screen-n-cpu.txt%5C%22&from=7d

Matt Riedemann (mriedem)
summary: - BadRequest: Invalid input for dns_name. Reason: 'tempest-server-tempest-
- testsecuritygroupsbasicops-22256548-gen-' not a valid PQDN or FQDN.
- Reason: Name 'tempest-server-tempest-
- testsecuritygroupsbasicops-22256548-gen-' must not start or end with a
- hyphen..
+ BadRequest: Invalid input for dns_name. Name must not start or end with
+ a hyphen.
Revision history for this message
Matt Riedemann (mriedem) wrote :

The hostname is sanitized here:

https://github.com/openstack/nova/blob/e85cf38b949200c0ce36b713ab02e473c7c150f5/nova/utils.py#L777

That's also where it's truncating the name, and it's truncating on the - in the failure case.

Revision history for this message
Matt Riedemann (mriedem) wrote :
Matt Riedemann (mriedem)
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: Matt Riedemann (mriedem) → Matthew Treinish (treinish)
status: Confirmed → In Progress
Changed in nova:
assignee: Matthew Treinish (treinish) → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/279799
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=7e79d83641545e8134a2a142ade8a2fc0b96eade
Submitter: Jenkins
Branch: master

commit 7e79d83641545e8134a2a142ade8a2fc0b96eade
Author: Matthew Treinish <email address hidden>
Date: Fri Feb 12 16:21:37 2016 -0500

    Reorder name normalization for DNS

    Having the truncation step as the last one meant we could truncate to
    a trailing hyphen. This could potential cause a failure for an invalid
    name. This commit reorders the normalization to put the truncation as
    the first step which should avoid that problem.

    Change-Id: I2219f6c73d882efc787127f02fda937f3e3b44eb
    Closes-Bug: #1545153

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 13.0.0.0b3

This issue was fixed in the openstack/nova 13.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.