[ovn-migration] Add debug information to create-resources.sh.j2 scripts

Port status, server status and server console log output are printed
when the create-resources.sh script fails during the OVN migration
Example: OVN migration fails because SSH connection is not possible,
after ping successfully replied - probably a metadata issue and having
the console logs could help to identify it

Change-Id: I83e55203907526caf44ba34cd38241eccf70adb3
This commit is contained in:
Eduardo Olivares 2022-02-14 14:40:32 +01:00
parent b072cbf05f
commit 480c643dd9
2 changed files with 24 additions and 1 deletions
tools/ovn_migration
infrared/tripleo-ovn-migration/roles/create-resources/templates
tripleo_environment/playbooks/roles/resources/create/templates

@ -65,6 +65,8 @@ do
if [ $num_attempts -gt 24 ]
then
echo "VM is not up even after 2 minutes. Something is wrong"
# printing server information for debugging
openstack server show ovn-migration-server-{{ resource_suffix }}-$i
exit 1
fi
done
@ -86,6 +88,8 @@ do
if [ $num_attempts -gt 24 ]
then
echo "Port is not up even after 2 minutes. Something is wrong"
# printing port information for debugging
openstack port show $port_id
exit 1
fi
done
@ -140,6 +144,9 @@ do
if [ $num_attempts -gt 60 ]
then
echo "VM is not pingable. Something is wrong."
# printing server information for debugging
server_id=$(openstack server list -f value | grep $server_ip | awk '{print $1}')
openstack console log show $server_id
exit 1
fi
fi
@ -147,6 +154,16 @@ do
ssh -i {{ ovn_migration_temp_dir }}/ovn_migration_ssh_key -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null cirros@$server_ip date
rc=$?
if [ "$rc" != "0" ]
then
echo "VM not accessible via ssh. Something went wrong. Exiting with rc=$rc"
# printing server information for debugging purposes
server_id=$(openstack server list -f value | grep $server_ip | awk '{print $1}')
openstack console log show $server_id
exit $rc
fi
done
echo "Done with the resource creation : exiting"

@ -78,6 +78,8 @@ do
if [ $num_attempts -gt 24 ]
then
echo "Port is not up even after 2 minutes. Something is wrong"
# printing port information for debugging
openstack port show ovn-migration-server-port-{{ resource_suffix }}
exit 1
fi
done
@ -120,7 +122,9 @@ do
if [ $num_attempts -gt 60 ]
then
echo "VM is not reachable. Something is wrong."
# Even though something seems wrong, lets try and ping.
# printing server information for debugging
server_id=$(openstack server list -f value | grep $server_ip | awk '{print $1}')
openstack console log show $server_id
exit 1
fi
fi
@ -132,4 +136,6 @@ ssh -i {{ ovn_migration_temp_dir }}/ovn_migration_ssh_key -o StrictHostKeyChecki
rc=$?
echo "Done with the resource creation : exiting with $rc"
# printing server information for debugging
[ "$rc" != "0" ] && openstack console log show $(openstack server list -f value | grep $server_ip | awk '{print $1}')
exit $rc