NeutronMechanismDrivers should be a list not a string in environment files

Bug #1836011 reported by waleed mousa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
New
Undecided
Steve Baker

Bug Description

Having NeutronMechanismDrivers as a string may cause issues specially with non-ovn deployments and if the value contains a sub-string(ovn) like sriovnicswitch as this condition [1] will be achieved even the deployment is not ovn
[1]https://github.com/openstack/tripleo-heat-templates/blob/master/deployment/neutron/neutron-api-container-puppet.yaml#L172

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tripleo-heat-templates (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/670011

Revision history for this message
Saravanan KR (skramaja) wrote :

The problem is with this condition in service - neutron-api-container-puppet.yaml

  is_ovn_in_neutron_mechanism_driver: {contains: ['ovn', {get_param: NeutronMechanismDrivers}]}

Providing the parameter NeutronMechanismDrivers with value as "mlnx_sdn_assist,sriovnicswitch,openvswitch", which is a valid input as the type of the variable is comma_delimited_list. But for some reason, the conditions evaluation is no done after converting to the list. So instead of matching to the whole word, it matches to the sub-string "ovn" in "sriovnicswitch", causing it to choose ovn by default always.

The patch https://review.opendev.org/#/c/670011/ attempts to change all the instances of NeutronMechanismDrivers to be a list, so that heat will do a whole word match on list. Though this will solve the issue for all existing environments, it will still have the issue if the parameter is provided in user environments in the problematic format.

The appropriate fix should be to update the condition to ensure that it is matches with whole word. May be yaql based condition could help?

Revision history for this message
Saravanan KR (skramaja) wrote :

I did a quick validation with using this. The condition doesn't look like the problem. According the below test, it is working as expected. Matching the whole word.

It looks like some other issue.

--------------------------------------------------------
(undercloud) [stack@undercloud heat]$ cat test.yaml
heat_template_version: queens

description: >
  OpenStack containerized Neutron API service

parameters:
  NeutronMechanismDrivers:
    default: 'ovn'
    description: |
        The mechanism drivers for the Neutron tenant network.
    type: comma_delimited_list

conditions:
  is_ovn_in_neutron_mechanism_driver: {contains: ['ovn', {get_param: NeutronMechanismDrivers}]}

outputs:
  role_data:
    description: Role data for the Neutron API role.
    value:
      service_name: neutron_api
      input:
        get_param: NeutronMechanismDrivers
      check:
        if:
        - is_ovn_in_neutron_mechanism_driver
        - "yes"
        - "no"

(undercloud) [stack@undercloud heat]$ cat env.yaml
parameter_defaults:
  NeutronMechanismDrivers: 'mlnx_sdn_assist,sriovnicswitch,openvswitch'
(undercloud) [stack@undercloud heat]$

Revision history for this message
Saravanan KR (skramaja) wrote :

Another problematic area could be here, this condition will fail if the give parameter is a string.
https://github.com/openstack/tripleo-common/blob/stable/stein/tripleo_common/image/kolla_builder.py#L124

Discussed with Waleed about the test to be performed to confirm if this is the issue.

Revision history for this message
waleed mousa (waleedm) wrote :

I tried it but didn't solve the issue, the deployment still failing and the neutron-server-ovn is generated

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Waleed, could you please paste the portion of the environment file where you're setting NeutronMechanismDrivers?

Changed in tripleo:
assignee: nobody → Steve Baker (steve-stevebaker)
Revision history for this message
waleed mousa (waleedm) wrote :
Revision history for this message
waleed mousa (waleedm) wrote :

Any updates here?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tripleo-heat-templates (master)

Reviewed: https://review.opendev.org/670011
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=68c2d3ae072d2bb152996f69bf8531d8c5eb40da
Submitter: Zuul
Branch: master

commit 68c2d3ae072d2bb152996f69bf8531d8c5eb40da
Author: waleed mousa <email address hidden>
Date: Wed Jul 10 04:18:56 2019 -0400

    Moving NeutronMechanismDrivers value to be list in neutron-ml2-mlnx-sdn.yaml

    Having NeutronMechanismDrivers as a string causing issues
    specially with non-ovn deployments and if the value contains a
    sub-string(ovn) like sriovnicswitch, so just moving it to be a list of
    strings

    Change-Id: Id01951bca724417db91225efeaaeb1b85e06eb70
    Related-Bug: #1836011

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tripleo-heat-templates (stable/stein)

Related fix proposed to branch: stable/stein
Review: https://review.opendev.org/673410

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tripleo-heat-templates (stable/stein)

Reviewed: https://review.opendev.org/673410
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=4aa55749474b283fe1079becd14fef91ac7491f8
Submitter: Zuul
Branch: stable/stein

commit 4aa55749474b283fe1079becd14fef91ac7491f8
Author: waleed mousa <email address hidden>
Date: Wed Jul 10 04:18:56 2019 -0400

    Moving NeutronMechanismDrivers value to be list in neutron-ml2-mlnx-sdn.yaml

    Having NeutronMechanismDrivers as a string causing issues
    specially with non-ovn deployments and if the value contains a
    sub-string(ovn) like sriovnicswitch, so just moving it to be a list of
    strings

    Change-Id: Id01951bca724417db91225efeaaeb1b85e06eb70
    Related-Bug: #1836011
    (cherry picked from commit 68c2d3ae072d2bb152996f69bf8531d8c5eb40da)

tags: added: in-stable-stein
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.