build collectd with pqos 13/26213/7
authorGuo Ruijing <ruijing.guo@intel.com>
Mon, 19 Dec 2016 00:31:42 +0000 (19:31 -0500)
committerGuo Ruijing <ruijing.guo@intel.com>
Wed, 28 Dec 2016 01:06:41 +0000 (20:06 -0500)
1. can build collectd with pqos
2. ceilometer with collectd basic functionality work as expected
3. todo: need to verify pqos work as expected

Change-Id: I9f992de6ef5d8c0ea97a30162dd916bcd3accb34
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
src/fuel-plugin/Dockerfile
src/fuel-plugin/README.md
src/fuel-plugin/build-collectd.sh
src/fuel-plugin/build_fuel_plugin.sh [moved from src/fuel-plugin/vagrant/build_fuel_plugin.sh with 67% similarity]
src/fuel-plugin/deployment_scripts/install.sh
src/fuel-plugin/enable_pqos.diff [new file with mode: 0644]
src/fuel-plugin/pre_build_hook
src/fuel-plugin/vagrant/Vagrantfile

index 301d796..a7b1593 100644 (file)
@@ -4,5 +4,3 @@ FROM ubuntu:16.04
 
 RUN apt-get update -y
 RUN apt-get install -y sudo
-
-ADD ./build-collectd.sh /build-collectd.sh
index 8c6d5a2..0a44a9c 100644 (file)
@@ -55,19 +55,3 @@ step 1, 2, 3 may be bypassed if fuel plugin is installed from /opt/opnfv in fuel
 SSH to openstack controller node:
     source openrc
     ceilometer sample-list --meter interface.if_packets
-
-9) known issues
-
-a) connection aborted
-  root@node-11:~# ceilometer sample-list --meter interface.if_packets
-('Connection aborted.', BadStatusLine("''",))
-
-  workaround:
-  root@node-11:~# sudo service ceilometer-api restart
-
-b) Service Unavailable
-  root@node-11:~# ceilometer sample-list --meter interface.if_packets
-Service Unavailable (HTTP 503)
-
-  workaround:
-  root@node-11:~# sudo service ceilometer-api restart
index 0ef3136..72097d2 100755 (executable)
@@ -1,8 +1,13 @@
 #!/bin/bash
 
-BUILD_HOME="$(pwd)"
+BUILD_HOME=/tmp/collectd-build
 
 set -eux
+
+sudo rm -rf $BUILD_HOME
+sudo mkdir -p $BUILD_HOME
+sudo chmod 777 $BUILD_HOME
+
 sudo apt-get -y install build-essential dh-autoreconf fakeroot  devscripts dpkg-dev git wget
 
 sudo apt-get -y install \
@@ -62,15 +67,24 @@ sudo apt-get -y install \
     python-dev
 
 
+
+cd ${BUILD_HOME}
+git clone https://github.com/01org/intel-cmt-cat.git
+cd intel-cmt-cat/
+git checkout c194e3a14d5efc1bd05a8ef7a49cfaf689f66937
+make
+sudo make install PREFIX=/fuel-plugin/build/qpos
+
 cd ${BUILD_HOME}
 rm -rf collectd
-git clone https://github.com/collectd/collectd; cd collectd; git checkout 797ed5e5bee9ee89361f12e447ffc6ceb6ef79d2
+git clone https://github.com/collectd/collectd; cd collectd; git checkout 786a6be461cf58ef2b8c57974cad2a79ba2ee82c
 git clone https://github.com/collectd/pkg-debian; cd pkg-debian; git checkout 549d3caba74210ad762fe8c556801d9c11ab9876
-mv debian ..
+patch -p1 < /fuel-plugin/enable_pqos.diff
+cp -r debian ..
 
 cd ${BUILD_HOME}/collectd
 ./build.sh
 debian/rules build || true
 debian/rules build
 fakeroot debian/rules binary
-cp ${BUILD_HOME}/*.deb /build
+cp ${BUILD_HOME}/*.deb /fuel-plugin/build
similarity index 67%
rename from src/fuel-plugin/vagrant/build_fuel_plugin.sh
rename to src/fuel-plugin/build_fuel_plugin.sh
index ea77b07..9d96e20 100755 (executable)
@@ -3,8 +3,4 @@ sudo apt-get update -y
 sudo apt-get install -y ruby-dev rubygems-integration python-pip rpm createrepo dpkg-dev git docker.io
 sudo gem install fpm
 sudo pip install fuel-plugin-builder
-cp -r /fuel-plugin /home/vagrant
-cd /home/vagrant/fuel-plugin;
-rm -rf vagrant/.vagrant
 fpb --debug --build .
-cp *.rpm /vagrant
index 0bcb400..e602e9c 100755 (executable)
@@ -11,19 +11,25 @@ OS_PASSWORD=$4
 CEILOMETER_URL_TYPE=${CEILOMETER_URL_TYPE:-internalURL}
 CEILOMETER_TIMEOUT=${CEILOMETER_TIMEOUT:-1000}
 
-apt-get install -y collectd python-dev libpython2.7
-
 rm -rf $INSTALL_HOME; mkdir -p $INSTALL_HOME
 cd $INSTALL_HOME
 curl http://$HOST:8080/plugins/fuel-plugin-collectd-ceilometer-1.0/repositories/ubuntu/collectd-ceilometer.tgz | tar xzvf -
 
+cat << EOF > /etc/ld.so.conf.d/pqos.conf
+$INSTALL_HOME/lib
+EOF
+ldconfig
+modprobe msr
+
+apt-get install -y --allow-unauthenticated collectd python-dev libpython2.7
+
 cat << EOF > /etc/collectd/collectd.conf.d/collectd-ceilometer-plugin.conf
 <LoadPlugin python>
   Globals true
 </LoadPlugin>
 
 <Plugin python>
-    ModulePath "$INSTALL_HOME"
+    ModulePath "$INSTALL_HOME/collectd-ceilometer-plugin"
     LogTraces true
     Interactive false
     Import "collectd_ceilometer.plugin"
diff --git a/src/fuel-plugin/enable_pqos.diff b/src/fuel-plugin/enable_pqos.diff
new file mode 100644 (file)
index 0000000..1224a1f
--- /dev/null
@@ -0,0 +1,27 @@
+diff --git a/debian/changelog b/debian/changelog
+index 88d2293..fa6bce1 100644
+--- a/debian/changelog
++++ b/debian/changelog
+@@ -1,3 +1,10 @@
++collectd (5.7.0-1) UNRELEASED; urgency=medium
++
++  * debian/rules:
++    - enable ppos
++
++ -- Ruijing Guo <ruijing.guo@intel.com>  Thu, 22 Dec 2016 13:24:11 -0500
++
+ collectd (5.5.0-4) UNRELEASED; urgency=medium
+   * debian/collectd-core.overrides:
+diff --git a/debian/rules b/debian/rules
+index ba7cfc0..d876e12 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -168,6 +168,7 @@ config.status: configure
+       
+       PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
+       ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
++              --enable-syslog --enable-logfile --with-libpqos=/opt/pqos/--enable-debug \
+               || ( status=$$?; cat config.log; exit $$status )
+ build: build-arch build-indep
index c0d35d4..d264d0b 100755 (executable)
@@ -13,19 +13,23 @@ DIR="$(dirname `readlink -f $0`)"
 function build_pkg {
   case $1 in
     ubuntu)
-      cd ${DIR}
-      rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu
-      rm -rf collectd-ceilometer-plugin
+      sudo rm -rf ${DIR}/build; mkdir -p ${DIR}/build
+
+      cd ${DIR}/build
       git clone https://github.com/openstack/collectd-ceilometer-plugin
       cd  collectd-ceilometer-plugin
       git checkout 73372f2eb86c81f12bc10b392f75050a401107db
-      tar cfvz ${DIR}/repositories/ubuntu/collectd-ceilometer.tgz . --exclude=collectd-ceilometer.tgz
-      cd ..; rm -rf collectd-ceilometer-plugin
 
       # build collectd
       cd ${DIR}
-      sudo docker  build -t collectd_build .
-      sudo docker run -v${DIR}/repositories/ubuntu:/build -t collectd_build /build-collectd.sh
+      sudo docker build -t collectd_build .
+      sudo docker run -v ${DIR}:/fuel-plugin -t collectd_build /fuel-plugin/build-collectd.sh
+
+      rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu
+      cd ${DIR}/build
+      mv *.deb ${DIR}/repositories/ubuntu
+      tar cfvz ${DIR}/repositories/ubuntu/collectd-ceilometer.tgz .
+      cd ..; sudo rm -rf ${DIR}/build
       ;;
     *) echo "Not supported system"; exit 1;;
   esac
index 8e2d9db..ba237d7 100644 (file)
@@ -10,7 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
 
   config.vm.define "fuel" do | h |
     h.vm.host_name = "fuel"
-    h.vm.provision :shell, :inline => "/vagrant/build_fuel_plugin.sh", privileged: false
+    h.vm.provision :shell, :inline => "cd /fuel-plugin; ./build_fuel_plugin.sh", privileged: false
     h.vm.synced_folder "..", "/fuel-plugin"
     h.vm.provider :virtualbox do |v|
       v.customize ["modifyvm", :id, "--memory", 4096]