Merge pull request #1546 from mischief/open-iscsi

bump(sys-block/open-iscsi): sync with upstream
This commit is contained in:
Nick Owens 2015-10-09 12:48:04 -07:00
commit 79d9f0416b
10 changed files with 418 additions and 0 deletions

View File

@ -1,2 +1,7 @@
# masked upstream due to lua dep, but we don't enable lua support # masked upstream due to lua dep, but we don't enable lua support
~net-analyzer/nmap-6.40 ~net-analyzer/nmap-6.40
# masked in portage-stable, but is unmasked in upstream.
# remove this when upstream portage-stable package.mask is sync'd.
=sys-block/open-iscsi-2.0.873

View File

@ -0,0 +1 @@
DIST open-iscsi-2.0-873.tar.gz 667069 SHA256 7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9 SHA512 4e67116cb7dd49381c9279645e5a661f05596ae6be3b832772089828b3764ca2d04b5dea1bcc337071efb52c3c75a6fb943136c659ee59500f3a198ed0dcea6b WHIRLPOOL 05af106f11da9f9f02c10edd5412d0f99816349e06e192059700eb1ae24a36027c3f0d7ed423aa7bb1c0b9d8b3aa1b6aa72a2aadb00f27762edf16b7f7d08c09

View File

@ -0,0 +1 @@
KERNEL=="sd*", SUBSYSTEMS=="block", RUN{program}="/usr/lib/udev/scripts/iscsidev.sh"

View File

@ -0,0 +1,31 @@
# Copyright 1999-2005 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Id$
#
# This file must contain a InitiatorName entry!
# white space is significent here!
#InitiatorName=iqn.2005-09.tld.domain.hostname:openiscsi-initiator
#InitiatorAlias=foobar
# Sample documentation follows:
# The InitiatorName should take the following format
# iqn.${YEAR}-${MONTH}-${DOMAIN_REVERSED}.${HOSTNAME}:${UNIQUE_STRING}
# Where YEAR and MONTH are the dates that your domain was registered.
# You can use WHOIS to find when your domain was registered.
# If you don't have a real domain in the outside world, invent one, but use
# .local for your top-level.
# Example case #1:
# This assumes you own foobar.co.uk.
# Domain name: foobar.co.uk.
# Registration date: March 2001
# Hostname: linux
# InitiatorName=iqn.2001-03.uk.co.foobar.linux:openiscsi-29b48ad602d5f83dd9cd9aa3ef741216
# Example case #2:
# This assumes you don't have a domain of your own.
# Domain name: foobar.local
# Registration date: March 2001
# Hostname: linux
# InitiatorName=iqn.2001-03.local.foobar.linux:openiscsi-29b48ad602d5f83dd9cd9aa3ef741216

View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
# KERNEL=="sd*", SUBSYSTEMS=="block", RUN{program}="/etc/udev/scripts/iscsidev.sh"
# we only care about iscsi devices
[[ $ID_VENDOR = "IET" ]] || exit 1
# don't care about partitions either
echo $DEVNAME | egrep -q "[0-9]$"
status=$?
[[ $status != 0 ]] || exit 1
#ID_MODEL=VIRTUAL-DISK
#ID_MODEL_ENC=VIRTUAL-DISK
#ID_REVISION=0001
#DEVTYPE=disk
#ID_BUS=scsi
#SUBSYSTEM=block
#ID_SERIAL=1IET_00010001
#DEVPATH=/devices/platform/host74/session68/target74:0:0/74:0:0:1/block/sde
#ID_VENDOR_ENC=IET\x20\x20\x20\x20\x20
#MINOR=64
#ID_SCSI=1
#ACTION=add
#PWD=/
#ID_PART_TABLE_UUID=54f71c65-a5d5-45cd-8915-5ffd5ff4fea6
#ID_FS_TYPE=
#USEC_INITIALIZED=999037905
#MAJOR=8
#ID_SCSI_SERIAL=beaf11
#DEVLINKS=/dev/disk/by-id/scsi-1IET_00010001
#DEVNAME=/dev/sde
#SHLVL=1
#ID_TYPE=disk
#ID_PART_TABLE_TYPE=gpt
#ID_VENDOR=IET
#ID_SERIAL_SHORT=IET_00010001
#SEQNUM=25775
# do the removal
if [[ $ACTION = 'remove' ]]; then
# nohup needed so this isn't constantly run...
nohup find -L /dev/disk/by-path/ -type l -lname ${DEVNAME} -exec rm "{}" + 2>/dev/null &
exit 0
fi
TARGET_NAME=$(lsscsi -t | grep "${DEVNAME}" | awk '{print $3}' | awk -F, '{print $1}')
[[ $TARGET_NAME = '' ]] && exit 1
# we don't know which host is correct
declare -a POSSIBLE_HOSTS
declare -a POSSIBLE_PORTS
for item in $(cat /sys/class/iscsi_connection/connection*/address); do
POSSIBLE_HOSTS+=("${item}")
done
for item in $(cat /sys/class/iscsi_connection/connection*/port); do
POSSIBLE_PORTS+=("${item}")
done
#get correct ip and port
for ((i=0;i<${#POSSIBLE_HOSTS[@]};++i)); do
printf "%s is in %s\n" "$POSSIBLE_HOSTS[i]}" "${POSSIBLE_PORTS[i]}"
iscsiadm --mode node --targetname "${TARGET_NAME}" -p "${POSSIBLE_HOSTS[i]}":"${POSSIBLE_PORTS[i]}"
status=$?
if [[ $status = 0 ]]; then
TARGET_IP="${POSSIBLE_HOSTS[i]}"
TARGET_PORT="${POSSIBLE_PORTS[i]}"
break
fi
done
# exit if not found
[[ -z $TARGET_IP ]] && exit 1
[[ -z $TARGET_PORT ]] && exit 1
# actually create the link
mkdir -p /dev/disk/by-path/
ln -s "${DEVNAME}" "/dev/disk/by-path/ip-${TARGET_IP}:${TARGET_PORT}-iscsi-${TARGET_NAME}-lun-1"

View File

@ -0,0 +1,161 @@
diff --git a/Makefile b/Makefile
index c5d9700..4dbff18 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ mandir = $(prefix)/share/man
etcdir = /etc
initddir = $(etcdir)/init.d
-MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8
-PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname
+MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 doc/iscsistart.8 doc/iscsi-iname.8
+PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname usr/iscsistart
INSTALL = install
ETCFILES = etc/iscsid.conf
IFACEFILES = etc/iface.example
@@ -84,11 +84,11 @@ install_programs: $(PROGRAMS)
# ugh, auto-detection is evil
# Gentoo maintains their own init.d stuff
install_initd:
- if [ -f /etc/debian_version ]; then \
+ if [ -f $(DESTDIR)$(etcdir)/debian_version ]; then \
$(MAKE) install_initd_debian ; \
- elif [ -f /etc/redhat-release ]; then \
+ elif [ -f $(DESTDIR)$(etcdir)/redhat-release ]; then \
$(MAKE) install_initd_redhat ; \
- elif [ -f /etc/SuSE-release ]; then \
+ elif [ -f $(DESTDIR)$(etcdir)/SuSE-release ]; then \
$(MAKE) install_initd_suse ; \
fi
@@ -115,7 +115,7 @@ install_iface: $(IFACEFILES)
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces
install_etc: $(ETCFILES)
- if [ ! -f /etc/iscsi/iscsid.conf ]; then \
+ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/iscsid.conf ]; then \
$(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \
fi
@@ -128,11 +128,11 @@ install_kernel:
$(MAKE) -C kernel install_kernel
install_iname:
- if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then \
- echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \
+ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi ]; then \
+ echo "InitiatorName=`$(DESTDIR)$(sbindir)/iscsi-iname`" > $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi ; \
echo "***************************************************" ; \
- echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \
- echo "To override edit /etc/iscsi/initiatorname.iscsi" ; \
+ echo "Setting InitiatorName to `cat $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi`" ; \
+ echo "To override edit $(etcdir)/iscsi/initiatorname.iscsi" ; \
echo "***************************************************" ; \
fi
diff --git a/usr/Makefile b/usr/Makefile
index 673b7f1..83507f3 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -54,18 +54,18 @@ all: $(PROGRAMS)
iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \
iscsid.o session_mgmt.o discoveryd.o
- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns
iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o
- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
iscsistart.o statics.o
- $(CC) $(CFLAGS) -static $^ -o $@
+ $(CC) $(CFLAGS) -static $(LDFLAGS) $^ -o $@
clean:
- rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
+ $(RM) *.o $(PROGRAMS) .depend $(LIBSYS)
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend
diff --git a/utils/Makefile b/utils/Makefile
index 2c7e891..62c49fa 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -1,17 +1,18 @@
# This Makefile will work only with GNU make.
-CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
+OPTFLAGS ?= -O2 -g
+CFLAGS += $(OPTFLAGS) -fno-inline -Wall -Wstrict-prototypes
PROGRAMS = iscsi-iname
all: $(PROGRAMS)
iscsi-iname: md5.o iscsi-iname.o
- $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@
clean:
- rm -f *.o $(PROGRAMS) .depend
+ $(RM) *.o $(PROGRAMS) .depend
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(GCC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend
diff --git a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile
index c72bb7f..a36c2d2 100644
--- a/utils/fwparam_ibft/Makefile
+++ b/utils/fwparam_ibft/Makefile
@@ -26,18 +26,18 @@ OBJS := fw_entry.o fwparam_sysfs.o $(SYSDEPS_OBJS) ../../usr/iscsi_net_util.o
OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o
CLEANFILES = $(OBJS) *.output *~
-OPTFLAGS ?= -O2 -g -fPIC
+OPTFLAGS ?= -O2 -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
-CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../../include -I../../usr -D_GNU_SOURCE
+CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fPIC -I../../include -I../../usr -D_GNU_SOURCE
all: $(OBJS)
clean:
- rm -f *.o $(CLEANFILES) .depend
+ $(RM) *.o $(CLEANFILES) .depend
$(OBJS): prom_parse.tab.h prom_parse.h fwparam_ibft.h
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend
diff --git a/utils/sysdeps/Makefile b/utils/sysdeps/Makefile
index 53c10e5..19cfe19 100644
--- a/utils/sysdeps/Makefile
+++ b/utils/sysdeps/Makefile
@@ -1,15 +1,16 @@
# This Makefile will work only with GNU make.
-CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
+OPTFLAGS ?= -O2 -g
+CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fno-inline -Wall -Wstrict-prototypes
SYSDEPS_OBJS=sysdeps.o
all: $(SYSDEPS_OBJS)
clean:
- rm -f *.o .depend
+ $(RM) *.o .depend
depend:
- gcc $(CFLAGS) -M `ls *.c` > .depend
+ $(CC) $(CFLAGS) -M `ls *.c` > .depend
-include .depend

View File

@ -0,0 +1,42 @@
From d5629f76e1775550692be0d94c8e7f82a96f657d Mon Sep 17 00:00:00 2001
From: Nick Owens <mischief@offblast.org>
Date: Thu, 17 Sep 2015 15:27:14 -0700
Subject: [PATCH] remove kernel version check
---
usr/Makefile | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/usr/Makefile b/usr/Makefile
index 5ac0726..9c436df 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -2,24 +2,8 @@
OSNAME=$(shell uname -s)
-# allow users to override these
-# eg to compile for a kernel that you aren't currently running
-KERNELRELEASE ?= $(shell uname -r)
-KSRC ?= /lib/modules/$(KERNELRELEASE)/build
-
-KSUBLEVEL=$(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
- sed 's/^[ \t]*//;s/[ \t]*$$//')
-
ifeq ($(OSNAME),Linux)
- ifeq ($(KSUBLEVEL),11)
- IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
- else
- ifeq ($(KSUBLEVEL),12)
- IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
- else
- IPC_CFLAGS=-DNETLINK_ISCSI=8 -D_GNU_SOURCE
- endif
- endif
+IPC_CFLAGS=-DNETLINK_ISCSI=8 -D_GNU_SOURCE
IPC_OBJ=netlink.o
else
ifeq ($(OSNAME),FreeBSD)
--
2.4.6

View File

@ -0,0 +1,2 @@
d /var/db/iscsi 0700 root root - -

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>base-system</herd>
</pkgmetadata>

View File

@ -0,0 +1,92 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
inherit versionator linux-info eutils flag-o-matic toolchain-funcs
MY_PV="${PN}-$(replace_version_separator 2 "-" $MY_PV)"
DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
HOMEPAGE="http://www.open-iscsi.org/"
SRC_URI="http://www.open-iscsi.org/bits/${MY_PV}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc x86"
IUSE="debug slp"
DEPEND="slp? ( net-libs/openslp )"
RDEPEND="${DEPEND}
virtual/udev
sys-fs/lsscsi
sys-apps/util-linux"
S="${WORKDIR}/${MY_PV}"
pkg_setup() {
linux-info_pkg_setup
if kernel_is -lt 2 6 16; then
ewarn "Sorry, your kernel must be 2.6.16-rc5 or newer!"
fi
# Needs to be done, as iscsid currently only starts, when having the iSCSI
# support loaded as module. Kernel builtion options don't work. See this for
# more information:
# https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
# If there's a new release, check whether this is still valid!
CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
if linux_config_exists; then
for module in ${CONFIG_CHECK_MODULES}; do
linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
done
fi
}
src_prepare() {
epatch "${FILESDIR}"/${P}-Makefiles.patch
epatch "${FILESDIR}"/${P}-remove-kernel-version-check.patch
sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
}
src_configure() {
cd utils/open-isns || die
# SSL (--with-security) is broken
econf $(use_with slp) \
--without-security
}
src_compile() {
use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
CFLAGS="" \
emake \
OPTFLAGS="${CFLAGS}" \
AR="$(tc-getAR)" CC="$(tc-getCC)" \
user
}
src_install() {
emake DESTDIR="${D}" sbindir="usr/sbin/" install
dodoc README THANKS
docinto test/
dodoc test/*
# udev pieces
insinto /usr/lib/udev/rules.d
doins "${FILESDIR}"/99-iscsi.rules
insopts -m0755
insinto /usr/lib/udev/scripts
doins "${FILESDIR}"/iscsidev.sh
insopts -m0644
systemd_dotmpfilesd "${FILESDIR}"/open-iscsi.conf
fperms 600 /etc/iscsi/iscsid.conf
}