summaryrefslogtreecommitdiffstats
path: root/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh
diff options
context:
space:
mode:
authorBilly O'Mahony <billy.o.mahony@intel.com>2016-01-06 17:00:41 +0000
committerBilly O'Mahony <billy.o.mahony@intel.com>2016-01-06 17:14:07 +0000
commit93f7683a2cd9b8020f8870dfc6b162b3d61c3fd2 (patch)
treefa7573a61d24cd0712920a04c07e2b48a1020644 /fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh
parentebf6ae51abdaa29eb8eaf9bc41a4187bac6ec0ff (diff)
fuel plugin: Initial version
Change-Id: Ib41afff8f0b0f5e7c2f92f78cbdc48c99891b1ab Signed-off-by: Mark D. Gray <mark.d.gray@intel.com> Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com> Signed-off-by: Michal Ptacek <michalx.ptacek@intel.com>
Diffstat (limited to 'fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh')
-rwxr-xr-xfuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh
new file mode 100755
index 0000000..0cb3791
--- /dev/null
+++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/set_vcpu_pin.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# Small script for calculation of cores not suitable for deployment
+# of VM's and adaptation of nova.conf accordingly
+# nova.conf path should come as first param
+# this should be executed when nova is enabled and already configured
+
+source /etc/default/ovs-dpdk
+
+OVS_CORE_MASK=$(echo $OVS_CORE_MASK | sed 's/^0x//')
+OVS_PMD_CORE_MASK=$(echo $OVS_PMD_CORE_MASK | sed 's/^0x//')
+BAD_CORES=$((`echo $((16#${OVS_CORE_MASK}))` | `echo $((16#${OVS_PMD_CORE_MASK}))`))
+TOTAL_CORES=`nproc`
+vcpu_pin_set=""
+
+for cpu in $(seq 0 `expr $TOTAL_CORES - 1`);do
+ tmp=`echo 2^$cpu | bc`
+ if [ $(($tmp & $BAD_CORES)) -eq 0 ]; then
+ vcpu_pin_set+=$cpu","
+ fi
+done
+vcpu_pin_set=${vcpu_pin_set::-1}
+
+crudini --set $1 DEFAULT vcpu_pin_set $vcpu_pin_set