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

Bug #1884764 reported by Roman Safronov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Oliver Walsh

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

Changed in neutron:
assignee: nobody → Roman Safronov (rsafrono)
status: New → In Progress
tags: added: ovn
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Roman Safronov (<email address hidden>) on branch: master
Review: https://review.opendev.org/737546
Reason: No capacity

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/738192

Changed in neutron:
assignee: Roman Safronov (rsafrono) → Jakub Libosvar (libosvar)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

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

Changed in neutron:
assignee: Jakub Libosvar (libosvar) → Oliver Walsh (owalsh)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Jakub Libosvar (<email address hidden>) on branch: master
Review: https://review.opendev.org/738192
Reason: Abandoned in favor of https://review.opendev.org/#/c/738192

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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 <email address hidden>
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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/741145

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/ussuri)

Reviewed: https://review.opendev.org/741145
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=c0fba2007c53e5120ece6eb6ab84e28a87741d04
Submitter: Zuul
Branch: stable/ussuri

commit c0fba2007c53e5120ece6eb6ab84e28a87741d04
Author: Oliver Walsh <email address hidden>
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
    (cherry picked from commit aa6491a9d91bb5aab6bfaba81cf3a82279a551f7)

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