@@ -316,9 +316,10 @@ function configure_nova {
316316
317317# create_nova_accounts() - Set up common required nova accounts
318318
319- # Tenant User Roles
319+ # Project User Roles
320320# ------------------------------------------------------------------
321- # service nova admin, [ResellerAdmin (swift only)]
321+ # SERVICE_TENANT_NAME nova admin
322+ # SERVICE_TENANT_NAME nova ResellerAdmin (if Swift is enabled)
322323
323324# Migrated from keystone_data.sh
324325create_nova_accounts() {
@@ -363,6 +364,48 @@ create_nova_accounts() {
363364 --internalurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v3"
364365 fi
365366 fi
367+
368+ if is_service_enabled n-api; then
369+ # Swift
370+ if is_service_enabled swift; then
371+ # Nova needs ResellerAdmin role to download images when accessing
372+ # swift through the s3 api.
373+ openstack role add \
374+ --project $SERVICE_TENANT_NAME \
375+ --user nova \
376+ ResellerAdmin
377+ fi
378+
379+ # EC2
380+ if [[ "$KEYSTONE_CATALOG_BACKEND" = "sql" ]]; then
381+ openstack service create \
382+ --type ec2 \
383+ --description "EC2 Compatibility Layer" \
384+ ec2
385+ openstack endpoint create \
386+ --region RegionOne \
387+ --publicurl "http://$SERVICE_HOST:8773/services/Cloud" \
388+ --adminurl "http://$SERVICE_HOST:8773/services/Admin" \
389+ --internalurl "http://$SERVICE_HOST:8773/services/Cloud" \
390+ ec2
391+ fi
392+ fi
393+
394+ # S3
395+ if is_service_enabled n-obj swift3; then
396+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
397+ openstack service create \
398+ --type s3 \
399+ --description "S3" \
400+ s3
401+ openstack endpoint create \
402+ --region RegionOne \
403+ --publicurl "http://$SERVICE_HOST:$S3_SERVICE_PORT" \
404+ --adminurl "http://$SERVICE_HOST:$S3_SERVICE_PORT" \
405+ --internalurl "http://$SERVICE_HOST:$S3_SERVICE_PORT" \
406+ s3
407+ fi
408+ fi
366409}
367410
368411# create_nova_conf() - Create a new nova.conf file
0 commit comments