dist: move '--cpuset' and '--smp' configuration to scylla_cpuset_setup / cpuset.conf

These parameters are only required for AMI, not for non-AMI environment which want to enable SET_NIC, so split them to indivisual script / conf file, call it from AMI install script.
This commit is contained in:
Takuya ASADA
2016-05-17 22:17:57 +09:00
parent 46fa80a5a6
commit 49cdd0b786
6 changed files with 49 additions and 5 deletions

42
dist/common/scripts/scylla_cpuset_setup vendored Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash -e
#
# Copyright (C) 2016 ScyllaDB
print_usage() {
echo "scylla_cpuset_setup --cpuset 1-7 --smp 7"
echo " --cpuset CPUs to use (in cpuset(7) format; default: all))"
echo " --smp number of threads (default: one per CPU)"
exit 1
}
CPUSET=
SMP=
while [ $# -gt 0 ]; do
case "$1" in
"--cpuset")
CPUSET=$2
shift 2
;;
"--smp")
SMP=$2
shift 2
;;
*)
print_usage
;;
esac
done
if [ "$CPUSET" = "" ] && [ "$SMP" = "" ]; then
print_usage
fi
OUT="CPUSET=\""
if [ "$CPUSET" != "" ]; then
OUT="$OUT--cpuset $CPUSET "
fi
if [ "$SMP" != "" ]; then
OUT="$OUT--smp $SMP "
fi
OUT="$OUT\""
echo $OUT > /etc/scylla.d/cpuset.conf

View File

@@ -75,11 +75,8 @@ echo Setting parameters on $SYSCONFIG/scylla-server
ETHDRV=`/usr/lib/scylla/dpdk_nic_bind.py --status | grep if=$NIC | sed -e "s/^.*drv=//" -e "s/ .*$//"`
ETHPCIID=`/usr/lib/scylla/dpdk_nic_bind.py --status | grep if=$NIC | awk '{print $1}'`
NR_CPU=`cat /proc/cpuinfo |grep processor|wc -l`
if [ "$AMI" = "yes" ] && [ $NR_CPU -ge 8 ] && [ "$SET_NIC" = "no" ]; then
NR=$((NR_CPU - 1))
SET_NIC="yes"
SCYLLA_ARGS="$SCYLLA_ARGS --cpuset 1-$NR --smp $NR"
fi
sed -e s#^NETWORK_MODE=.*#NETWORK_MODE=$NETWORK_MODE# \
-e s#^IFNAME=.*#IFNAME=$NIC# \

4
dist/common/scylla.d/cpuset.conf vendored Normal file
View File

@@ -0,0 +1,4 @@
# DO NO EDIT
# This file should be automatically configure by scylla_cpuset_setup
#
# CPUSET="--cpuset 0 --smp 1"

View File

@@ -11,7 +11,7 @@ EnvironmentFile=@@SYSCONFDIR@@/scylla-server
EnvironmentFile=/etc/scylla.d/*.conf
WorkingDirectory=$SCYLLA_HOME
ExecStartPre=/usr/bin/sudo /usr/lib/scylla/scylla_prepare
ExecStart=/usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE
ExecStart=/usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE $CPUSET
ExecStopPost=/usr/bin/sudo /usr/lib/scylla/scylla_stop
TimeoutStartSec=900
KillMode=process

View File

@@ -163,6 +163,7 @@ rm -rf $RPM_BUILD_ROOT
%{_prefix}/lib/scylla/scylla_io_setup
%{_prefix}/lib/scylla/scylla_dev_mode_setup
%{_prefix}/lib/scylla/scylla_kernel_check
%{_prefix}/lib/scylla/scylla_cpuset_setup
%{_prefix}/lib/scylla/posix_net_conf.sh
%{_prefix}/lib/scylla/dpdk_nic_bind.py
%{_prefix}/lib/scylla/dpdk_nic_bind.pyc

View File

@@ -41,7 +41,7 @@ script
fi
. "$i"
done
exec /usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE
exec /usr/bin/scylla $SCYLLA_ARGS $SEASTAR_IO $DEV_MODE $CPUSET
end script
post-stop script