summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys-block/tgt/ChangeLog8
-rw-r--r--sys-block/tgt/files/tgtd.confd4
-rw-r--r--sys-block/tgt/files/tgtd.initd125
-rw-r--r--sys-block/tgt/metadata.xml5
-rw-r--r--sys-block/tgt/tgt-1.0.60.ebuild64
5 files changed, 205 insertions, 1 deletions
diff --git a/sys-block/tgt/ChangeLog b/sys-block/tgt/ChangeLog
index c2598a075de0..41544a7a31aa 100644
--- a/sys-block/tgt/ChangeLog
+++ b/sys-block/tgt/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-block/tgt
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-block/tgt/ChangeLog,v 1.21 2015/04/01 22:24:56 dilfridge Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/tgt/ChangeLog,v 1.22 2015/08/06 02:15:06 prometheanfire Exp $
+
+*tgt-1.0.60 (06 Aug 2015)
+
+ 06 Aug 2015; Matthew Thode <prometheanfire@gentoo.org> +files/tgtd.confd,
+ +files/tgtd.initd, +tgt-1.0.60.ebuild, metadata.xml:
+ major bump, also fixing bugs bug 433820 bug 417501 bug 482830
01 Apr 2015; Andreas K. Huettel <dilfridge@gentoo.org> tgt-1.0.19.ebuild,
tgt-1.0.22.ebuild, tgt-1.0.24-r1.ebuild:
diff --git a/sys-block/tgt/files/tgtd.confd b/sys-block/tgt/files/tgtd.confd
new file mode 100644
index 000000000000..fd4c098eaef2
--- /dev/null
+++ b/sys-block/tgt/files/tgtd.confd
@@ -0,0 +1,4 @@
+# Here you can specify options that are passed directly to tgt daemon
+TGTD_OPTS=""
+
+# vim: ft=gentoo-conf-d
diff --git a/sys-block/tgt/files/tgtd.initd b/sys-block/tgt/files/tgtd.initd
new file mode 100644
index 000000000000..dfc469ba2ce6
--- /dev/null
+++ b/sys-block/tgt/files/tgtd.initd
@@ -0,0 +1,125 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-block/tgt/files/tgtd.initd,v 1.1 2015/08/06 02:15:06 prometheanfire Exp $
+
+TGTD_CONFIG=/etc/tgt/targets.conf
+
+TASK=$1
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting target framework daemon"
+ ebegin "Starting ${SVCNAME}"
+ # Start tgtd first.
+ start-stop-daemon --start --quiet \
+ --name tgtd \
+ --exec /usr/sbin/tgtd -- \
+ ${TGTD_OPTS}
+ RETVAL=$?
+ if [ "$RETVAL" -ne 0 ] ; then
+ echo "Could not start tgtd (is tgtd already running?)"
+ exit 1
+ fi
+ # We need to wait for 1 second before do anything with tgtd
+ sleep 1
+ # Put tgtd into "offline" state until all the targets are configured.
+ # We don't want initiators to (re)connect and fail the connection
+ # if it's not ready
+ tgtadm --op update --mode sys --name State -v offline
+ # Configure the targets.
+ tgt-admin --update ALL -c $TGTD_CONFIG
+ # Put tgtd into "ready" state.
+ tgtadm --op update --mode sys --name State -v ready
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ ebegin "Stopping target framework daemon"
+ # start-stop-daemon --stop --exec /usr/sbin/tgtd --quiet
+ if [ "$RUNLEVEL" == 0 -o "$RUNLEVEL" == 6 ] ; then
+ forcedstop
+ fi
+ # Remove all targets. It only removes targets which are not in use.
+ tgt-admin --update ALL -c /dev/null &>/dev/null
+ # tgtd will exit if all targets were removed
+ tgtadm --op delete --mode system &>/dev/null
+ RETVAL=$?
+ if [ "$RETVAL" -eq 107 ] ; then
+ echo "tgtd is not running"
+ if [ "$TASK" != "restart" ] ; then
+ exit 1
+ fi
+ elif [ "$RETVAL" -ne 0 ] ; then
+ echo "Some initiators are still connected - could not stop tgtd"
+ exit 2
+ fi
+ # echo -n
+ eend $?
+}
+
+forcedstop() {
+ # NOTE: Forced shutdown of the iscsi target may cause data corruption
+ # for initiators that are connected.
+ echo "Force-stopping target framework daemon"
+ # Offline everything first. May be needed if we're rebooting, but
+ # expect the initiators to reconnect cleanly when we boot again
+ # (i.e. we don't want them to reconnect to a tgtd which is still
+ # working, but the target is gone).
+ tgtadm --op update --mode sys --name State -v offline &>/dev/null
+ RETVAL=$?
+ if [ "$RETVAL" -eq 107 ] ; then
+ echo "tgtd is not running"
+ if [ "$TASK" != "restart" ] ; then
+ exit 1
+ fi
+ else
+ tgt-admin --offline ALL
+ # Remove all targets, even if they are still in use.
+ tgt-admin --update ALL -c /dev/null -f
+ # It will shut down tgtd only after all targets were removed.
+ tgtadm --op delete --mode system
+ RETVAL=$?
+ if [ "$RETVAL" -ne 0 ] ; then
+ echo "Failed to shutdown tgtd"
+ exit 1
+ fi
+ fi
+ echo -n
+}
+
+reload() {
+ echo "Updating target framework daemon configuration"
+ # Update configuration for targets. Only targets which
+ # are not in use will be updated.
+ tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null
+ RETVAL=$?
+ if [ "$RETVAL" -eq 107 ] ; then
+ echo "tgtd is not running"
+ exit 1
+ fi
+}
+
+forcedreload() {
+ echo "Force-updating target framework daemon configuration"
+ # Update configuration for targets, even those in use.
+ tgt-admin --update ALL -f -c $TGTD_CONFIG &>/dev/null
+ RETVAL=$?
+ if [ "$RETVAL" -eq 107 ] ; then
+ echo "tgtd is not running"
+ exit 1
+ fi
+}
+
+status() {
+ TGTD_PROC=$(pidof -c -o $$ -o %PPID tgtd)
+ if [ -n "$TGTD_PROC" ] ; then
+ echo "tgtd is running. Run 'tgt-admin -s' to see detailed target info."
+ else
+ echo "tgtd is NOT running."
+ fi
+}
diff --git a/sys-block/tgt/metadata.xml b/sys-block/tgt/metadata.xml
index edb8de50354a..a8b121f2ed61 100644
--- a/sys-block/tgt/metadata.xml
+++ b/sys-block/tgt/metadata.xml
@@ -2,6 +2,10 @@
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>cluster</herd>
+ <maintainer>
+ <email>prometheanfire@gentoo.org</email>
+ <name>Matthew Thode</name>
+ </maintainer>
<longdescription>
iSCSI Target daemon with rdma support
</longdescription>
@@ -9,6 +13,7 @@ iSCSI Target daemon with rdma support
<flag name="ibmvio">Add support for IBM Virtual I/O</flag>
<flag name="fcp">Add support for new FC protocol</flag>
<flag name="fcoe">Add support for FCoE protocol</flag>
+ <flag name="rbd">Add support for ceph block devices</flag>
</use>
<upstream>
<remote-id type="github">fujita/tgt</remote-id>
diff --git a/sys-block/tgt/tgt-1.0.60.ebuild b/sys-block/tgt/tgt-1.0.60.ebuild
new file mode 100644
index 000000000000..99a5383504ef
--- /dev/null
+++ b/sys-block/tgt/tgt-1.0.60.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-block/tgt/tgt-1.0.60.ebuild,v 1.1 2015/08/06 02:15:06 prometheanfire Exp $
+
+EAPI=5
+
+inherit flag-o-matic toolchain-funcs
+
+MY_TREE="ab51727"
+
+DESCRIPTION="Linux SCSI target framework (tgt)"
+HOMEPAGE="http://stgt.sourceforge.net"
+SRC_URI="https://github.com/fujita/tgt/tarball/v${PV} -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="fcoe fcp ibmvio infiniband rbd"
+
+CDEPEND="dev-perl/Config-General
+ dev-libs/libxslt
+ rbd? ( sys-cluster/ceph )
+ infiniband? (
+ sys-infiniband/libibverbs:=
+ sys-infiniband/librdmacm:=
+ )"
+DEPEND="${CDEPEND}
+ app-text/docbook-xsl-stylesheets"
+RDEPEND="${DEPEND}
+ dev-libs/libaio
+ sys-apps/sg3_utils"
+
+S=${WORKDIR}/fujita-tgt-${MY_TREE}
+
+pkg_setup() {
+ tc-export CC
+}
+
+src_prepare() {
+ sed -i -e 's:\($(CC)\) $^:\1 $(LDFLAGS) $^:' usr/Makefile || die
+
+ # make sure xml docs are generated before trying to install them
+ sed -i -e "s@install: @& all @g" doc/Makefile || die
+}
+
+src_compile() {
+ local myconf
+ use ibmvio && myconf="${myconf} IBMVIO=1"
+ use infiniband && myconf="${myconf} ISCSI_RDMA=1"
+ use fcp && myconf="${myconf} FCP=1"
+ use fcoe && myconf="${myconf} FCOE=1"
+ use rbd && myconf="${myconf} CEPH_RBD=1"
+
+ emake -C usr/ KERNELSRC="${KERNEL_DIR}" ISCSI=1 ${myconf}
+ emake -C doc
+}
+
+src_install() {
+ emake install-programs install-scripts install-doc DESTDIR="${D}" docdir=/usr/share/doc/${PF}
+ newinitd "${FILESDIR}"/tgtd.initd tgtd
+ newconfd "${FILESDIR}"/tgtd.confd tgtd
+ dodir /etc/tgt
+ keepdir /etc/tgt
+}