← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1884764] Re: Some overcloud nodes are missing in the ansible inventory file generated for migration to ML2OVN

 

Reviewed:  https://review.opendev.org/738212
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=aa6491a9d91bb5aab6bfaba81cf3a82279a551f7
Submitter: Zuul
Branch:    master

commit aa6491a9d91bb5aab6bfaba81cf3a82279a551f7
Author: Oliver Walsh <owalsh@xxxxxxxxxx>
Date:   Fri Jun 26 15:04:56 2020 +0100

    migration: Use ansible-inventory to parse tripleo inventory
    
    Instead of adapting to changes to the tripleo inventory structure let
    ansible parse it for us using ansible-inventory.
    
    Change-Id: I34ad0fd5feed65dd1266993a77f6ebc69fecfdfb
    Closes-bug: #1884764


** Changed in: neutron
       Status: In Progress => Fix Released

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

Title:
  Some overcloud nodes are missing in the ansible inventory file
  generated for migration to ML2OVN

Status in neutron:
  Fix Released

Bug description:
  When trying to perform a migration from ml2ovs to ml2ovn using
  migration tool, ovn_migration.sh script creates a file
  hosts_for_migration which includes only single controller and single
  compute node even on environments with more than 1 compute and
  controller nodes.

  The problem started to happen because output of "/usr/bin/tripleo-
  ansible-inventory --list" changed after some recent tripleo change.

  When running get_role_hosts function from
  tools/ovn_migration/tripleo_environment/ovn_migration.sh:L143
  (get_role_hosts /tmp/ansible-inventory.txt neutron_api) on an
  environment with 3 controller nodes now we get the following :

  jq: error (at /tmp/ansible-inventory.txt:1): Cannot iterate over null (null)
  controller-0

  in the past the output was correct:
  controller-0 controller-1 controller-2

  similar for   tools/ovn_migration/tripleo_environment/ovn_migration.sh:L158
  get_role_hosts /tmp/ansible-inventory.txt   neutron_ovs_agent

  jq: error (at ansible-inventory_osp16.1_ovs:1): Cannot iterate over null (null)
  compute-0 controller-0

  while correct output should be:
  controller-0 controller-1 controller-2 compute-0 compute-1


  Possible solution is to replace L93 in  tools/ovn_migration/tripleo_environment/ovn_migration.sh
  from
  roles=`jq -r  \.$role_name\.children\[\] $inventory_file`
  to 
  roles=`roles=`jq -r  \.overcloud_$role_name\.children\[\] $inventory_file ||  jq -r  \.$role_name\.children\[\] $inventory_file`

  In this case the function returns proper lists of nodes for old and
  new  ansible-inventory file format.

  
  Some details:

  output of jq command from tools/ovn_migration/tripleo_environment/ovn_migration.sh:L93
  old inventory format
  [stack@undercloud-0 ~]$ jq -r  \.neutron_api\.children\[\] /tmp/ansible-inventory.txt
  Controller

  new inventory format
  (overcloud) [stack@undercloud-0 ~]$ jq -r  \.neutron_api\.children\[\] /tmp/ansible-inventory.txt
  overcloud_neutron_api

  
  related snippet from old tripleo-ansible-inventory format:
  ...
      "neutron_api": {
          "children": [
              "Controller"
          ],
          "vars": {
              "ansible_ssh_user": "heat-admin"
          }
      },
  ...

  related snippet from new tripleo-ansible-inventory format:
  ...
     "neutron_api": {
          "children": [
              "overcloud_neutron_api"
          ]
      },
      "overcloud_neutron_api": {
          "children": [
              "overcloud_Controller"
          ]
      },

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


References