create_config (ec2-api-14.0.1) | : | create_config (ec2-api-15.0.0) | ||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
CIRROS_IMAGE_URL="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-dis k.img" | CIRROS_IMAGE_URL="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-dis k.img" | |||
CIRROS_IMAGE_FNAME="cirros-0.3.4-x86_64-disk.img" | CIRROS_IMAGE_FNAME="cirros-0.3.4-x86_64-disk.img" | |||
CIRROS_IMAGE_NAME="cirros" | CIRROS_IMAGE_NAME="cirros" | |||
MAX_FAIL=20 | MAX_FAIL=20 | |||
FLAVOR_NAME="m1.ec2api" | FLAVOR_NAME="m1.ec2api" | |||
FLAVOR_NAME_ALT="m1.ec2api-alt" | FLAVOR_NAME_ALT="m1.ec2api-alt" | |||
if [[ -n "$TOP_DIR" ]]; then | if [[ -n "$TOP_DIR" ]]; then | |||
source $TOP_DIR/accrc/admin/admin | source $TOP_DIR/openrc admin admin | |||
unset OS_AUTH_TYPE | unset OS_CLOUD | |||
#unset OS_AUTH_TYPE | ||||
fi | fi | |||
openstack endpoint list | openstack endpoint list | |||
if [[ "$?" -ne "0" ]]; then | if [[ "$?" -ne "0" ]]; then | |||
die $LINENO "OpenStack CLI doesn't work. Looks like credentials are absent." | die $LINENO "OpenStack CLI doesn't work. Looks like credentials are absent." | |||
fi | fi | |||
EC2_URL=`openstack endpoint list --service ec2 --interface public --os-identity- api-version=3 -c URL -f value` | 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-ap i-version=3 -c URL -f value` | S3_URL=`openstack endpoint list --service s3 --interface public --os-identity-ap i-version=3 -c URL -f value` | |||
skipping to change at line 151 | skipping to change at line 152 | |||
fi | fi | |||
# populate credentials | # populate credentials | |||
openstack ec2 credentials create --user $user_id --project $project_id 1>&2 | openstack ec2 credentials create --user $user_id --project $project_id 1>&2 | |||
line=`openstack ec2 credentials list --user $user_id | grep " $project_id "` | line=`openstack ec2 credentials list --user $user_id | grep " $project_id "` | |||
read ec2_access_key ec2_secret_key <<< `echo $line | awk '{print $2 " " $4 }'` | read ec2_access_key ec2_secret_key <<< `echo $line | awk '{print $2 " " $4 }'` | |||
source "$venv_dir/bin/activate" | source "$venv_dir/bin/activate" | |||
aws configure set aws_access_key_id $ec2_access_key --profile user | aws configure set aws_access_key_id $ec2_access_key --profile user | |||
aws configure set aws_secret_access_key $ec2_secret_key --profile user | aws configure set aws_secret_access_key $ec2_secret_key --profile user | |||
deactivate | deactivate | |||
env|sort | ||||
auth="--os-project-name $project_name --os-username $user_name --os-password pas sword" | auth="--os-project-name $project_name --os-username $user_name --os-password pas sword" | |||
# create EBS image | # create EBS image | |||
volume_status() { openstack $auth volume show $1 | awk '/ status / {print $4}'; } | volume_status() { openstack $auth volume show $1 | awk '/ status / {print $4}'; } | |||
instance_status() { openstack $auth server show $1 | awk '/ status / {print $4}' ; } | instance_status() { openstack $auth server show $1 | awk '/ status / {print $4}' ; } | |||
openstack_image_id=$(openstack $auth image list --long | grep "cirros" | grep " bare " | head -1 | awk '{print $2}') | openstack_image_id=$(openstack $auth image list --long | grep "cirros" | grep " bare " | head -1 | awk '{print $2}') | |||
if [[ -n "$openstack_image_id" ]]; then | if [[ -n "$openstack_image_id" ]]; then | |||
volume_name="vol-$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8)" | volume_name="vol-$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8)" | |||
volume_id=$(openstack $auth volume create --image $openstack_image_id --size 1 $volume_name | awk '/ id / {print $4}') | volume_id=$(openstack $auth volume create --image $openstack_image_id --size 1 $volume_name | awk '/ id / {print $4}') | |||
skipping to change at line 281 | skipping to change at line 283 | |||
warn $LINENO "Bundling of image $CIRROS_IMAGE_URL failed." | warn $LINENO "Bundling of image $CIRROS_IMAGE_URL failed." | |||
fi | fi | |||
# next line is example how to register this image in the cloud | # next line is example how to register this image in the cloud | |||
#source "$venv_dir/bin/activate" | #source "$venv_dir/bin/activate" | |||
#aws --endpoint-url $EC2_URL --region RegionOne --profile admin ec2 register-i mage --image-location "$AWS_AMI_BUCKET/$CIRROS_IMAGE_FNAME.manifest.xml" --name "$CIRROS_IMAGE_FNAME" --architecture x86_64 | #aws --endpoint-url $EC2_URL --region RegionOne --profile admin ec2 register-i mage --image-location "$AWS_AMI_BUCKET/$CIRROS_IMAGE_FNAME.manifest.xml" --name "$CIRROS_IMAGE_FNAME" --architecture x86_64 | |||
#deactivate | #deactivate | |||
else | else | |||
warn $LINENO "Downloading of image $CIRROS_IMAGE_URL failed." | warn $LINENO "Downloading of image $CIRROS_IMAGE_URL failed." | |||
fi | fi | |||
vpnaas_enabled='False' | ||||
if openstack extension list | grep -q " vpnaas " ; then | ||||
vpnaas_enabled='True' | ||||
fi | ||||
sudo bash -c "cat > $EC2API_DIR/$TEST_CONFIG <<EOF | sudo bash -c "cat > $EC2API_DIR/$TEST_CONFIG <<EOF | |||
[aws] | [aws] | |||
ec2_url = $EC2_URL | ec2_url = $EC2_URL | |||
s3_url = $S3_URL | s3_url = $S3_URL | |||
aws_access = $ec2_access_key | aws_access = $ec2_access_key | |||
aws_secret = $ec2_secret_key | aws_secret = $ec2_secret_key | |||
image_id = $image_id | image_id = $image_id | |||
image_id_ubuntu = $image_id_ubuntu | image_id_ubuntu = $image_id_ubuntu | |||
ebs_image_id = $ebs_image_id | ebs_image_id = $ebs_image_id | |||
build_timeout = $timeout | build_timeout = $timeout | |||
run_long_tests = $run_long_tests | run_long_tests = $run_long_tests | |||
instance_type = $FLAVOR_NAME | instance_type = $FLAVOR_NAME | |||
instance_type_alt = $FLAVOR_NAME_ALT | instance_type_alt = $FLAVOR_NAME_ALT | |||
ami_image_location = $cirros_image_manifest | ami_image_location = $cirros_image_manifest | |||
run_ssh = $run_ssh | run_ssh = $run_ssh | |||
vpnaas_enabled = $vpnaas_enabled | ||||
ca_bundle = $OS_CACERT | ca_bundle = $OS_CACERT | |||
EOF" | EOF" | |||
sudo chown -f $STACK_USER $EC2API_DIR/$TEST_CONFIG | sudo chown -f $STACK_USER $EC2API_DIR/$TEST_CONFIG | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 10 lines changed or added |