#!/bin/bash # Save trace setting XTRACE=$(set +o | grep xtrace) set +o xtrace OMNI_DATA_DIR="/opt/stack/omni" DIST_PACKAGES="/usr/local/lib/python2.7/dist-packages" ENTRY_POINT="$DIST_PACKAGES/glance_store-*.dist-info/entry_points.txt" NEUTRON_ENTRY_POINT="/opt/stack/neutron/neutron.egg-info/entry_points.txt" # Functions # ------------ function configure_glance { iniset $GLANCE_API_CONF GCE zone ${ZONE} iniset $GLANCE_API_CONF GCE project_id ${PROJECT} iniset $GLANCE_API_CONF GCE service_key_path ${SERVICE_KEY_PATH} iniset $GLANCE_API_CONF DEFAULT show_multiple_locations True iniset $GLANCE_API_CONF glance_store default_store gce iniset $GLANCE_API_CONF glance_store stores gce sudo crudini --set $ENTRY_POINT glance_store.drivers glance.store.gce.Store glance_store._drivers.gce:Store sudo crudini --set $ENTRY_POINT glance_store.drivers gce glance_store._drivers.gce:Store value=$(sed -n "/, 'gce'/p" $DIST_PACKAGES/glance_store/backend.py) if [[ $value == "" ]]; then sudo sed -i -e "s/, 'vsphere'/, 'vsphere', 'gce'/g" $DIST_PACKAGES/glance_store/backend.py fi sudo cp $OMNI_DATA_DIR/glance/gce/gceutils.py /usr/local/lib/python2.7/dist-packages/glance_store/_drivers/ sudo cp $OMNI_DATA_DIR/glance/glance_store/_drivers/gce.py /usr/local/lib/python2.7/dist-packages/glance_store/_drivers/ sudo systemctl restart devstack@g-api.service devstack@g-reg.service } function configure_cinder { iniset $CINDER_CONF GCE zone ${ZONE} iniset $CINDER_CONF GCE project_id ${PROJECT} iniset $CINDER_CONF GCE region ${REGION} iniset $CINDER_CONF GCE service_key_path ${SERVICE_KEY_PATH} iniset $CINDER_CONF GCE gce_pool_name gce iniset $CINDER_CONF GCE gce_free_capacity_gb ${CAPACITY} iniset $CINDER_CONF gce_total_capacity_gb ${CAPACITY} iniset $CINDER_CONF GCE volume_driver ${GCE_CINDER_DRIVER} iniset $CINDER_CONF DEFAULT enable_force_upload ${ENABLE_FORCE_UPLOAD} iniset $CINDER_CONF DEFAULT enabled_backends GCE iniset $CINDER_CONF DEFAULT volumes_dir ${VOLUME_DIR} iniset $CINDER_CONF DEFAULT os_privileged_user_name ${CINDER_USER} iniset $CINDER_CONF DEFAULT default_volume_type GCE iniset $CINDER_CONF DEFAULT os_region_name GCE sudo cp -R $OMNI_DATA_DIR/cinder/volume/drivers/gce/ /opt/stack/cinder/cinder/volume/drivers/ sudo systemctl restart devstack@c-sch.service devstack@c-vol.service devstack@c-api.service } function configure_nova { iniset $NOVA_CONF GCE zone ${ZONE} iniset $NOVA_CONF GCE project_id ${PROJECT} iniset $NOVA_CONF GCE service_key_path ${SERVICE_KEY_PATH} iniset $NOVA_CONF DEFAULT compute_driver ${GCE_COMPUTE_DRIVER} iniset $NOVA_CONF DEFAULT glance_api_insecure True iniset $NOVA_CONF DEFAULT cinder_api_insecure True iniset $NOVA_CONF DEFAULT vnc_enabled True iniset $NOVA_CONF DEFAULT osapi_compute_extension ${COMPUTE_EXTENSION} iniset $NOVA_CONF DEFAULT force_dhcp_release True sudo cp -R $OMNI_DATA_DIR/nova/virt/gce/ /opt/stack/nova/nova/virt/ sudo systemctl restart devstack@n-cpu.service } function configure_neutron { iniset $NEUTRON_CONF GCE zone ${ZONE} iniset $NEUTRON_CONF GCE project_id ${PROJECT} iniset $NEUTRON_CONF GCE region ${REGION} iniset $NEUTRON_CONF GCE service_key_path ${SERVICE_KEY_PATH} iniset $NEUTRON_CONF DEFAULT core_plugin ${CORE_PLUGIN} iniset $NEUTRON_CONF DEFAULT service_plugins ${GCE_SERVICE_PLUGIN} iniset $NEUTRON_CONF nova region_name GCE sudo rm -f /etc/neutron/plugins/ml2/ml2_conf.ini touch /etc/neutron/plugins/ml2/ml2_conf.ini sudo chown stack /etc/neutron/plugins/ml2/ml2_conf.ini iniset /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers ${ML2_DRIVERS} iniset /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types ${ML2_TENANT} iniset /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_flat flat_networks "*" iniset /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_vlan network_vlan_ranges ${ML2_VLAN_TYPE} iniset /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers gce sudo crudini --set $NEUTRON_ENTRY_POINT neutron.ml2.mechanism_drivers gce neutron.plugins.ml2.drivers.gce.mech_gce:GceMechanismDriver sudo crudini --set $NEUTRON_ENTRY_POINT neutron.service_plugins gce_router neutron.services.l3_router.gce_router_plugin:GceRouterPlugin sudo cp -R $OMNI_DATA_DIR/neutron/neutron/plugins/ml2/drivers/gce/ /opt/stack/neutron/neutron/plugins/ml2/drivers/ sudo cp $OMNI_DATA_DIR/neutron/neutron/services/l3_router/gce_router_plugin.py /opt/stack/neutron/neutron/services/l3_router/ sudo cp $OMNI_DATA_DIR/neutron/neutron/common/* /opt/stack/neutron/neutron/common/ sudo systemctl restart devstack@q-svc.service } # Restore xtrace $XTRACE ## Local variables: ## mode: shell-script ## End: