From 007ac30ed1ebcb02298369cf70c1ffa92368c3dd Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Mon, 2 Nov 2015 18:20:16 +0000 Subject: [PATCH] Using Keystone API v3 to register in the catalog. Rewritten-From: 6d7ee0835593cd69c7967fc880169461cb7cc1e0 --- xenial/debian/changelog | 6 ++++ xenial/debian/cinder-api.postinst.in | 43 +++++++++++++++++++--------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/xenial/debian/changelog b/xenial/debian/changelog index 87285bdf0..25dc864c6 100644 --- a/xenial/debian/changelog +++ b/xenial/debian/changelog @@ -1,3 +1,9 @@ +cinder (2:7.0.0-3) unstable; urgency=medium + + * Using Keystone API v3 to register in the catalog. + + -- Thomas Goirand Mon, 02 Nov 2015 18:19:42 +0000 + cinder (2:7.0.0-2) unstable; urgency=medium * Uploading to unstable. diff --git a/xenial/debian/cinder-api.postinst.in b/xenial/debian/cinder-api.postinst.in index 8f72438cd..7cea903d6 100644 --- a/xenial/debian/cinder-api.postinst.in +++ b/xenial/debian/cinder-api.postinst.in @@ -28,26 +28,41 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then SERVICE_PORT=8776 SERVICE_URL=/v1/'%(tenant_id)s' echo "Registering service and endpoints for ${SERVICE_NAME} with type ${SERVICE_TYPE} at http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL}" - openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v2.0/ service create \ - --name=${SERVICE_NAME} --description="${SERVICE_DESC}" ${SERVICE_TYPE} - openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v2.0/ endpoint create \ - --region "${REGION_NAME}" \ - --publicurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} \--publicurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} \ - --internalurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} \ - --adminurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} ${SERVICE_NAME} + NUM_LINES=$(openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 service list --format=csv | q -d , -H 'SELECT ID FROM - WHERE `Type`="'${SERVICE_TYPE}'"' | wc -l) + if [ "${NUM_LINES}" = "0" ] ; then + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 service create \ + --name=${SERVICE_NAME} --description="${SERVICE_DESC}" ${SERVICE_TYPE} + + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 endpoint create \ + --region "${REGION_NAME}" ${SERVICE_NAME} public http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} + + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 endpoint create \ + --region "${REGION_NAME}" ${SERVICE_NAME} internal http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} + + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 endpoint create \ + --region "${REGION_NAME}" ${SERVICE_NAME} admin http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} + fi + SERVICE_NAME=cinderv2 SERVICE_TYPE=volumev2 SERVICE_DESC="OpenStack Block Storage v2" SERVICE_PORT=8776 SERVICE_URL=/v2/'%(tenant_id)s' echo "Registering service and endpoints for ${SERVICE_NAME} with type ${SERVICE_TYPE} at http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL}" - openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v2.0/ service create \ - --name=${SERVICE_NAME} --description="${SERVICE_DESC}" ${SERVICE_TYPE} - openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v2.0/ endpoint create \ - --region "${REGION_NAME}" \ - --publicurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} \--publicurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} \ - --internalurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} \ - --adminurl=http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} ${SERVICE_NAME} + NUM_LINES=$(openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 service list --format=csv | q -d , -H 'SELECT ID FROM - WHERE `Type`="'${SERVICE_TYPE}'"' | wc -l) + if [ "${NUM_LINES}" = "0" ] ; then + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 service create \ + --name=${SERVICE_NAME} --description="${SERVICE_DESC}" ${SERVICE_TYPE} + + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 endpoint create \ + --region "${REGION_NAME}" ${SERVICE_NAME} public http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} + + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 endpoint create \ + --region "${REGION_NAME}" ${SERVICE_NAME} internal http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} + + openstack --os-token ${AUTH_TOKEN} --os-url=http://${KEYSTONE_ENDPOINT_IP}:35357/v3/ --os-domain-name default --os-identity-api-version=3 endpoint create \ + --region "${REGION_NAME}" ${SERVICE_NAME} admin http://${PKG_ENDPOINT_IP}:${SERVICE_PORT}${SERVICE_URL} + fi # pkgos_register_endpoint_postinst cinder cinder volume "Cinder Volume Service" 8776 /v1/'%(tenant_id)s' # pkgos_register_endpoint_postinst cinder cinderv2 volumev2 "Cinder Volume Service" 8776 /v2/'%(tenant_id)s' else -- 2.45.2