From: Thomas Goirand Date: Mon, 12 Oct 2015 21:43:48 +0000 (+0000) Subject: Setup both v1 and v2 endpoints. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=31b63e80f784546197e61d9384d5ad5d4f743590;p=openstack-build%2Fcinder-build.git Setup both v1 and v2 endpoints. Rewritten-From: 49e1e71606fd2c4569b47bb28fe2ca9c13304d77 --- diff --git a/xenial/debian/changelog b/xenial/debian/changelog index a7a41940a..a880f0335 100644 --- a/xenial/debian/changelog +++ b/xenial/debian/changelog @@ -1,3 +1,9 @@ +cinder (2:7.0.0~rc2-2) experimental; urgency=medium + + * Setup both v1 and v2 endpoints. + + -- Thomas Goirand Mon, 12 Oct 2015 21:41:08 +0000 + cinder (2:7.0.0~rc2-1) experimental; urgency=medium * cinder-api depends on python-openstackclient. diff --git a/xenial/debian/cinder-api.postinst.in b/xenial/debian/cinder-api.postinst.in index 3868b9ae5..8f72438cd 100644 --- a/xenial/debian/cinder-api.postinst.in +++ b/xenial/debian/cinder-api.postinst.in @@ -6,7 +6,58 @@ set -e if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then . /usr/share/debconf/confmodule - pkgos_register_endpoint_postinst cinder cinderv2 volumev2 "Cinder Volume Service" 8776 /v2/'%(tenant_id)s' + + # We need special handling for Cinder, as it needs 2 endpoints + PKG_NAME=cinder + db_get ${PKG_NAME}/register-endpoint + if [ "${RET}" = "true" ] ; then + # Setup the v1 endpoint + db_get ${PKG_NAME}/keystone-ip + KEYSTONE_ENDPOINT_IP=`echo ${RET} | egrep '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'` + db_get ${PKG_NAME}/keystone-auth-token + AUTH_TOKEN=${RET} + db_get ${PKG_NAME}/endpoint-ip + PKG_ENDPOINT_IP=`echo ${RET} | egrep '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'` + db_get ${PKG_NAME}/region-name + REGION_NAME=${RET} + + if [ -n "${KEYSTONE_ENDPOINT_IP}" ] && [ -n "${PKG_ENDPOINT_IP}" ] && [ -n "${REGION_NAME}" ] && [ -n "${AUTH_TOKEN}" ] ; then + SERVICE_NAME=cinder + SERVICE_TYPE=volume + SERVICE_DESC="OpenStack Block Storage" + 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} + 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} +# 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 + echo "Problem in endpoint parameter (IPs or otherwise)." + fi + db_unregister ${PKG_NAME}/register-endpoint + else + echo "Will not register "${SERVICE_NAME}" endpoint this time (no user request for it)." + fi + db_unregister ${PKG_NAME}/keystone-auth-token db_stop fi