Skip to content

Instantly share code, notes, and snippets.

@uglide
Last active August 29, 2015 14:14
Show Gist options
  • Save uglide/fc782d13290aeb7d7252 to your computer and use it in GitHub Desktop.
Save uglide/fc782d13290aeb7d7252 to your computer and use it in GitHub Desktop.
Openstack Manila Development Boilerplate
#!/bin/bash
DB_NAME='openstack_citest'
DB_USER='openstack_citest'
DB_PASS='openstack_citest'
# Create test MySQL DB for unit tests
MYSQL=`which mysql`
Q1="CREATE DATABASE IF NOT EXISTS $DB_NAME;"
Q2="GRANT ALL ON *.* TO '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
Q3="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}"
$MYSQL -uroot -p -e "$SQL"
# Create Postgres DB for unit tests
sudo -u postgres psql --command "create user \"$DB_USER\" with password '$DB_PASS'"
sudo -u postgres psql --command "ALTER USER openstack_citest WITH SUPERUSER;"
sudo -u postgres psql --command "create database \"$DB_NAME\" with owner \"$DB_USER\" ENCODING 'UTF8'"
#!/bin/bash
CD=$(pwd)
STACK_PATH="/vagrant/stack"
TEMPEST_COMMIT=$(grep -oP "TEMPEST_COMMIT=.\K[0-9a-z]{8}(?=.)" $STACK_PATH/manila/contrib/ci/pre_test_hook.sh)
cd $STACK_PATH/tempest
git checkout $TEMPEST_COMMIT
git status
cp -r $STACK_PATH/manila/contrib/tempest/tempest/* $STACK_PATH/tempest/tempest
#!/bin/bash
cd /vagrant
# update packages
sudo apt-get update
sudo apt-get build-dep python -y
sudo apt-get install git python-pip -y
sudo apt-get install postgresql postgresql-contrib -y
sudo pip install setuptools --upgrade
sudo apt-get purge cloud-init -y
#prepare env
sudo chown -R vagrant /opt
sudo rm -fR /vagrant/stack
sudo rm -fR /vagrant/devstack
#get devstack
git clone https://git.openstack.org/openstack-dev/devstack
cp local.conf.dev devstack/local.conf
sudo chown -R vagrant devstack/
cd devstack
[[local|localrc]]
GIT_DEPTH=5
SERVICE_TOKEN=2424
ADMIN_PASSWORD=2424
MYSQL_PASSWORD=2424
RABBIT_PASSWORD=2424
SERVICE_PASSWORD=$ADMIN_PASSWORD
HOST_IP=192.168.56.111
DEST=/vagrant/stack
LOGFILE=$DEST/logs/stack.sh.log
LOGDAYS=2
disable_service n-net
enable_service neutron
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_plugin manila https://github.com/openstack/manila
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
ML2_VLAN_RANGES=physnet1:100:200
PHYSICAL_NETWORK=physnet1
OVS_PHYSICAL_BRIDGE=br-eth1
Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch
Q_ML2_PLUGIN_TYPE_DRIVERS=vlan,vxlan
MANILA_BACKEND1_CONFIG_GROUP_NAME=london
MANILA_SHARE_BACKEND1_NAME=LONDON
MANILA_OPTGROUP_london_driver_handles_share_servers=false
#MANILA_UI_ENABLED=False
# Swift
# -----
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=1
SWIFT_DATA_DIR=$DEST/data
# Tempest
# -------
enable_service tempest
TEMPEST_SERVICES+=,manila
API_RATE_LIMIT=False
[[post-config|$Q_DHCP_CONF_FILE]]
[DEFAULT]
enable_isolated_metadata=True
enable_metadata_network=True
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.56.111"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "4500"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.gui = true
end
config.vm.synced_folder ".", "/vagrant", type: "nfs",
mount_options: ["async,noatime,soft,nfsvers=3"], nfs_export: false
config.vm.provision "shell", path: "install.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment