Skip to content

Commit

Permalink
V20.04.1.y backports (#14)
Browse files Browse the repository at this point in the history
* Create RPM/DEB packages for CentOS/7 and Ubuntu 18.04

* RPM: Due to the fact RPC code is not compatible with Python2.7
  and Python2 is declared unsupported since 2020 this RPM
  requires "python3.6" to be installed on CentOS/7 system.
  - on x86_64 you can install it from IUS repo:
      https://github.com/iusrepo/python36
  - on aarch74 you need to rebuild python36 RPMs from sources

* DEB: debianize spdk to build on Ubuntu 18.04
  - Added debian/* directory with definition of 2 packages:
    spdk and spdk-dev (headers and static libs)
  - Added scripts/setup.py to create Python package

* nvmf_tgt: cleaned up hugepage allocation procedure
* packaging: Added shared libraries and headers of DPDK and SPDK
* set pkg_prefix=/opt/mellanox/spdk
* packaging: bump version to 20.04.1 in scripts

Signed-off-by: Yurii Shestakov <yshestakov@gmail.com>
  • Loading branch information
yshestakov authored and andrii-holovchenko committed Aug 8, 2021
1 parent adeb049 commit 5f5775b
Show file tree
Hide file tree
Showing 34 changed files with 1,694 additions and 1 deletion.
16 changes: 16 additions & 0 deletions contrib/default/nvmf_tgt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# /etc/default/nvmf_tgt
# not executable file
# contains environment variables for /etc/systemd/system/nvmf_tgt.service

# run on 4 cores out of 16 on Bluewhale server
CPU_MASK=0x0f00
# default config file
NVMF_TGT_CONF=/etc/spdk/nvmf_tgt.conf

# extra args like -r 0.0.0.0 to start RPC listener on
EXTRA_ARGS=""

MIN_HUGEMEM="2G"
# used in the /usr/lib/systemd/system/nvmf_tgt.service
# to run `hugeadm --pool-pages-min DEFAULT:2G` command
# to allocate needed amount of huge pages for SPDK app
11 changes: 11 additions & 0 deletions contrib/default/spdk_tgt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# /etc/default/spdk_tgt
# not executable file
# contains environment variables for /etc/systemd/system/spdk_tgt.service

# run on 4 cores out of 16 on Bluewhale server
CPU_MASK=0x0f00
# default config file
NVMF_TGT_CONF=/etc/spdk/spdk_tgt.conf

# extra args like -r 0.0.0.0 to start RPC listener on
EXTRA_ARGS="-r 0.0.0.0"
6 changes: 6 additions & 0 deletions contrib/default/vhost
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is included by vhost.service as
# EnvironmentFile=/etc/default/vhost
# Run on 2 cores only: -m 0x30000
# Wait for RPC to initialize the sybsystems: --wait-for-rpc
VHOST_ARGS="-m 0x30000 -c /etc/spdk/vhost.conf -d -S /var/run/vhost --wait-for-rpc"
# -r /var/tmp/vhost.sock
32 changes: 32 additions & 0 deletions contrib/git-archive-spdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e
WD=$(dirname $(dirname $(readlink -f $0)))
cd $WD
if [ -e /etc/redhat-release ] ; then
ODIR=~/rpmbuild/SOURCES
else
ODIR=$(readlink -f ..)
fi
# VER=18.10
# VER=19.03
# VER=20.01
function get_ver()
{
by_tag=$(git describe HEAD --tags)
v_pfx=${by_tag%%-*}
v_num=${v_pfx#v}
echo $v_num
}
git submodule init
git submodule update
VER=$(get_ver)
test -n "$VER"
set -x
for mod in dpdk ocf intel-ipsec-mb isa-l ; do
(cd $mod;
git archive \
--format=tar.gz --prefix=$mod/ -o $ODIR/spdk-$mod-$VER.tar.gz HEAD
)
done

git archive --format=tar.gz --prefix=spdk-$VER/ -o $ODIR/spdk-$VER.tar.gz HEAD
43 changes: 43 additions & 0 deletions contrib/nvmf_tgt.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# NVMf Target Configuration File
# Define NVMf protocol global options

[Transport]
Type RDMA
MaxQueueDepth 256
# number of queues in emulation configuration (JSON file) plus 2
MaxQueuesPerSession 34

[Transport]
Type TCP

[Nvme]
RetryCount 4
Timeout 0
ActionOnTimeout None
AdminPollRate 100000
# BlockSize 4096
#HotplugEnable Yes
#TransportId "trtype:PCIe traddr:0000:06:00.0" Nvme0
#TransportId "trtype:PCIe traddr:0000:08:00.0" Nvme1
#TransportId "trtype:PCIe traddr:0000:0a:00.0" Nvme2
##TransportId "trtype:PCIe traddr:0000:0c:00.0" Nvme3
# TransportId "trtype:TCP adrfam:IPv4 traddr:11.210.99.85 trsvcid:1023 subnqn:nqn.2018-01.mini-regression:ram0" Nvme0

[Subsystem0]
NQN nqn.2016-06.io.spdk.snic30:null0
SN SPDK000DEADBEAF00
Namespace Null0 1
Namespace Null1 2
Listen RDMA 11.210.99.130:4420
AllowAnyHost yes

#[Subsystem0]
# NQN nqn.2016-06.io.spdk.swx-bw-03:nvme0
# SN SPDK000DEADBEAF00
# Namespace Nvme0n1p1 1
# Namespace Nvme1n1p1 2
# Namespace Nvme2n1p1 3
# #Namespace Nvme3n1 4
# Listen RDMA 11.210.8.34:1023
# Listen RDMA 11.212.79.34:1023
# AllowAnyHost yes
22 changes: 22 additions & 0 deletions contrib/nvmf_tgt.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[Unit]
Description=SPDK NVMf target
Wants=network-online.target openibd.service
After=network.target network-online.target openibd.service

[Service]
EnvironmentFile=/etc/default/nvmf_tgt
ExecStartPre=/usr/sbin/setup_hugepages.sh
ExecStartPre=/usr/sbin/setup_nvmf_tgt.py -c -f $NVMF_TGT_CONF
ExecStart=/usr/sbin/nvmf_tgt -m $CPU_MASK -c $NVMF_TGT_CONF $EXTRA_ARGS
ExecStopPost=/usr/sbin/setup_nvmf_tgt.py -r -f $NVMF_TGT_CONF
# Restart=on-failure
User=root
#RuntimeDirectory=/tmp
#RuntimeDirectoryMode=0700
# KillSignal=Term
SendSIGKILL=no
SendSIGHUP=no
KillMode=process

[Install]
WantedBy=multi-user.target
81 changes: 81 additions & 0 deletions contrib/rebuild-spdk-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash -ex
# :vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4
# The script to (re)build SPDK DEB (Ubuntu) packags
# from the checked out source tree (spdk subdir)
function get_ver()
{
by_tag=$(git describe HEAD --tags)
v_pfx=${by_tag%%-*}
v_num=${v_pfx#v}
echo $v_num
}
test -e spdk
cd spdk
VER=$(get_ver)
test -n "$VER"
cd ..
if [ -z "$BUILD_NUMBER" ] ; then
BUILD_NUMBER=1
fi

function pack_dist()
{
cd spdk
export VER
./contrib/git-archive-spdk.sh
cd scripts
python3 setup.py sdist -d ../../
cd ../..
}

function generate_changelog()
{
today=$(date +"%a, %d %b %Y %T %z")
sed -e "s/@PACKAGE_VERSION@/$VER/" -e "s/@PACKAGE_REVISION@/$BUILD_NUMBER/" \
-e 's/@PACKAGE_BUGREPORT@/support@mellanox.com/' -e "s/@BUILD_DATE_CHANGELOG@/$today/" \
debian/changelog.in > debian/changelog
}
function unpack_dist()
{
rm -rf spdk-$VER
tar xf spdk-$VER.tar.gz
cd spdk-$VER
for MOD in dpdk ocf intel-ipsec-mb isa-l ; do
tar xf ../spdk-$MOD-$VER.tar.gz
done
generate_changelog
cd ..
tar zcf ./spdk_$VER.orig.tar.gz spdk-$VER
# cd spdk-$VER
# tar xf ../debian.tar.gz
# cd ..
}

function build_main()
{
cd spdk-$VER
dpkg-buildpackage -uc -us -rfakeroot
cd ..
}

function unpack_dist_rpc()
{
rm -rf spdk-rpc-$VER
tar xf ./spdk-rpc-$VER.tar.gz
tar zcf ./spdk-rpc_$VER.orig.tar.gz spdk-rpc-$VER
cd spdk-rpc-$VER
# tar xf ../scripts-debian.tar.gz
generate_changelog
cd ..
}
function build_rpc()
{
cd spdk-rpc-$VER
dpkg-buildpackage -uc -us -rfakeroot
cd ..
}
pack_dist
unpack_dist
build_main
unpack_dist_rpc
build_rpc
5 changes: 5 additions & 0 deletions contrib/setup_hugepages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e
# Dependency on package:
# libhugetlbfs-utils @ CentOS
# hugepages @ Ubuntu
exec /usr/bin/hugeadm --pool-pages-min DEFAULT:${MIN_HUGEMEM:-2G}
Loading

0 comments on commit 5f5775b

Please sign in to comment.