From 2fb1e566b5cf237b17619519746b066614719c23 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Tue, 20 Mar 2018 11:24:38 +0800 Subject: Handle flavor before image JIRA: PARSER-174 Change-Id: I891398e634846db617081b0baed9adf0662743b7 Signed-off-by: shangxdy --- tests/functest_run.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/functest_run.sh b/tests/functest_run.sh index c85219e..3f7656c 100755 --- a/tests/functest_run.sh +++ b/tests/functest_run.sh @@ -74,6 +74,18 @@ download_parser_image() { } register_parser_image_and_flavor() { + + echo "" + [[ ! $(openstack ${debug} flavor show ${VM_FLAVOR_NAME}) ]] && { + echo " Create default flavor ${VM_FLAVOR_NAME}..." + openstack ${debug} flavor create --ram ${VM_FLAVOR_RAM} \ + --vcpus ${VM_FLAVOR_CPUS} \ + --disk ${VM_FLAVOR_DISK} \ + ${VM_FLAVOR_NAME} + } || { + echo " Default flavor ${VM_FLAVOR_NAME} already exsits." + } + openstack ${debug} image list | grep -qwo "${PARSER_IMAGE_NAME}" && { echo " Image ${PARSER_IMAGE_NAME} has bee registed, needn't registe again." return 0 @@ -87,11 +99,6 @@ register_parser_image_and_flavor() { --container-format bare \ --file ${PARSER_IMAGE_FILE} - [[ ! openstack flavor show ${VM_FLAVOR_NAME} ]] && { - echo " Create default flavor ${VM_FLAVOR_NAME}..." - openstack flavor create --ram ${VM_FLAVOR_RAM} \ - --vcpus ${VM_FLAVOR_CPUS} --disk ${VM_FLAVOR_DISK} ${VM_FLAVOR_NAM} - } } create_parser_user_and_project() { @@ -186,8 +193,9 @@ translator_and_deploy_vRNC() { # 1. Delete parser stack ${PARSER_STACK_NAME}, use admin user in admin project openstack ${debug} stack list | grep -qow ${PARSER_STACK_NAME} && { echo " Stack ${PARSER_STACK_NAME} exist, delete it first." - openstack stack delete --yes --wait ${PARSER_STACK_NAME} + openstack ${debug} stack delete --yes --wait ${PARSER_STACK_NAME} } + # 2. Switch env to parser project temporally echo " Switch openstack env to parser project" change_env_to_parser_user_project -- cgit 1.2.3-korg