← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1681784] Re: neutronclient: incorrect treatment of input parameters

 

I confirmed with the patches above that our API behavior has been
consistent on the server side and we have always rejected None as an
input for device_id.


This is not something we can fix in the Neutron server because it's an API change and Heat is using the neutron client to explicitly ask for None as the value for a field. Explicitly requesting None is not the same thing as leaving a field out of the request to allow the server to use the default value. 

Changing the neutron client would block people from actually requesting
a value of None in a field on the server, so that's a non-starter as
well.

For example, if you leave 'gateway_ip' out of a subnet request, it
defaults to the first IP in the CIDR. However, if you explicitly set it
to None, it means you don't want a gateway_ip and we honor that.

In summary, None is a value in Neutron, if you don't want it, you can't
request it.

** Changed in: neutron
       Status: New => Invalid

** Changed in: python-neutronclient
       Status: New => Invalid

** Also affects: heat
   Importance: Undecided
       Status: New

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

Title:
  neutronclient: incorrect treatment of input parameters

Status in heat:
  New
Status in neutron:
  Invalid
Status in python-neutronclient:
  Invalid

Bug description:
  Hi colleagues,

  Neutron 10.0.0 (as part Ocata) on Ubuntu 16.04

  Everything is ok when I use Neutron CLI to update port parameters, but
  when I'm doing the same using Heat, it fails.

  Heat's template for the object is:

    e-secgroup:
      type: OS::Neutron::SecurityGroup
      properties:
        name: SSH_ICMP
        rules:
          - direction: ingress
          - protocol: tcp
            remote_ip_prefix: 0.0.0.0/0
            port_range_min: 22
            port_range_max: 22
          - protocol: icmp
            remote_ip_prefix: 0.0.0.0/0

    node1-wan:
      type: OS::Neutron::Port
      properties:
        name: jadm-node1-wan
        network: e-net
        port_security_enabled: True
        security_groups: [ default, { get_resource: e-secgroup } ]

  Heat makes a call to Neutron using neutronclient and provides input
  parameters in such way:

  updating port with {'allowed_address_pairs': [], 'binding:vnic_type':
  None, 'device_owner': None, 'mac_address': None, 'security_groups': [u
  '53ede63e-b08f-4c95-b5fe-29cd21ed442a', u'0a48c45e-5a6d-
  4b80-8226-08d2e8c5bb00'], 'device_id': None} handle_update
  /usr/lib/python2.7/dist-
  packages/heat/engine/resources/openstack/neutron/port.py:520

  In return, I get the following error:

  2017-04-11 09:51:31.809 14474 DEBUG neutronclient.v2_0.client [req-
  54a51260-8701-4f94-9141-562443a3ad7e - bush - - -] Error message:
  {"NeutronError": {"message": "Invalid input for device_owner. Reason:
  'None' is not a valid string.", "type": "HTTPBadRequest", "detail":
  ""}} _handle_fault_response /usr/lib/python2.7/dist-
  packages/neutronclient/v2_0/client.py:266

  If I explicitly set device_owner='' in Heat template, then
  neutronclient accepts this key-value pair and returns error for the
  next parameter (e.g. device_id):

  2017-04-11 10:45:26.808 14474 DEBUG neutronclient.v2_0.client [req-
  3f5c1c53-bec4-418f-bc0e-e04b23474c0e - bush - - -] Error message:
  {"NeutronError": {"message": "Invalid input for device_id. Reason:
  'None' is not a valid string.", "type": "HTTPBadRequest", "detail":
  ""}} _handle_fault_response /usr/lib/python2.7/dist-
  packages/neutronclient/v2_0/client.py:266

  and this affects not only parameters of OS::Neutron::Port object, but
  OS::Neutron::SecurityGroup's ones as well:

  Resource UPDATE failed: BadRequest: resources.e-secgroup: Invalid
  input for description. Reason: 'None' is not a valid string. Neutron
  server returns request_ids: ['req-287db7f6-06be-4bc8-a11b-
  94be203c67da']

  So, the problem is general and it seems that something wrong with
  treatment of 'None' in input parameters: all clients should always
  treat None values the same as not passing any value, while
  neutronclient accepts '' and refuses None.

  Severity: this bug blocks using Heat.

  Thank you.

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


References