Skip to content

Commit

Permalink
liberty support on R3.0
Browse files Browse the repository at this point in the history
Provisioning changes to support liberty openstack release with contrail

Partial-Bug: #1547784

Change-Id: I9ff9c6cc49152e2416b9730fa13352d3d507267f
  • Loading branch information
a committed Mar 10, 2016
1 parent 08dc81e commit 86759bc
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 47 deletions.
9 changes: 9 additions & 0 deletions contrail_provisioning/compute/scripts/compute-server-setup.sh
Expand Up @@ -89,8 +89,17 @@ if [ $CONTROLLER != $COMPUTE ] ; then
nova_compute_version_without_epoch=`echo $nova_compute_version`
fi

kilo_or_above=0
dpkg --compare-versions $nova_compute_version_without_epoch ge 2015
if [ $? -eq 0 ]; then
kilo_or_above=1
else
if [[ $nova_compute_version == *"12.0.0"* ]]; then
kilo_or_above=1
fi
fi

if [ $kilo_or_above -eq 1 ] ; then
openstack-config --set /etc/nova/nova.conf neutron admin_auth_url ${AUTH_PROTOCOL}://$CONTROLLER:35357/v2.0/
openstack-config --set /etc/nova/nova.conf neutron admin_username $OS_NET
openstack-config --set /etc/nova/nova.conf neutron admin_password $ADMIN_TOKEN
Expand Down
18 changes: 17 additions & 1 deletion contrail_provisioning/config/scripts/quantum-server-setup.sh
Expand Up @@ -99,7 +99,23 @@ if [ -d /etc/neutron ]; then
openstack-config --set /etc/neutron/neutron.conf DEFAULT core_plugin neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2
openstack-config --set /etc/neutron/neutron.conf DEFAULT api_extensions_path extensions:${PYDIST}/neutron_plugin_contrail/extensions
openstack-config --set /etc/neutron/neutron.conf DEFAULT rabbit_hosts $AMQP_SERVER
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins neutron_plugin_contrail.plugins.opencontrail.loadbalancer.plugin.LoadBalancerPlugin
liberty_ubuntu=0
if [ $is_ubuntu -eq 1 ] ; then
neutron_server_version=`dpkg -l | grep 'ii' | grep nova-api | awk '{print $3}'`
if [[ $neutron_server_version == *"12.0.0"* ]]; then
liberty_ubuntu=1
fi
fi
if [ $is_ubuntu -eq 1 ] && [ $liberty_ubuntu -eq 1 ] ; then
# for liberty loadbalanacer plugin would be V2 by default and
# neutron_lbaas extensions would be needed in api_extensions_path
openstack-config --set /etc/neutron/neutron.conf DEFAULT api_extensions_path extensions:${PYDIST}/neutron_plugin_contrail/extensions:${PYDIST}/neutron_lbaas/extensions
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins neutron_plugin_contrail.plugins.opencontrail.loadbalancer.v2.plugin.LoadBalancerPluginV2
else
openstack-config --set /etc/neutron/neutron.conf DEFAULT api_extensions_path extensions:${PYDIST}/neutron_plugin_contrail/extensions
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins neutron_plugin_contrail.plugins.opencontrail.loadbalancer.plugin.LoadBalancerPlugin
fi

openstack-config --del /etc/neutron/neutron.conf service_providers service_provider
openstack-config --set /etc/neutron/neutron.conf service_providers service_provider LOADBALANCER:Opencontrail:neutron_plugin_contrail.plugins.opencontrail.loadbalancer.driver.OpencontrailLoadbalancerDriver:default
else
Expand Down
27 changes: 23 additions & 4 deletions contrail_provisioning/openstack/scripts/contrail-keystone-setup.sh
Expand Up @@ -37,9 +37,12 @@ ENABLE_ENDPOINTS=yes
#ENABLE_QUANTUM=yes
if [ -f /etc/redhat-release ]; then
rpm -q contrail-heat > /dev/null && ENABLE_HEAT='yes'
is_ubuntu=0
fi
if [ -f /etc/lsb-release ] && egrep -q 'DISTRIB_ID.*Ubuntu' /etc/lsb-release; then
dpkg -l contrail-heat > /dev/null && ENABLE_HEAT='yes'
is_ubuntu=1
keystone_version=`dpkg -l | grep 'ii' | grep keystone | grep -v python | awk '{print $3}'`
fi

if [ -z $ADMIN_PASSWORD ]; then
Expand Down Expand Up @@ -196,12 +199,28 @@ keystone user-role-add --tenant-id $SERVICE_TENANT \
--role-id $ADMIN_ROLE
fi

ubuntu_liberty=0
if [ $is_ubuntu -eq 1 ]; then
if [[ $keystone_version == *"8.0.0"* ]]; then
ubuntu_liberty=1
fi
fi

+source /etc/contrail/openstackrc

if [[ -n "$ENABLE_ENDPOINTS" ]]; then
if [ -z $(endpoint_lookup $NOVA_SERVICE) ]; then
keystone endpoint-create --region $OS_REGION_NAME --service-id $NOVA_SERVICE \
--publicurl 'http://'$CONTROLLER':$(compute_port)s/v1.1/$(tenant_id)s' \
--adminurl 'http://'$CONTROLLER:'$(compute_port)s/v1.1/$(tenant_id)s' \
--internalurl 'http://'$CONTROLLER:'$(compute_port)s/v1.1/$(tenant_id)s'
if [ $ubuntu_liberty -eq 1 ]; then
openstack endpoint create --region RegionOne $NOVA_SERVICE \
--publicurl http://$CONTROLLER:8774/v1.1/%\(tenant_id\)s \
--adminurl http://$CONTROLLER:8774/v1.1/%\(tenant_id\)s \
--internalurl http://$CONTROLLER:8774/v1.1/%\(tenant_id\)s
else
keystone endpoint-create --region RegionOne --service-id $NOVA_SERVICE \
--publicurl 'http://'$CONTROLLER':$(compute_port)s/v1.1/$(tenant_id)s' \
--adminurl 'http://'$CONTROLLER:'$(compute_port)s/v1.1/$(tenant_id)s' \
--internalurl 'http://'$CONTROLLER:'$(compute_port)s/v1.1/$(tenant_id)s'
fi
fi
fi

Expand Down
Expand Up @@ -31,6 +31,8 @@ if [ -f /etc/lsb-release ] && egrep -q 'DISTRIB_ID.*Ubuntu' /etc/lsb-release; th
is_redhat=0
web_svc=apache2
mysql_svc=mysql
glance_api_ver=`dpkg -l | grep 'ii' | grep glance-api | awk '{print $3}'`
echo $glance_api_ver
fi

function error_exit
Expand Down Expand Up @@ -137,11 +139,18 @@ for cfg in api registry; do
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken admin_password $ADMIN_TOKEN
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-$cfg.conf paste_deploy flavor keystone
if [ $is_ubuntu -eq 1 ] ; then
if [[ $glance_api_ver == *"11.0.0"* ]]; then
openstack-config --set /etc/glance/glance-$cfg.conf glance_store filesystem_store_datadirs /var/lib/glance/images/
fi
fi
if [ "$INTERNAL_VIP" != "none" ]; then
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken identity_uri http://$INTERNAL_VIP:5000
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken auth_host $INTERNAL_VIP
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken auth_port 5000
openstack-config --set /etc/glance/glance-$cfg.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-$cfg.conf database idle_timeout 180
openstack-config --set /etc/glance/glance-$cfg.conf database min_pool_size 100
openstack-config --set /etc/glance/glance-$cfg.conf database max_pool_size 700
Expand Down
61 changes: 33 additions & 28 deletions contrail_provisioning/openstack/scripts/keystone-server-setup.sh
Expand Up @@ -164,21 +164,6 @@ for APP in keystone; do
fi
done

if [ "$INTERNAL_VIP" != "none" ]; then
# Required only in first openstack node, as the mysql db is replicated using galera.
if [ "$OPENSTACK_INDEX" -eq 1 ]; then
(source $CONF_DIR/keystonerc; bash contrail-ha-keystone-setup.sh $INTERNAL_VIP)
if [ $? != 0 ]; then
exit 1
fi
fi
else
(source $CONF_DIR/keystonerc; bash contrail-keystone-setup.sh $CONTROLLER)
if [ $? != 0 ]; then
exit 1
fi
fi

# wait for the keystone service to start
tries=0
while [ $tries -lt 10 ]; do
Expand All @@ -188,14 +173,27 @@ while [ $tries -lt 10 ]; do
sleep 1
done

# Check if ADMIN/SERVICE Password has been set

if [ $is_ubuntu -eq 1 ] ; then
ubuntu_kilo_or_above=0
if [[ $keystone_version == *":"* ]]; then
keystone_version_without_epoch=`echo $keystone_version | cut -d':' -f2`
else
keystone_version_without_epoch=`echo $keystone_version`
fi
dpkg --compare-versions $keystone_version_without_epoch ge 2015
if [ $? -eq 0 ]; then
ubuntu_kilo_or_above=1
else
# starting liberty package versioning is changed to x.y.z from 2015.x.y
if [[ $keystone_version_without_epoch == *"8.0.0"* ]]; then
ubuntu_kilo_or_above=1
else
ubuntu_kilo_or_above=0
fi
fi
else
is_kilo_or_above=$(python -c "from distutils.version import LooseVersion; \
print LooseVersion('$keystone_version') >= LooseVersion('2015.1.1')")
fi

# Update all config files with service username and password
Expand All @@ -211,17 +209,13 @@ for svc in keystone; do
openstack-config --set /etc/$svc/$svc.conf identity driver keystone.identity.backends.sql.Identity

if [ $is_ubuntu -eq 1 ] ; then
dpkg --compare-versions $keystone_version_without_epoch ge 2015
if [ $? -eq 0 ]; then
if [ $ubuntu_kilo_or_above -eq 1 ] ; then
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.persistence.backends.memcache.Token
else
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.backends.memcache.Token
fi
else

# For Kilo openstack release, set keystone.token.persistence.backends.memcache.Token
is_kilo_or_above=$(python -c "from distutils.version import LooseVersion; \
print LooseVersion('$keystone_version') >= LooseVersion('2015.1.1')")
if [ "$is_kilo_or_above" == "True" ]; then
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.persistence.backends.memcache.Token
else
Expand All @@ -243,15 +237,12 @@ if [ "$INTERNAL_VIP" != "none" ]; then
# Openstack HA specific config
openstack-config --set /etc/keystone/keystone.conf sql connection mysql://keystone:$SERVICE_DBPASS@$CONTROLLER:3306/keystone
if [ $is_ubuntu -eq 1 ] ; then
dpkg --compare-versions $keystone_version_without_epoch ge 2015
if [ $? -eq 0 ]; then
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.persistence.backends.sql.Token
if [ $ubuntu_kilo_or_above -eq 1 ] ; then
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.persistence.backends.memcache.Token
else
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.backends.sql.Token
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.backends.memcache.Token
fi
else
is_kilo_or_above=$(python -c "from distutils.version import LooseVersion; \
print LooseVersion('$keystone_version') >= LooseVersion('2015.1.1')")
if [ "$is_kilo_or_above" == "True" ]; then
openstack-config --set /etc/$svc/$svc.conf token driver keystone.token.persistence.backends.sql.Token
else
Expand Down Expand Up @@ -318,3 +309,17 @@ done
# Start keysotne service
service keystone restart

if [ "$INTERNAL_VIP" != "none" ]; then
# Required only in first openstack node, as the mysql db is replicated using galera.
if [ "$OPENSTACK_INDEX" -eq 1 ]; then
(source $CONF_DIR/keystonerc; bash contrail-ha-keystone-setup.sh $INTERNAL_VIP)
if [ $? != 0 ]; then
exit 1
fi
fi
else
(source $CONF_DIR/keystonerc; bash contrail-keystone-setup.sh $CONTROLLER)
if [ $? != 0 ]; then
exit 1
fi
fi
17 changes: 3 additions & 14 deletions contrail_provisioning/openstack/scripts/nova-server-setup.sh
Expand Up @@ -217,24 +217,13 @@ openstack-config --set /etc/nova/nova.conf DEFAULT quota_ram 10000000

openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
if [ $is_ubuntu -eq 1 ] ; then
if [[ $nova_api_version == *"2013.2"* ]]; then
if [[ $nova_api_version == *"2013.2"* ]] || [[ $nova_api_version == *"2015"* ]] || [[ $nova_api_version == *"12.0.0"* ]]; then
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class nova.network.neutronv2.api.API
else
if [[ $nova_api_version == *"2015"* ]]; then
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class nova.network.neutronv2.api.API
else
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class contrail_nova_networkapi.api.API
fi
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class contrail_nova_networkapi.api.API
fi
openstack-config --set /etc/nova/nova.conf DEFAULT ec2_private_dns_show_ip False
if [[ $nova_api_version == *":"* ]]; then
nova_api_version_without_epoch=`echo $nova_api_version | cut -d':' -f2`
else
nova_api_version_without_epoch=`echo $nova_api_version`
fi

dpkg --compare-versions $nova_api_version_without_epoch ge 2015
if [ $? -eq 0 ]; then
if [[ $nova_api_version == *"2015"* ]] || [[ $nova_api_version == *"12.0.0"* ]]; then
openstack-config --set /etc/nova/nova.conf neutron admin_auth_url ${AUTH_PROTOCOL}://$CONTROLLER:35357/v2.0/
openstack-config --set /etc/nova/nova.conf neutron admin_username $OS_NET
openstack-config --set /etc/nova/nova.conf neutron admin_password $ADMIN_TOKEN
Expand Down

0 comments on commit 86759bc

Please sign in to comment.