Move Nova account creation out of keystone_data.sh
Supports the coming HA/proxy configuration for Nova
Change-Id: I2baf1f51486537a1489f1376d38f5710bd96c314
diff --git a/lib/nova b/lib/nova
index 3a4d34d..095c65e 100644
--- a/lib/nova
+++ b/lib/nova
@@ -277,6 +277,46 @@
fi
}
+# create_nova_accounts() - Set up common required nova accounts
+
+# Tenant User Roles
+# ------------------------------------------------------------------
+# service nova admin, [ResellerAdmin (swift only)]
+
+# Migrated from keystone_data.sh
+create_nova_accounts() {
+
+ SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+ ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
+
+ # Nova
+ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
+ NOVA_USER=$(keystone user-create \
+ --name=nova \
+ --pass="$SERVICE_PASSWORD" \
+ --tenant_id $SERVICE_TENANT \
+ --email=nova@example.com \
+ | grep " id " | get_field 2)
+ keystone user-role-add \
+ --tenant_id $SERVICE_TENANT \
+ --user_id $NOVA_USER \
+ --role_id $ADMIN_ROLE
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+ NOVA_SERVICE=$(keystone service-create \
+ --name=nova \
+ --type=compute \
+ --description="Nova Compute Service" \
+ | grep " id " | get_field 2)
+ keystone endpoint-create \
+ --region RegionOne \
+ --service_id $NOVA_SERVICE \
+ --publicurl "http://$SERVICE_HOST:\$(compute_port)s/v2/\$(tenant_id)s" \
+ --adminurl "http://$SERVICE_HOST:\$(compute_port)s/v2/\$(tenant_id)s" \
+ --internalurl "http://$SERVICE_HOST:\$(compute_port)s/v2/\$(tenant_id)s"
+ fi
+ fi
+}
+
# create_nova_conf() - Create a new nova.conf file
function create_nova_conf() {
# Remove legacy ``nova.conf``