remove using euca2ools in install script

Change-Id: Ieff34b88d857727e02a3918908b2719535ff4b55
This commit is contained in:
Andrey Pavlov 2016-03-17 13:52:50 +03:00
parent 4401342a00
commit 7fc6b47613
4 changed files with 44 additions and 13 deletions

View File

@ -33,18 +33,28 @@ if [[ "$?" -ne "0" ]]; then
die $LINENO "OpenStack CLI doesn't work. Looks like credentials are absent."
fi
EC2_URL=`openstack endpoint list --service ec2 --interface public --os-identity-api-version=3 -c URL -f value`
S3_URL=`openstack endpoint list --service s3 --interface public --os-identity-api-version=3 -c URL -f value`
# in some cases these packages can present in the system but don't work
# reinstalling can help
euca-describe-images
aws --version
if [[ "$?" -ne "0" ]]; then
sudo apt-get purge euca2ools python-requestbuilder -fy
sudo apt-get install euca2ools python-requestbuilder -fy
euca-describe-images
sudo pip install awscli --upgrade
aws --version
if [[ "$?" -ne "0" ]]; then
die $LINENO "Looks like euca2ools is not correctly installed."
die $LINENO "Looks like awscli is not correctly installed."
fi
fi
project_id=`openstack project show $OS_PROJECT_NAME -c id -f value`
openstack ec2 credentials create 1>&2
line=`openstack ec2 credentials list | grep " $project_id "`
read ec2_access_key ec2_secret_key <<< `echo $line | awk '{print $2 " " $4 }'`
aws configure set aws_access_key_id $ec2_access_key --profile admin
aws configure set aws_secret_access_key $ec2_secret_key --profile admin
AWS_PARAMS="--region $REGION_NAME --endpoint-url $EC2_URL"
neutron_item=$(openstack service list | grep neutron)
# prepare flavors
@ -57,7 +67,7 @@ wget -nv -P /tmp $CIRROS_IMAGE_URL &
cirros_image_wget_pid=$!
# find simple image
image_id=$(euca-describe-images --show-empty-fields | grep "cirros" | grep "ami-" | head -n 1 | awk '{print $2}')
image_id=`aws $AWS_PARAMS --profile admin ec2 describe-images --filters Name=image-type,Values=machine Name=name,Values=cirros* --query 'Images[0].ImageId' --output text`
# prepare ubuntu image
if [[ $RUN_LONG_TESTS == "1" ]]; then
@ -107,8 +117,9 @@ fi
openstack ec2 credentials create --user $user_id --project $project_id 1>&2
line=`openstack ec2 credentials list --user $user_id | grep " $project_id "`
read ec2_access_key ec2_secret_key <<< `echo $line | awk '{print $2 " " $4 }'`
aws configure set aws_access_key_id $ec2_access_key --profile user
aws configure set aws_secret_access_key $ec2_secret_key --profile user
ec2_auth="-I $ec2_access_key -S $ec2_secret_key"
auth="--os-project-name $project_name --os-username $user_name --os-password password"
# create EBS image
@ -166,7 +177,7 @@ if [[ -n "$openstack_image_id" ]]; then
if [[ "$?" -ne "0" ]]; then
die $LINENO "Image creation from instance fails"
fi
ebs_image_id=$(euca-describe-images $ec2_auth --show-empty-fields | grep $image_name | awk '{print $2}')
ebs_image_id=`aws $AWS_PARAMS --profile user ec2 describe-images --filters Name=image-type,Values=machine Name=name,Values=$image_name --query 'Images[0].ImageId' --output text`
nova $auth delete $instance_id
fi
@ -184,7 +195,9 @@ if [[ -n "$neutron_item" ]]; then
fi
wait $cirros_image_wget_pid
if [[ "$?" -eq "0" ]]; then
#if [[ "$?" -eq "0" ]]; then
#TODO:
if [[ "$?" -eq "1000" ]]; then
mkdir -p /tmp/cirros
# do it under sudo because admin-pk is not accessible under user
sudo euca-bundle-image -i /tmp/$CIRROS_IMAGE_FNAME -d /tmp/cirrosimage -r x86_64 -c $EC2_CERT -k $EC2_PRIVATE_KEY --ec2cert $EUCALYPTUS_CERT --user $EC2_USER_ID

View File

@ -1,5 +1,8 @@
# Devstack settings
# Enable Nova Cert service
enable_service n-crt
# we have to add ec2-api to enabled services for screen_it to work
enable_service ec2-api
enable_service ec2-api-metadata

View File

@ -61,10 +61,24 @@ RETVAL=$?
deactivate
# list resources to check what left after tests
euca-describe-instances
euca-describe-images
euca-describe-volumes
euca-describe-snapshots
EC2_URL=`openstack endpoint list --service ec2 --interface public --os-identity-api-version=3 -c URL -f value`
AWS_PARAMS="--region $REGION_NAME --endpoint-url $EC2_URL"
echo "========================================================================================================"
echo "==================================================================================== Admin resources ==="
echo "========================================================================================================"
aws $AWS_PARAMS --profile admin ec2 describe-instances
aws $AWS_PARAMS --profile admin ec2 describe-images
aws $AWS_PARAMS --profile admin ec2 describe-volumes
aws $AWS_PARAMS --profile admin ec2 describe-snashots
echo "========================================================================================================"
echo "===================================================================================== User resources ==="
echo "========================================================================================================"
aws $AWS_PARAMS --profile user ec2 describe-instances
aws $AWS_PARAMS --profile user ec2 describe-images
aws $AWS_PARAMS --profile user ec2 describe-volumes
aws $AWS_PARAMS --profile user ec2 describe-snashots
openstack server list --all-projects
openstack image list
openstack volume list --all-projects

View File

@ -72,6 +72,7 @@ class ImageTest(base.EC2TestCase):
self.assertEqual(1, len(data['Images']))
self.assertEqual(image_id, data['Images'][0]['ImageId'])
@testtools.skipUnless(CONF.aws.image_id, "Image id is not defined")
def test_check_image_operations_negative(self):
# NOTE(andrey-mp): image_id is a public image created by admin
image_id = CONF.aws.image_id