forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts & config files for install / startup SeaStar instance
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
- Loading branch information
Showing
9 changed files
with
270 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
mode=dpdk | ||
netconfig=nmcli | ||
eth=eth0 | ||
eth_driver=ixgbevf | ||
dpdk_build=../build/dpdk | ||
dpdk_src=../dpdk | ||
nr_hugepages=64 | ||
program=../build/release/apps/httpd/httpd | ||
args="--network-stack native --csum-offload off" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/python3 | ||
# | ||
# This file is open source software, licensed to you under the terms | ||
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
# distributed with this work for additional information regarding copyright | ||
# ownership. You may not use this file except in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
import dbus | ||
import sys | ||
|
||
if len(sys.argv) < 2: | ||
print("usage: %s [ifname]" % sys.argv[0]) | ||
sys.exit(1) | ||
|
||
bus = dbus.SystemBus() | ||
nm_proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager") | ||
nm_obj = dbus.Interface(nm_proxy, "org.freedesktop.NetworkManager") | ||
for dev_path in nm_obj.GetDevices(): | ||
dev_proxy = bus.get_object("org.freedesktop.NetworkManager", dev_path) | ||
dev_obj = dbus.Interface(dev_proxy, "org.freedesktop.DBus.Properties") | ||
dev_props = dev_obj.GetAll("org.freedesktop.NetworkManager.Device") | ||
if sys.argv[1] != dev_props['Interface']: | ||
continue | ||
conn_proxy = bus.get_object("org.freedesktop.NetworkManager", dev_props['ActiveConnection']) | ||
conn_obj = dbus.Interface(conn_proxy, "org.freedesktop.DBus.Properties") | ||
conn_props = conn_obj.GetAll("org.freedesktop.NetworkManager.Connection.Active") | ||
print(conn_props['Id']) | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh -e | ||
# | ||
# This file is open source software, licensed to you under the terms | ||
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
# distributed with this work for additional information regarding copyright | ||
# ownership. You may not use this file except in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
if [ $# -lt 1 ]; then | ||
echo "usage: $0 [config]" | ||
exit 1 | ||
fi | ||
|
||
. ./$1 | ||
|
||
if [ "$mode" != "nat" ]; then | ||
exit 0 | ||
fi | ||
|
||
if [ "$netconfig" = "nmcli" ]; then | ||
eth_conn_name=`./get_conn_name.py $eth` | ||
if [ "$eth_conn_name" = "" ]; then | ||
echo "Cannot detect $eth connection name" | ||
exit 1 | ||
fi | ||
nmcli c add type bridge ifname $bridge | ||
nmcli c mod bridge-$bridge bridge.stp no | ||
nmcli c add type bridge-slave ifname $eth master bridge-$bridge | ||
nmcli c del "$eth_conn_name" | ||
fi | ||
echo "net.ipv4.ip_local_port_range= $local_port_start $local_port_end" >> /etc/sysctl.conf | ||
sysctl -p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mode=nat | ||
netconfig=seastar | ||
eth=eth0 | ||
eth_driver=ixgbevf | ||
tap=tap0 | ||
bridge=br0 | ||
local_port_start=32768 | ||
local_port_end=49152 | ||
dpdk_build=../build/dpdk | ||
dpdk_src=../dpdk | ||
nr_hugepages=64 | ||
program=../build/release/apps/httpd/httpd | ||
args="--network-stack native --csum-offload off" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/sh -e | ||
# | ||
# This file is open source software, licensed to you under the terms | ||
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
# distributed with this work for additional information regarding copyright | ||
# ownership. You may not use this file except in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
if [ $# -lt 1 ]; then | ||
echo "usage: $0 [config]" | ||
exit 1 | ||
fi | ||
|
||
. ./$1 | ||
|
||
if [ "$mode" = "nat" ]; then | ||
if [ "$netconfig" = "seastar" ]; then | ||
if [ "`ip link show $bridge`" = "" ]; then | ||
killall dhclient || true | ||
eth_mac=`ip link show $eth |grep link|awk '{print $2}'` | ||
eth_ip=`ip addr show $eth |grep 'inet '|awk '{print $2}'` | ||
ip addr del $eth_ip dev $eth | ||
ip link add name $bridge type bridge | ||
ip link set $bridge address $eth_mac | ||
ip link set dev $eth master $bridge | ||
dhclient $bridge | ||
fi | ||
fi | ||
fi | ||
|
||
if [ "$mode" = "dpdk" ] || [ "$mode" = "nat" ]; then | ||
modprobe uio | ||
if [ "`lsmod|grep igb_uio`" = "" ]; then | ||
insmod $dpdk_build/kmod/igb_uio.ko | ||
fi | ||
$dpdk_src/tools/dpdk_nic_bind.py --force --bind=igb_uio $eth | ||
mkdir -p /mnt/huge | ||
mount -t hugetlbfs nodev /mnt/huge | ||
echo $nr_hugepages > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages | ||
args="$args --dpdk-pmd" | ||
fi | ||
|
||
if [ "$mode" = "nat" ]; then | ||
ip tuntap del mode tap dev $tap | ||
ip tuntap add mode tap dev $tap one_queue vnet_hdr | ||
ip link set dev $tap up | ||
ip link set dev $tap master $bridge | ||
modprobe vhost-net | ||
chown $user.$user /dev/vhost-net | ||
args="$args --nat-adapter" | ||
fi | ||
|
||
if [ "$mode" = "virtio" ]; then | ||
user=`whoami` | ||
sudo ip tuntap del mode tap dev $tap | ||
sudo ip tuntap add mode tap dev $tap user $user one_queue vnet_hdr | ||
sudo ip link set dev $tap up | ||
sudo ip link set dev $tap master $bridge | ||
sudo modprobe vhost-net | ||
sudo chown $user.$user /dev/vhost-net | ||
fi | ||
|
||
export LD_LIBRARY_PATH=$dpdk_target/lib | ||
$program $args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh -e | ||
# | ||
# This file is open source software, licensed to you under the terms | ||
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
# distributed with this work for additional information regarding copyright | ||
# ownership. You may not use this file except in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
if [ $# -lt 1 ]; then | ||
echo "usage: $0 [config]" | ||
exit 1 | ||
fi | ||
|
||
. ./$1 | ||
|
||
if [ "$mode" = "nat" ]; then | ||
ip tuntap del mode tap dev $tap | ||
fi | ||
|
||
if [ "$mode" = "virtio" ]; then | ||
sudo ip tuntap del mode tap dev $tap | ||
fi | ||
|
||
if [ "$mode" = "dpdk" ] || [ "$mode" = "nat" ]; then | ||
pci_id=`$dpdk_src/tools/dpdk_nic_bind.py --status|grep "igb_uio"|awk '{print $1}'` | ||
if [ "$pci_id" != "" ]; then | ||
$dpdk_src/tools/dpdk_nic_bind.py -u $pci_id | ||
$dpdk_src/tools/dpdk_nic_bind.py -b $eth_driver $pci_id | ||
rmmod igb_uio | ||
fi | ||
umount /mnt/huge | ||
if [ "$netconfig" = "seastar" ]; then | ||
brctl addif $bridge $eth | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import dbus | ||
import pprint | ||
import sys | ||
|
||
bus = dbus.SystemBus() | ||
proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings") | ||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings") | ||
for path in settings.ListConnections(): | ||
con_proxy = bus.get_object("org.freedesktop.NetworkManager", path) | ||
conn = dbus.Interface(con_proxy, "org.freedesktop.NetworkManager.Settings.Connection") | ||
settings = conn.GetSettings() | ||
print("path: %s" % path) | ||
print(" id: %s" % settings['connection']['id']) | ||
print(" uuid: %s" % settings['connection']['uuid']) | ||
print(" type: %s" % settings['connection']['type']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
mode=virtio | ||
netconfig=nmcli | ||
eth=eth0 | ||
tap=tap0 | ||
bridge=virbr0 | ||
dpdk_build=../build/dpdk | ||
dpdk_src=../dpdk | ||
nr_hugepages=64 | ||
program=../build/release/apps/httpd/httpd | ||
args="--network-stack native --csum-offload off" |