← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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"
        ]
    },

** Affects: neutron
     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/1884764

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

Status in neutron:
  New

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


Follow ups