Add "FLAVOR_NAME" to ovn migration resources creation

- Telco usecases requires a flavor which has to contain "extra_specs"
  to boot a dpdk instance.
  Add the "FLAVOR_NAME" parameter to override the use of the default
  flavor used during migration flow.

- Modify the hardcoded server user name (cirros) to use the
  "SERVER_USER_NAME" environment variable.

Change-Id: I3d50526d3192cafb673092bc8b22da6c48454434
This commit is contained in:
Maxim Babushkin 2021-10-14 12:36:03 +03:00
parent 6d8e830859
commit f09c98bf8c
4 changed files with 16 additions and 5 deletions
tools/ovn_migration/tripleo_environment
ovn_migration.sh
playbooks/roles/resources
create
validate/templates

@ -36,6 +36,7 @@ LANG=C
: ${STACK_NAME:=overcloud}
: ${PUBLIC_NETWORK_NAME:=public}
: ${IMAGE_NAME:=cirros}
: ${FLAVOR_NAME:=ovn-migration}
: ${SERVER_USER_NAME:=cirros}
: ${VALIDATE_MIGRATION:=True}
: ${DHCP_RENEWAL_TIME:=30}
@ -186,6 +187,7 @@ EOF
remote_user=$UNDERCLOUD_NODE_USER
public_network_name=$PUBLIC_NETWORK_NAME
image_name=$IMAGE_NAME
flavor_name=$FLAVOR_NAME
working_dir=$OPT_WORKDIR
server_user_name=$SERVER_USER_NAME
validate_migration=$VALIDATE_MIGRATION
@ -282,6 +284,7 @@ start_migration() {
-i hosts_for_migration -e working_dir=$OPT_WORKDIR \
-e public_network_name=$PUBLIC_NETWORK_NAME \
-e image_name=$IMAGE_NAME \
-e flavor_name=$FLAVOR_NAME \
-e overcloud_ovn_deploy_script=$OVERCLOUD_OVN_DEPLOY_SCRIPT \
-e server_user_name=$SERVER_USER_NAME \
-e overcloudrc=$OVERCLOUDRC_FILE \

@ -1,5 +1,6 @@
---
create_migration_resource_script: create-resources.sh.j2
server_user_name: "cirros"
resource_suffix: "pre"
ovn_migration_temp_dir: "{{ working_dir }}/{{ resource_suffix }}_migration_resources"

@ -4,7 +4,10 @@ set -x
source {{ overcloudrc }}
server_user_name={{ server_user_name }}
flavor_name={{ flavor_name }}
image_name={{ image_name }}
openstack image show $image_name
if [ "$?" != "0" ]
then
@ -18,8 +21,12 @@ then
image_name="cirros-ovn-migration-{{ resource_suffix }}"
fi
openstack flavor create ovn-migration-{{ resource_suffix }} --ram 1024 --disk 1 --vcpus 1
openstack flavor show $flavor_name
if [ "$?" != "0" ]
then
openstack flavor create ovn-migration-{{ resource_suffix }} --ram 1024 --disk 1 --vcpus 1
flavor_name="ovn-migration-{{ resource_suffix }}"
fi
openstack keypair create ovn-migration-{{ resource_suffix }} --private-key {{ ovn_migration_temp_dir }}/ovn_migration_ssh_key
@ -43,7 +50,7 @@ openstack router add subnet ovn-migration-router-{{ resource_suffix }} ovn-migra
openstack port create --network ovn-migration-net-{{ resource_suffix }} --security-group ovn-migration-sg-{{ resource_suffix }} ovn-migration-server-port-{{ resource_suffix }}
openstack server create --flavor ovn-migration-{{ resource_suffix }} --image $image_name \
openstack server create --flavor $flavor_name --image $image_name \
--key-name ovn-migration-{{ resource_suffix }} \
--nic port-id=ovn-migration-server-port-{{ resource_suffix }} ovn-migration-server-{{ resource_suffix }}
@ -120,7 +127,7 @@ do
done
ssh -i {{ ovn_migration_temp_dir }}/ovn_migration_ssh_key -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null cirros@$server_ip date
-o UserKnownHostsFile=/dev/null $server_user_name@$server_ip date
rc=$?

@ -14,6 +14,6 @@ echo "Running ping test with -c 3 to the server ip - $server_ip"
ping -c 3 $server_ip
ssh -i {{ ovn_migration_temp_dir }}/ovn_migration_ssh_key -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null cirros@$server_ip date
-o UserKnownHostsFile=/dev/null {{ server_user_name }}@$server_ip date
echo "Done with the validation"