summaryrefslogtreecommitdiffstats
path: root/src/seastar/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'src/seastar/kvm')
-rw-r--r--src/seastar/kvm/README.md55
-rwxr-xr-xsrc/seastar/kvm/build.sh6
-rwxr-xr-xsrc/seastar/kvm/register.sh3
-rwxr-xr-xsrc/seastar/kvm/scripts/bootstrap.sh19
4 files changed, 83 insertions, 0 deletions
diff --git a/src/seastar/kvm/README.md b/src/seastar/kvm/README.md
new file mode 100644
index 000000000..0cf65477c
--- /dev/null
+++ b/src/seastar/kvm/README.md
@@ -0,0 +1,55 @@
+# seastar-in-kvm
+Create a VM for Seastar development environment
+
+# Why we need this
+SeaStar scores muximum performance with DPDK, but it cannot live with existing NIC driver/Linux kernel network stack.
+Also it directly accesses NIC device, it's bit hard to try it on remote node.
+
+seastar-in-kvm offers Fedora VM with SeaStar + DPDK without setup, it's easiest way to begin SeaStar application development.
+
+### Prerequire
+
+On Fedora 21:
+```
+yum install @virtualization
+systemctl enable libvirtd
+systemctl start libvirtd
+yum install libguestfs-tools-c virt-install
+```
+
+### How to build & run
+```
+./build.sh
+./register.sh
+virsh start seastar-dev && virsh console seastar-dev
+(Try login as 'seastar' after firstboot.sh finished, Fedora will ask new password for the user)
+```
+
+### Usage of the VM
+
+Wait until finish running setup script on first startup.
+Then login as 'seastar', login prompt will ask for entering new password.
+
+After login to seastar, initialize DPDK module by following instruction:
+```
+sudo su - # entering root user
+resize # extend console to actual terminal window size
+export TERM=xterm-256color # set terminal type
+cd ~/dpdk
+./tools/setup.sh
+
+# input numbers by following order:
+(type 9 to re-compile DPDK)
+(type 12 to insert IGB UIO module)
+(type 15, then input "64" to setup hugepage mappings)
+(type 18, then input PCI device id something like "0000:xx:yy.z",
+which is shown at 'Network devices using DPDK-compatible driver')
+(type 30 to exit)
+
+cd ~/seastar
+# httpd example
+env LD_LIBRARY_PATH=~/dpdk/x86_64-native-linuxapp-gcc/lib/ \
+./build/release/apps/httpd/httpd --network-stack native --dpdk-pmd --csum-offload off
+```
+
+
diff --git a/src/seastar/kvm/build.sh b/src/seastar/kvm/build.sh
new file mode 100755
index 000000000..f5b98ae37
--- /dev/null
+++ b/src/seastar/kvm/build.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm -rf /tmp/seastar
+cp -a ../ /tmp/seastar
+virt-builder fedora-21 -o seastar-dev.qcow2 --format qcow2 --size 20G --hostname seastar-dev --install "@core" --update --selinux-relabel --copy-in /tmp/seastar:/root/ --firstboot scripts/bootstrap.sh
+rm -rf /tmp/seastar
diff --git a/src/seastar/kvm/register.sh b/src/seastar/kvm/register.sh
new file mode 100755
index 000000000..73622d951
--- /dev/null
+++ b/src/seastar/kvm/register.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+virt-install --import --noreboot --name seastar-dev --vcpus 4 --ram 4096 --disk path=`realpath seastar-dev.qcow2`,format=qcow2,bus=virtio --accelerate --network=network:default,model=virtio --serial pty --cpu host --rng=/dev/random
diff --git a/src/seastar/kvm/scripts/bootstrap.sh b/src/seastar/kvm/scripts/bootstrap.sh
new file mode 100755
index 000000000..dd0258e3f
--- /dev/null
+++ b/src/seastar/kvm/scripts/bootstrap.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+nmcli c modify eth0 ipv4.ignore-auto-dns "yes"
+systemctl restart network
+echo nameserver 8.8.8.8 > /etc/resolv.conf
+useradd -m -p "" -g wheel seastar
+chage -d 0 seastar
+yum install -y gcc gcc-c++ libaio-devel ninja-build ragel hwloc-devel numactl-devel libpciaccess-devel cryptopp-devel boost-devel kernel-devel libxml2-devel zlib-devel libasan libubsan git wget python3 tar pciutils xterm
+cd /root
+wget http://dpdk.org/browse/dpdk/snapshot/dpdk-2.0.0.tar.gz
+tar -xpf dpdk-2.0.0.tar.gz
+mv dpdk-2.0.0 dpdk
+cd dpdk
+cat config/common_linuxapp | sed -e "s/CONFIG_RTE_MBUF_REFCNT_ATOMIC=y/CONFIG_RTE_MBUF_REFCNT_ATOMIC=n/g" | sed -e "s/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g" > /tmp/common_linuxapp
+mv /tmp/common_linuxapp config
+make T=x86_64-native-linuxapp-gcc install
+cd -
+cd seastar
+./configure.py --dpdk-target ~/dpdk/x86_64-native-linuxapp-gcc
+ninja-build -j2