Bug 2035814

Summary: [OSP17.0][OVN migration] ovn_migration script generates bad inventory file
Product: Red Hat OpenStack Reporter: Roman Safronov <rsafrono>
Component: openstack-neutronAssignee: Jakub Libosvar <jlibosva>
Status: CLOSED ERRATA QA Contact: Roman Safronov <rsafrono>
Severity: high Docs Contact:
Priority: urgent    
Version: 17.0 (Wallaby)CC: apevec, chrisw, jlibosva, jschluet, lhh, majopela, mtomaska, scohen, skaplons
Target Milestone: AlphaKeywords: Regression, Triaged
Target Release: 17.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-neutron-18.2.1-0.20220330181920.468c7ae.el9ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 12:18:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2019745    

Description Roman Safronov 2021-12-27 19:16:17 UTC
Description of problem:
When trying to prepare for OVN migration according to the official documentation of the latest release, the inventory generated by ovn_migration script is not correct, e.g there are missing nodes in mandatory sections, see [1] below.

Probably this happens because the ansible yaml file retrieved from the OSP17 environment has different format than OSP16 has. See the attached yaml file, generated by this command (similar command runs the ovn_migration script):
/usr/bin/tripleo-ansible-inventory --stack overcloud --static-yaml-inventory /tmp/inventory_file.yaml

Also find below an example of a valid inventory [2]


Version-Release number of selected component (if applicable):
RHOS-17.0-RHEL-8-20211208.n.1

How reproducible:
100%

Steps to Reproduce:
1.Deploy an OSP17.0 environment with ML2/OVS neutron backend
2.Due to BZ2035354 and BZ2035808 do the following workaround:

a)Clone upstream neutron repo stable/wallaby branch (OSP17.0 is based on it) and copy ovn_migration.sh script to /usr/bin and ovn migration ansible playbooks to  ~/ovn_migration (according to the official documentation for the latest OSP version, https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.2/html-single/networking_with_open_virtual_network/index#ml2-ovs-to-ovn-migration-prepare_migrating-ml2ovs-to-ovn), 
i.e.
git clone -b stable/wallaby https://github.com/openstack/neutron.git
sudo cp neutron/tools/ovn_migration/tripleo_environment/ovn_migration.sh /usr/bin/
sudo chmod +x /usr/bin/ovn_migration.sh
cp -r neutron/tools/ovn_migration/tripleo_environment/playbooks/ ~/ovn_migration

b) Comment the line that calls check_stack function (see below)
case $command in
    generate-inventory)
        # check_stack
        oc_check_public_network
        generate_ansible_inventory_file
        generate_ansible_config_file
        ret_val=$?
        ;;




3. Follow the official documentation until step 9 - try to generate inventory 
/home/stack/ovn_migration/start-ovn-migration.sh generate-inventory > /home/stack/ovn_migration/generate-inventory.log 
 

Actual results:
inventory file generated but is not valid, [ovn-dbs], [ovn-controllers], [dhcp] sections are empty, see [1] below

Expected results:
A valid inventory file is generated, see example below [2]

Additional info:

[1]

 [stack@undercloud-0 ovn_migration]$ cat hosts_for_migration
[ovn-dbs]

[ovn-controllers]

[dhcp]


[overcloud-controllers:children]
dhcp

[overcloud:children]
ovn-controllers
ovn-dbs


[overcloud:vars]
remote_user=heat-admin
public_network_name=public
image_name=cirros-0.5.2-x86_64-disk.img
working_dir=/home/stack/ovn_migration
server_user_name=cirros
validate_migration=True
overcloud_ovn_deploy_script=/home/stack/overcloud-deploy-ovn.sh
overcloudrc=/home/stack/overcloudrc
ovn_migration_backups=/var/lib/ovn-migration-backup

[overcloud-controllers:vars]
remote_user=heat-admin
public_network_name=public
image_name=cirros-0.5.2-x86_64-disk.img
working_dir=/home/stack/ovn_migration
server_user_name=cirros
validate_migration=True
overcloud_ovn_deploy_script=/home/stack/overcloud-deploy-ovn.sh
overcloudrc=/home/stack/overcloudrc
ovn_migration_backups=/var/lib/ovn-migration-backup





[2]


[ovn-dbs]
controller-0 ansible_host=192.168.24.29 ovn_central=true ansible_ssh_user=heat-admin ansible_become=true
controller-1 ansible_host=192.168.24.50 ansible_ssh_user=heat-admin ansible_become=true
controller-2 ansible_host=192.168.24.20 ansible_ssh_user=heat-admin ansible_become=true

[ovn-controllers]
compute-0 ansible_host=192.168.24.46 ansible_ssh_user=heat-admin ansible_become=true ovn_controller=true
compute-1 ansible_host=192.168.24.12 ansible_ssh_user=heat-admin ansible_become=true ovn_controller=true
controller-0 ansible_host=192.168.24.29 ansible_ssh_user=heat-admin ansible_become=true ovn_controller=true
controller-1 ansible_host=192.168.24.50 ansible_ssh_user=heat-admin ansible_become=true ovn_controller=true
controller-2 ansible_host=192.168.24.20 ansible_ssh_user=heat-admin ansible_become=true ovn_controller=true

[dhcp]
controller-0 ansible_host=192.168.24.29 ansible_ssh_user=heat-admin ansible_become=true
controller-1 ansible_host=192.168.24.50 ansible_ssh_user=heat-admin ansible_become=true
controller-2 ansible_host=192.168.24.20 ansible_ssh_user=heat-admin ansible_become=true


[overcloud-controllers:children]
dhcp

[overcloud:children]
ovn-controllers
ovn-dbs


[overcloud:vars]
remote_user=heat-admin
public_network_name=nova
image_name=cirros-0.5.2-x86_64-disk.img
working_dir=/home/stack/ovn_migration
server_user_name=cirros
validate_migration=True
overcloud_ovn_deploy_script=/home/stack/overcloud-deploy-ovn.sh
overcloudrc=/home/stack/overcloudrc
ovn_migration_backups=/var/lib/ovn-migration-backup

[overcloud-controllers:vars]
remote_user=heat-admin
public_network_name=nova
image_name=cirros-0.5.2-x86_64-disk.img
working_dir=/home/stack/ovn_migration
server_user_name=cirros
validate_migration=True
overcloud_ovn_deploy_script=/home/stack/overcloud-deploy-ovn.sh
overcloudrc=/home/stack/overcloudrc
ovn_migration_backups=/var/lib/ovn-migration-backup

Comment 7 Roman Safronov 2022-06-20 09:08:26 UTC
Verified that the issue does not occur on RHOS-17.0-RHEL-9-20220615.n.2

Comment 12 errata-xmlrpc 2022-09-21 12:18:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:6543