openstack-helm/cinder/templates/bin/_create-internal-tenant-id.sh.tpl
Liang Fang d1c8e778a7 Add internal tenant id in conf
Cinder raw cache feature requires internal tenant id be set in
/etc/cinder/cinder.conf, something like:

cinder_internal_tenant_project_id = b7455b8974bb4064ad247c8f375eae6c
cinder_internal_tenant_user_id = f46924c112a14c80ab0a24a613d95eef

This patch get or create if not exist intenal user id and project id, and then
set in cinder.conf

reference: Cinder cache feature:
https://docs.openstack.org/cinder/latest/admin/blockstorage-image-volume-cache.html

Story: 2004869
Task: 29121
Change-Id: I07954d2efa905a56ca8482d0ec147534c97d01ea
Signed-off-by: Liang Fang <liang.a.fang@intel.com>
2019-04-16 16:09:31 +00:00

32 lines
969 B
Smarty
Executable File

#!/bin/bash
{{/*
Copyright 2019 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -ex
USER_PROJECT_ID=$(openstack project create --or-show --enable -f value -c id \
--domain="${PROJECT_DOMAIN_ID}" \
"${INTERNAL_PROJECT_NAME}");
USER_ID=$(openstack user create --or-show --enable -f value -c id \
--domain="${USER_DOMAIN_ID}" \
--project-domain="${PROJECT_DOMAIN_ID}" \
--project="${USER_PROJECT_ID}" \
"${INTERNAL_USER_NAME}");