Skip to content

Commit

Permalink
VM image build script to running SeaStar on Linux guest
Browse files Browse the repository at this point in the history
Creates Linux guest with SeaStar + DPDK in just 2 commands.

Signed-off-by: Takuya ASADA <[email protected]>
  • Loading branch information
syuu1228 authored and avikivity committed May 27, 2015
1 parent bb4b155 commit c620bab
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
55 changes: 55 additions & 0 deletions kvm/README.md
Original file line number Diff line number Diff line change
@@ -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
```


6 changes: 6 additions & 0 deletions kvm/build.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions kvm/register.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions kvm/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -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 xen-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 --disable-xen
ninja-build -j2

0 comments on commit c620bab

Please sign in to comment.