mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 20:16:43 +00:00
Currently we only have EC2 configuration verification on AMI, so move it to /usr/lib/scylla and run it from scylla_setup, to make it usable for non-AMI users. Fixes #1997 Signed-off-by: Takuya ASADA <syuu@scylladb.com> Message-Id: <1498811107-29135-1-git-send-email-syuu@scylladb.com>
58 lines
1.7 KiB
Bash
Executable File
58 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
. /usr/lib/scylla/scylla_lib.sh
|
|
|
|
get_en_interface_type() {
|
|
TYPE=`curl -s http://169.254.169.254/latest/meta-data/instance-type|cut -d . -f 1`
|
|
SUBTYPE=`curl -s http://169.254.169.254/latest/meta-data/instance-type|cut -d . -f 2`
|
|
case $TYPE in
|
|
"c3"|"c4"|"d2"|"i2"|"r3") echo -n "ixgbevf";;
|
|
"i3"|"p2"|"r4"|"x1") echo -n "ena";;
|
|
"m4")
|
|
if [ "$SUBTYPE" = "16xlarge" ]; then
|
|
echo -n "ena"
|
|
else
|
|
echo -n "ixgbevf"
|
|
fi;;
|
|
esac
|
|
}
|
|
|
|
is_vpc_enabled() {
|
|
MAC=`cat /sys/class/net/eth0/address`
|
|
VPC_AVAIL=`curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC/|grep vpc-id`
|
|
[ -n "$VPC_AVAIL" ]
|
|
}
|
|
|
|
if ! is_ec2; then
|
|
exit 0
|
|
fi
|
|
|
|
TYPE=`curl -s http://169.254.169.254/latest/meta-data/instance-type`
|
|
EN=`get_en_interface_type`
|
|
DRIVER=`ethtool -i eth0|awk '/^driver:/ {print $2}'`
|
|
if [ "$EN" = "" ]; then
|
|
tput setaf 1
|
|
tput bold
|
|
echo "$TYPE doesn't support enahanced networking!"
|
|
tput sgr0
|
|
echo "To enable enhanced networking, please use the instance type which supports it."
|
|
echo "More documentation available at: "
|
|
echo "http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html#enabling_enhanced_networking"
|
|
exit 1
|
|
elif ! is_vpc_enabled; then
|
|
tput setaf 1
|
|
tput bold
|
|
echo "VPC is not enabled!"
|
|
tput sgr0
|
|
echo "To enable enhanced networking, please enable VPC."
|
|
exit 1
|
|
elif [ "$DRIVER" != "$EN" ]; then
|
|
tput setaf 1
|
|
tput bold
|
|
echo "Enhanced networking is disabled!"
|
|
tput sgr0
|
|
echo "More documentation available at: "
|
|
echo "http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html"
|
|
exit 1
|
|
fi
|