5 VAGRANTFILE_API_VERSION = "2"
14 #QA_FLAGS = "-g pmda.linux"
17 # Arch Specific Config Files
19 ############################################################
21 ############################################################
22 $script_centos = <<SCRIPT
25 cat <<EOM >/etc/yum.repos.d/epel-bootstrap.repo
28 mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-\\\$releasever&arch=\\\$basearch
29 failovermethod=priority
34 yum --enablerepo=epel -y install epel-release
35 rm -f /etc/yum.repos.d/epel-bootstrap.repo
37 yum -y groupinstall 'Development Tools'
38 yum -y install git ncurses-devel readline-devel man libmicrohttpd-devel qt4-devel python26 python26-devel perl-JSON sysstat perl-TimeDate \
39 perl-XML-TokeParser perl-ExtUtils-MakeMaker perl-Time-HiRes systemd-devel bc cairo-devel cyrus-sasl-devel \
40 systemd-devel libibumad-devel libibmad-devel papi-devel libpfm-devel rpm-devel perl-Spreadsheet-WriteExcel \
41 perl-Text-CSV_XS bind-utils httpd python-devel nspr-devel nss-devel python-ctypes nss-tools perl-Spreadsheet-XLSX \
42 ed cpan valgrind time xdpyinfo rrdtool-perl
44 # Lots of avahi errors on Centos511, likely due to my environment
48 sudo -H -u vagrant env PYTHON=python2.6 ./Makepkgs
49 rpm -ivh pcp-*/build/rpm/*.rpm
51 # Doesn't start automatically on all distributions
52 /sbin/service pmcd start
54 echo 'pcpqa ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
58 ############################################################
60 ############################################################
61 $script_suse = <<SCRIPT
62 zypper -n in -t pattern devel_basis devel_C_C++ devel_rpm_build
63 zypper -n in git ncurses-devel readline-devel man libmicrohttpd-devel libqt4-devel perl-JSON sysstat perl-TimeDate perl-ExtUtils-MakeMaker bc \
64 cyrus-sasl-devel systemd-devel avahi-devel rpm-devel perl-Text-CSV_XS \
65 bind-utils python-devel python-curses
67 # These dont have the right "provides" in opensuse
68 # libibumad-devel libibmad-devel papi-devel libpfm-devel
70 #SUSE doesn't get the right perms in /vagrant, hmm
71 chown -R vagrant /vagrant
74 sudo -H -u vagrant ./Makepkgs
75 rpm -ivh pcp-*/build/rpm/*.rpm
77 # Doesn't start automatically on all distributions
78 /sbin/service pmcd start
80 echo 'pcpqa ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
84 ############################################################
86 ############################################################
87 $script_ubuntu = <<SCRIPT
89 # Use a regex for some of the more obscure packages so apt doesn't exit if missing
90 # Trying to not have one script per box
91 apt-get install -y '^(libreadline|libpapi|libpfm4|libcoin80|libicu)-dev$' \
92 bc bison curl flex git g++ dpkg-dev pkg-config debhelper chrpath \
93 python-all python-all-dev libnspr4-dev libnss3-dev libsasl2-dev libmicrohttpd-dev libavahi-common-dev \
94 libqt4-dev autotools-dev autoconf gawk libxml-tokeparser-perl libspreadsheet-read-perl gdb sysv-rc-conf \
95 libcairo2-dev sysstat valgrind apache2 realpath unbound \
96 libibumad-dev libsoqt-dev libsoqt-dev-common libnss3-tools libibmad-dev x11-utils
99 sudo -H -u vagrant ./Makepkgs
100 dpkg -i build/deb/*.deb
102 echo 'pcpqa ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
106 ############################################################
108 ############################################################
109 $script_EOLubuntu = <<SCRIPT
112 sed -i.bak -r 's/(us.)?(archive|security).ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
115 apt-get install -y '^(libreadline|libpapi|libpfm4|libcoin80|libicu)-dev$' \
116 bc bison curl flex git g++ dpkg-dev pkg-config debhelper chrpath \
117 python-all python-all-dev libnspr4-dev libnss3-dev libsasl2-dev libmicrohttpd-dev libavahi-common-dev \
118 libqt4-dev autotools-dev autoconf gawk libxml-tokeparser-perl libspreadsheet-read-perl gdb sysv-rc-conf \
119 libcairo2-dev sysstat valgrind apache2 realpath unbound \
120 libibumad-dev libsoqt-dev libsoqt-dev-common libnss3-tools libibmad-dev x11-utils
123 sudo -H -u vagrant ./Makepkgs
124 dpkg -i build/deb/*.deb
126 echo 'pcpqa ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
130 ############################################################
132 ############################################################
133 $script_debian = <<SCRIPT
135 apt-get install -y '^(libreadline|libpapi|libpfm4|libcoin80)-dev$' \
136 bc bison flex git g++ dpkg-dev pkg-config debhelper chrpath \
137 python-all python-all-dev libnspr4-dev libnss3-dev libsasl2-dev libmicrohttpd-dev libavahi-common-dev \
138 libqt4-dev autotools-dev autoconf gawk libxml-tokeparser-perl libspreadsheet-read-perl ed gdb sysv-rc-conf \
139 libcairo2-dev libibumad-dev libibmad-dev sysstat valgrind apache2 realpath unbound libsoqt-dev \
140 libsoqt-dev-common libnss3-tools x11-utils
143 sudo -H -u vagrant ./Makepkgs
144 dpkg -i build/deb/*.deb
146 echo 'pcpqa ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
150 ############################################################
152 ############################################################
153 $script_fedora = <<SCRIPT
155 # For sudo to work from a script
156 sed -i '/requiretty/d' /etc/sudoers
158 yum -y group install 'Development Tools' 'C Development Tools and Libraries' 'RPM Development Tools'
159 yum -y install perl-ExtUtils-MakeMaker bison flex libmicrohttpd-devel qt-devel fedora-packager systemd-devel perl-JSON \
160 sysstat perl-Digest-MD5 bc ed cpan cairo-devel cyrus-sasl-devel libibumad-devel libibmad-devel avahi-devel \
161 papi-devel libpfm-devel rpm-devel perl-TimeDate perl-XML-TokeParser perl-Spreadsheet-WriteExcel \
162 perl-Text-CSV_XS bind-utils httpd python-devel nspr-devel nss-devel perl-Spreadsheet-XLSX time xorg-x11-utils
164 # Remove too old libraries
165 pfmvers=`rpm -q --qf "%{VERSION}\n" libpfm`
166 [ "$pfmvers" = "`echo -e "$pfmvers\n4.3.9" | sort -V | head -n1`" ] && rpm -e libpfm libpfm-devel papi papi-devel
169 sudo -H -u vagrant ./Makepkgs
170 rpm -ivh pcp-*/build/rpm/*.rpm
172 # Doesn't start automatically on all distributions
173 /sbin/service pmcd start
175 echo 'pcpqa ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
179 ############################################################
181 ############################################################
185 :hostname => "ubuntu1204",
186 :ipaddress => "10.100.10.10",
187 :box => "ubuntu/precise64",
188 :script => "#{$script_ubuntu}"
191 :hostname => "ubuntu1304",
192 :ipaddress => "10.100.10.11",
193 :box => "chef/ubuntu-13.04",
194 :script => "#{$script_EOLubuntu}"
197 :hostname => "ubuntu1404",
198 :ipaddress => "10.100.10.12",
199 :box => "ubuntu/trusty64",
200 :script => "#{$script_ubuntu}"
203 :hostname => "centos511",
204 :ipaddress => "10.100.10.20",
205 :box => "chef/centos-5.11",
206 :script => "#{$script_centos}"
209 :hostname => "centos511-32",
210 :ipaddress => "10.100.10.21",
211 :box => "chef/centos-5.11-i386",
212 :script => "#{$script_centos}"
215 :hostname => "centos65",
216 :ipaddress => "10.100.10.22",
217 :box => "chef/centos-6.5",
218 :script => "#{$script_centos}"
221 :hostname => "centos7",
222 :ipaddress => "10.100.10.23",
223 :box => "chef/centos-7.0",
224 :script => "#{$script_centos}"
227 :hostname => "fedora19",
228 :ipaddress => "10.100.10.30",
229 :box => "chef/fedora-19",
230 :script => "#{$script_fedora}"
233 :hostname => "fedora20",
234 :ipaddress => "10.100.10.31",
235 :box => "chef/fedora-20",
236 :script => "#{$script_fedora}"
239 :hostname => "debian76",
240 :ipaddress => "10.100.10.40",
241 :box => "chef/debian-7.6",
242 :script => "#{$script_debian}"
244 # Built locally from : https://github.com/opscode/bento
245 # NAT comes up but not the host interface
247 # :hostname => "opensuse132",
248 # :ipaddress => "10.100.10.51",
249 # :box => "minnus-opensuse-13.2",
250 # :script => "#{$script_suse}"
252 # Networking wont come up
254 # :hostname => "opensuse131",
255 # :ipaddress => "10.100.10.50",
256 # :box => "chef/opensuse-13.1",
257 # :script => "#{$script_suse}"
261 ############################################################
262 # Common Config Setup, hostnames, etc
263 # So VMs could talk to each other if we wanted
264 ############################################################
269 $script_common << "sed -i '/127.0.1.1/d' /etc/hosts\n"
270 # Fix bogus entries that some os use
271 $script_common << "sed -i '/127.0.0.1/d' /etc/hosts\n"
272 $script_common << "echo \"127.0.0.1 localhost.localdomain localhost\" >> /etc/hosts\n"
274 pcp_hosts.each_pair do |name, options|
275 ipaddr = options[:ipaddress]
276 hostname = options[:hostname]
277 $script_common << "echo \"#{ipaddr} #{hostname} #{hostname}.localdomain\" >> /etc/hosts\n"
280 $script_common << "domainname localdomain"
282 ############################################################
284 ############################################################
286 $script_qa = <<SCRIPT
289 echo "#!/bin/sh" >> /tmp/runqa.sh
290 echo "cd /var/lib/pcp/testsuite" >> /tmp/runqa.sh
291 echo "./check #{QA_FLAGS} >/tmp/runqa.out 2>&1" >> /tmp/runqa.sh
292 echo "cp /tmp/runqa.out /qaresults" >> /tmp/runqa.sh
293 echo "cp /var/lib/pcp/testsuite/*.bad /qaresults" >> /tmp/runqa.sh
295 chmod 777 /tmp/runqa.sh
296 sudo -b -H -u pcpqa sh -c '/tmp/runqa.sh'
300 ############################################################
301 # Main Vagrant Init : Loop over Host configs
302 ############################################################
304 Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
306 global_config.ssh.forward_x11 = true
307 global_config.ssh.forward_agent = true
308 global_config.ssh.insert_key = false
311 if Vagrant.has_plugin?("vagrant-cachier")
312 global_config.cache.scope = :box
315 # Global shared folder for pcp source. Copy it so we have our own to muck around in
316 global_config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync_auto: false, :rsync__exclude => ["qaresults/"]
318 pcp_hosts.each_pair do |name, options|
320 global_config.vm.define name do |config|
322 config.vm.provider "virtualbox" do |v|
323 v.name = "Vagrant PCP - #{name}"
324 v.customize ["modifyvm", :id, "--groups", "/VagrantPCP", "--memory", VM_MEM, "--cpus", VM_CPU]
327 config.vm.box = options[:box]
329 # VM specific shared folder for qa results
330 config.vm.synced_folder "./qaresults/#{name}", "/qaresults", mount_options: ["dmode=777", "fmode=666"], create: true
332 #config.vm.hostname = "#{name}"
333 config.vm.hostname = "#{options[:hostname]}"
334 config.vm.network :private_network, ip: options[:ipaddress]
336 # Setup networking etc
337 config.vm.provision :shell, :inline => $script_common
339 # Do platfrom specifics: install packages, etc
340 config.vm.provision :shell, :inline => options[:script]
342 # Run QA and copy results back to host
343 config.vm.provision :shell, :inline => $script_qa