3 # Small script for calculation of cores not suitable for deployment
4 # of VM's and adaptation of nova.conf accordingly
5 # nova.conf path should come as first param
6 # this should be executed when nova is enabled and already configured
8 source /etc/default/ovs-dpdk
10 OVS_CORE_MASK=$(echo $OVS_CORE_MASK | sed 's/^0x//')
11 OVS_PMD_CORE_MASK=$(echo $OVS_PMD_CORE_MASK | sed 's/^0x//')
12 BAD_CORES=$((`echo $((16#${OVS_CORE_MASK}))` | `echo $((16#${OVS_PMD_CORE_MASK}))`))
16 for cpu in $(seq 0 `expr $TOTAL_CORES - 1`);do
17 tmp=`echo 2^$cpu | bc`
18 if [ $(($tmp & $BAD_CORES)) -eq 0 ]; then
22 vcpu_pin_set=${vcpu_pin_set::-1}
24 crudini --set $1 DEFAULT vcpu_pin_set $vcpu_pin_set