Files
scylladb/dist/common/scripts/scylla_sysconfig_setup
Takuya ASADA 0e6df2a82e dist: follow DPDK script renaming
On DPDK 16.11 dpdk_nic_bind.py is renamed to dpdk-devbind.py, so we are
getting "file not found" both on packaging and scripts, fixed that.

Also fixed inconsistent packaging.
Since Seastar copied dpdk_nic_bind.py to its scripts/ directory, there're two
different versions of the script, .rpm/.deb packaging different one:
 dist/redhat: seastar/dpdk/tools/dpdk_nic_bind.py
 dist/ubuntu: seastar/scripts/dpdk_nic_bind.py

That's won't work because we sharing setup scripts between two
distributions, so I changed dist/ubuntu package to use DPDK one.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1484191955-28006-1-git-send-email-syuu@scylladb.com>
2017-01-12 12:13:33 +02:00

94 lines
2.6 KiB
Bash
Executable File

#!/bin/bash -e
#
# Copyright (C) 2015 ScyllaDB
. /usr/lib/scylla/scylla_lib.sh
print_usage() {
echo "scylla-sysconfig-setup --nic eth0 --mode posix --nr-hugepages 64 --user scylla --group scylla --homedir /var/lib/scylla --confdir /etc/scylla --setup-nic"
echo " --nic specify NIC"
echo " --mode network mode (posix, dpdk)"
echo " --nr-hugepages number of hugepages"
echo " --user user (dpdk requires root)"
echo " --group group (dpdk requires root)"
echo " --homedir scylla home directory"
echo " --confdir scylla config directory"
echo " --setup-nic setup NIC's interrupts, RPS, XPS"
echo " --ami AMI instance mode"
exit 1
}
if [ $# -eq 0 ]; then
print_usage
fi
while [ $# -gt 0 ]; do
case "$1" in
"--nic")
NIC="$2"
shift 2
;;
"--mode")
NETWORK_MODE="$2"
shift 2
;;
"--nr-hugepages")
NR_HUGEPAGES="$2"
shift 2
;;
"--user")
USER="$2"
shift 2
;;
"--group")
GROUP="$2"
shift 2
;;
"--homedir")
SCYLLA_HOME="$2"
shift 2
;;
"--confdir")
SCYLLA_CONF="$2"
shift 2
;;
"--setup-nic")
SET_NIC=yes
shift 1
;;
"--ami")
AMI=yes
shift 1
;;
*)
print_usage
;;
esac
done
echo Setting parameters on $SYSCONFIG/scylla-server
if [ $SET_NIC = "yes" ]; then
RPS_CPUS=$(/usr/lib/scylla/posix_net_conf.sh --cpu-mask $NIC)
if [ "$RPS_CPUS" != "" ]; then
CPUSET=$(echo $RPS_CPUS | /usr/lib/scylla/hex2list.py)
/usr/lib/scylla/scylla_cpuset_setup --cpuset $CPUSET
fi
fi
ETHDRV=`/usr/lib/scylla/dpdk-devbind.py --status | grep if=$NIC | sed -e "s/^.*drv=//" -e "s/ .*$//"`
ETHPCIID=`/usr/lib/scylla/dpdk-devbind.py --status | grep if=$NIC | awk '{print $1}'`
sed -e s#^NETWORK_MODE=.*#NETWORK_MODE=$NETWORK_MODE# \
-e s#^IFNAME=.*#IFNAME=$NIC# \
-e s#^ETHDRV=.*#ETHDRV=$ETHDRV# \
-e s#^ETHPCIID=.*#ETHPCIID=$ETHPCIID# \
-e s#^NR_HUGEPAGES=.*#NR_HUGEPAGES=$NR_HUGEPAGES# \
-e s#^USER=.*#USER=$USER# \
-e s#^GROUP=.*#GROUP=$GROUP# \
-e s#^SCYLLA_HOME=.*#SCYLLA_HOME=$SCYLLA_HOME# \
-e s#^SCYLLA_CONF=.*#SCYLLA_CONF=$SCYLLA_CONF# \
-e s#^SET_NIC=.*#SET_NIC=$SET_NIC# \
-e "s#^SCYLLA_ARGS=.*#SCYLLA_ARGS=\"$SCYLLA_ARGS\"#" \
-e s#^AMI=.*#AMI=$AMI# \
$SYSCONFIG/scylla-server > /tmp/scylla-server
mv /tmp/scylla-server $SYSCONFIG/scylla-server