816e4fe879
Change-Id: Ic5e56697cdb5c311d0715d665321e83b70d823c6
124 lines
4.1 KiB
Ruby
124 lines
4.1 KiB
Ruby
VAGRANTFILE_API_VERSION = "2"
|
|
GITCONFIG = `cat $HOME/.gitconfig`
|
|
|
|
Vagrant.require_version ">= 1.5"
|
|
|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
config.ssh.forward_agent = true
|
|
|
|
config.vm.network "forwarded_port", guest: 5354, host: 5354, protocol: "tcp"
|
|
config.vm.network "forwarded_port", guest: 5354, host: 5354, protocol: "udp"
|
|
|
|
config.vm.provider "virtualbox" do |vb|
|
|
vb.customize ["modifyvm", :id, "--memory", "2048"]
|
|
if not RUBY_PLATFORM.downcase.include?("mswin")
|
|
vb.customize ["modifyvm", :id, "--cpus", `awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' `.chomp ]
|
|
end
|
|
vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
|
|
|
|
config.vm.synced_folder "../..", "/opt/stack/designate"
|
|
|
|
if File.directory?("../../../python-designateclient")
|
|
config.vm.synced_folder "../../../python-designateclient", "/opt/stack/python-designateclient"
|
|
end
|
|
|
|
if File.directory?("../../../../stackforge/rally")
|
|
config.vm.synced_folder "../../../../stackforge/rally", "/opt/stack/rally"
|
|
end
|
|
end
|
|
|
|
config.vm.provider :libvirt do |lv|
|
|
lv.graphics_ip = '0.0.0.0'
|
|
lv.nested = true
|
|
lv.memory = 8192
|
|
if not RUBY_PLATFORM.downcase.include?("mswin")
|
|
lv.cpus = `awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' `.chomp
|
|
end
|
|
|
|
config.vm.synced_folder ".", "/vagrant", type: "nfs"
|
|
config.vm.synced_folder "../..", "/opt/stack/designate", type: "nfs"
|
|
|
|
if File.directory?("../../../python-designateclient")
|
|
config.vm.synced_folder "../../../python-designateclient", "/opt/stack/python-designateclient", type: "nfs"
|
|
end
|
|
|
|
if File.directory?("../../../../stackforge/rally")
|
|
config.vm.synced_folder "../../../../stackforge/rally", "/opt/stack/rally", type: "nfs"
|
|
end
|
|
end
|
|
|
|
$script = <<SCRIPT
|
|
set -e
|
|
|
|
# Fixup permissions on /opt/stack/
|
|
sudo chown vagrant:vagrant /opt/stack/
|
|
|
|
# Copy over git config
|
|
cat << EOF > /home/vagrant/.gitconfig
|
|
#{GITCONFIG}
|
|
EOF
|
|
|
|
# Clone DevStack
|
|
if [ ! -d "/home/vagrant/devstack" ]; then
|
|
git clone https://git.openstack.org/openstack-dev/devstack.git /home/vagrant/devstack
|
|
fi
|
|
|
|
# Install Vagrant localrc sample
|
|
cd /opt/stack/designate/contrib/vagrant
|
|
|
|
if [ ! -f "/home/vagrant/devstack/localrc" ]; then
|
|
cp localrc /home/vagrant/devstack/localrc
|
|
fi
|
|
|
|
# Install Designate DevStack extension
|
|
cd /opt/stack/designate/contrib/devstack
|
|
|
|
for f in lib/* extras.d/* exercises/*; do
|
|
if [ ! -f "/home/vagrant/devstack/$f" ]; then
|
|
ln -fs /opt/stack/designate/contrib/devstack/$f -t /home/vagrant/devstack/$(dirname $f)
|
|
fi
|
|
done
|
|
|
|
# Clone Rally
|
|
if [ ! -d "/opt/stack/rally" ]; then
|
|
git clone https://git.openstack.org/stackforge/rally.git /opt/stack/rally
|
|
fi
|
|
|
|
# Install Rally DevStack extension
|
|
cd /opt/stack/rally/contrib/devstack
|
|
|
|
for f in lib/* extras.d/*; do
|
|
if [ ! -f "/home/vagrant/devstack/$f" ]; then
|
|
ln -fs /opt/stack/rally/contrib/devstack/$f -t /home/vagrant/devstack/$(dirname $f)
|
|
fi
|
|
done
|
|
|
|
# Link in the Rally Plugins
|
|
mkdir /home/vagrant/.rally
|
|
ln -s /opt/stack/designate/rally-scenarios/plugins /home/vagrant/.rally/plugins
|
|
|
|
SCRIPT
|
|
|
|
config.vm.define "ubuntu" do |ubuntu|
|
|
ubuntu.vm.box = "ubuntu/trusty64"
|
|
|
|
ubuntu.vm.network :private_network, ip: "192.168.27.100"
|
|
|
|
ubuntu.vm.provision :shell, :privileged => true, :inline => "DEBIAN_FRONTEND=noninteractive apt-get update"
|
|
ubuntu.vm.provision :shell, :privileged => true, :inline => "DEBIAN_FRONTEND=noninteractive apt-get install --yes git lvm2"
|
|
|
|
ubuntu.vm.provision :shell, :privileged => false, :inline => $script
|
|
end
|
|
|
|
config.vm.define "fedora" do |fedora|
|
|
fedora.vm.box = "box-cutter/fedora20"
|
|
|
|
fedora.vm.network :private_network, ip: "192.168.27.101"
|
|
|
|
fedora.vm.provision :shell, :privileged => true, :inline => "yum update -y vim-minimal" # RH Bug 1066983
|
|
fedora.vm.provision :shell, :privileged => true, :inline => "yum install -y git-core MySQL-python"
|
|
|
|
fedora.vm.provision :shell, :privileged => false, :inline => $script
|
|
end
|
|
end
|