forked from pool/open-iscsi
Accepting request 159644 from network
This brings us up to date with openSUSE 12.2: - Add open-iscsi-support-non-root-boot-volume.patch: handle non- root boot-time iscsi volumes (bnc#630434) - Add open-iscsi-fix-sysfs-get-value-null.patch: accept "(null)" password as meaning no password, when using sysfs (bnc#766300) (forwarded request 148154 from namtrac) OBS-URL: https://build.opensuse.org/request/show/159644 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/open-iscsi?expand=0&rev=30
This commit is contained in:
commit
9a9bf7bf06
37
open-iscsi-fix-sysfs-get-value-null.patch
Normal file
37
open-iscsi-fix-sysfs-get-value-null.patch
Normal file
@ -0,0 +1,37 @@
|
||||
Handle nulls from sysfs, for recent kernels.
|
||||
|
||||
Sysfs in recent kernels returns "(null)" instead of "<NULL>",
|
||||
handle that. Such "(null)" strings from sysfs as mapped to
|
||||
NULL values.
|
||||
|
||||
Lack of this check, caused a non-existant password to be read as
|
||||
"(null)" and treated as a valid and present password, and so,
|
||||
AuthMethod=CHAP was used for a relogin.
|
||||
|
||||
References: bnc #683249,656119, bnc#766300
|
||||
---
|
||||
usr/iscsi_sysfs.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: b/usr/iscsi_sysfs.c
|
||||
===================================================================
|
||||
--- a/usr/iscsi_sysfs.c
|
||||
+++ b/usr/iscsi_sysfs.c
|
||||
@@ -43,7 +43,6 @@
|
||||
#define ISCSI_SESSION_DIR "/sys/class/iscsi_session"
|
||||
#define ISCSI_HOST_DIR "/sys/class/iscsi_host"
|
||||
|
||||
-#define ISCSI_SYSFS_INVALID_VALUE "<NULL>"
|
||||
#define ISCSI_SESSION_SUBSYS "iscsi_session"
|
||||
#define ISCSI_CONN_SUBSYS "iscsi_connection"
|
||||
#define ISCSI_HOST_SUBSYS "iscsi_host"
|
||||
@@ -87,7 +86,8 @@ static int iscsi_sysfs_get_param(char *i
|
||||
return EIO;
|
||||
}
|
||||
|
||||
- if (!strncmp(sysfs_value, ISCSI_SYSFS_INVALID_VALUE, 6))
|
||||
+ if (!strncmp(sysfs_value, "<NULL>", 6) ||
|
||||
+ !strncmp(sysfs_value, "(null)", 6))
|
||||
return ENODATA;
|
||||
|
||||
sscanf(sysfs_value, format, ret_value);
|
250
open-iscsi-support-non-root-boot-volume.patch
Normal file
250
open-iscsi-support-non-root-boot-volume.patch
Normal file
@ -0,0 +1,250 @@
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Subject: [PATCH] support non-root boot-time volumes
|
||||
|
||||
Support SUSE non-root boot-time volumes.
|
||||
|
||||
---
|
||||
diff -Narup open-iscsi-2.0-870-rc1.orig/etc/initd/boot.suse open-iscsi-2.0-870-rc1/etc/initd/boot.suse
|
||||
--- open-iscsi-2.0-870-rc1.orig/etc/initd/boot.suse 2013-01-08 15:11:27.694140109 -0800
|
||||
+++ open-iscsi-2.0-870-rc1/etc/initd/boot.suse 2013-01-08 15:53:57.486120236 -0800
|
||||
@@ -31,13 +31,17 @@ ARGS="-c $CONFIG_FILE"
|
||||
#
|
||||
iscsi_mark_root_nodes()
|
||||
{
|
||||
+ echo -n "Marking iSCSI targets needed at boot time: "
|
||||
+ rc_failed 5
|
||||
$ISCSIADM -m session 2> /dev/null | while read t num i target ; do
|
||||
ip=${i%%:*}
|
||||
STARTUP=`$ISCSIADM -m node -p $ip -T $target 2> /dev/null | grep "node.conn\[0\].startup" | cut -d' ' -f3`
|
||||
if [ "$STARTUP" -a "$STARTUP" != "onboot" ] ; then
|
||||
$ISCSIADM -m node -p $ip -T $target -o update -n node.conn[0].startup -v onboot
|
||||
+ rc_failed 0
|
||||
fi
|
||||
done
|
||||
+ rc_status -v
|
||||
}
|
||||
|
||||
# Reset status of this service
|
||||
@@ -51,9 +55,11 @@ fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
- echo -n "Starting iSCSI initiator for the root device: "
|
||||
- startproc $DAEMON $ARGS
|
||||
- rc_status -v
|
||||
+ if ! checkproc $DAEMON ; then
|
||||
+ echo -n "Starting iSCSI initiator for the root device: "
|
||||
+ startproc $DAEMON $ARGS
|
||||
+ rc_status -v
|
||||
+ fi
|
||||
iscsi_mark_root_nodes
|
||||
;;
|
||||
stop|restart|reload)
|
||||
diff -Narup open-iscsi-2.0-870-rc1.orig/etc/initd/initd.suse open-iscsi-2.0-870-rc1/etc/initd/initd.suse
|
||||
--- open-iscsi-2.0-870-rc1.orig/etc/initd/initd.suse 2013-01-08 15:11:27.694140109 -0800
|
||||
+++ open-iscsi-2.0-870-rc1/etc/initd/initd.suse 2013-01-09 14:56:25.263995190 -0800
|
||||
@@ -60,7 +60,7 @@ iscsi_umount_all_luns()
|
||||
{
|
||||
local d m dev p s
|
||||
|
||||
- cat /proc/mounts | sed -ne '/^\/dev\/.*/p' | while read d m t o x; do
|
||||
+ sed -ne '/^\/dev\/.*/p' /proc/mounts | while read d m t o x; do
|
||||
if [ "$m" = "/" ] ; then
|
||||
continue;
|
||||
fi
|
||||
@@ -93,6 +93,7 @@ iscsi_list_all_nodes()
|
||||
{
|
||||
# Check for active sessions
|
||||
if $ISCSIADM -m session > /dev/null; then
|
||||
+ echo "No active connections."
|
||||
return 0
|
||||
fi
|
||||
echo "Active connections:"
|
||||
diff -Narup open-iscsi-2.0-870-rc1.orig/etc/mkinitrd/mkinitrd-setup.sh open-iscsi-2.0-870-rc1/etc/mkinitrd/mkinitrd-setup.sh
|
||||
--- open-iscsi-2.0-870-rc1.orig/etc/mkinitrd/mkinitrd-setup.sh 2013-01-08 15:11:27.670139620 -0800
|
||||
+++ open-iscsi-2.0-870-rc1/etc/mkinitrd/mkinitrd-setup.sh 2013-01-09 14:36:49.394294388 -0800
|
||||
@@ -2,69 +2,138 @@
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
-check_iscsi_root() {
|
||||
- local devname=$1
|
||||
- local sysfs_path
|
||||
-
|
||||
- sysfs_path=$(/sbin/udevadm info -q path -n $devname 2> /dev/null)
|
||||
- if [ -z "$sysfs_path" ] || [ ! -d /sys$sysfs_path ] ; then
|
||||
- return;
|
||||
+function verify_path()
|
||||
+{
|
||||
+ local devname="$1" path="$2"
|
||||
+
|
||||
+ if [[ ! -d "${path}" ]] ; then
|
||||
+ if [[ "${path}" =~ .+\ .+ ]] ; then
|
||||
+ error 2 "iSCSI device ${devname} is connected to more than one iSCSI target!"
|
||||
+ # not reached
|
||||
+ else
|
||||
+ # does not seem to be an iSCSI attached device
|
||||
+ return 1
|
||||
+
|
||||
+ fi
|
||||
fi
|
||||
+ return 0
|
||||
+}
|
||||
|
||||
- pushd /sys$sysfs_path > /dev/null
|
||||
- if [ ! -d device ] ; then
|
||||
- cd ..
|
||||
+function check_iscsi()
|
||||
+{
|
||||
+ local devname="$1" retval=1
|
||||
+ local sysfs_path=$(/sbin/udevadm info -q path -n "${devname}" 2>/dev/null)
|
||||
+ local ip target startup
|
||||
+
|
||||
+ # do we have a valid device?
|
||||
+ [[ -z "${sysfs_path}" ]] && sysfs_path="/block${devname##/dev}"
|
||||
+ sysfs_path="/sys${sysfs_path}"
|
||||
+ [[ ! -d "${sysfs_path}" ]] && return 1 # no, return false
|
||||
+
|
||||
+ # Do we have a valid device link?
|
||||
+ [[ ! -d "${sysfs_path}/device" ]] && sysfs_path="${sysfs_path%/*}"
|
||||
+ [[ ! -d "${sysfs_path}/device" ]] && return 1 # no, return false
|
||||
+
|
||||
+ # Is device an iSCSI device?
|
||||
+ sysfs_path="${sysfs_path}/device/../.."
|
||||
+
|
||||
+ ip="$(echo ${sysfs_path}/connection*)"
|
||||
+ verify_path "${devname}" "${ip}" || return 1 # no, return false
|
||||
+
|
||||
+ ip="${ip}/iscsi_connection/${ip##*/}/persistent_"
|
||||
+ [[ ! -r "${ip}address" || ! -r "${ip}port" ]] &&
|
||||
+ error 2 "iSCSI device ${devname} connected to iSCSI target without any persistent_{address,port}!"
|
||||
+ ip="$(cat "${ip}address"):$(cat "${ip}port")"
|
||||
+
|
||||
+ target=$(echo ${sysfs_path}/iscsi_session/*)
|
||||
+ verify_path "${devname}" "${target}" || return 1 # no, return false
|
||||
+
|
||||
+ target="${target}/targetname"
|
||||
+ [[ ! -r "${target}" ]] &&
|
||||
+ error 2 "iSCSI device ${devname} connected to iSCSI target without any targetname!"
|
||||
+ target="$(cat ${target})"
|
||||
+
|
||||
+ # figure out whether it has been correctly configured
|
||||
+ [[ ! -x "${_iadm_}" ]] &&
|
||||
+ error 2 "iSCSI device ${devname} connected to iSCSI target, but no ${_iadm_} command available!"
|
||||
+
|
||||
+ startup="$(
|
||||
+ ${_iadm_} -m node -p "${ip}" -T "${target}" 2>/dev/null | grep 'node.conn\[0\].startup'
|
||||
+ )"
|
||||
+ startup="${startup##* }"
|
||||
+ startup="${startup%% *}"
|
||||
+ if [[ "${startup}" != "onboot" ]] ; then
|
||||
+ [[ -z "${startup}" ]] && return 1 # Oops, no parameter - not an iSCSI, return false
|
||||
+
|
||||
+ ## Either:
|
||||
+ #echo >&2 "WARNING: iSCSI device ${devname} is using 'node.conn[0].startup = ${startup}',"
|
||||
+ #echo >&2 "WARNING: setting it to 'onboot' instead."
|
||||
+ #${_iadm_} -m node -p "${ip}" -T "${target}" -o update -n 'node.conn[0].startup' -v onboot
|
||||
+
|
||||
+ ## or:
|
||||
+ echo >&2 "WARNING: iSCSI device ${devname} is using 'node.conn[0].startup = ${startup}'!"
|
||||
+ echo >&2 "WARNING: System not bootable with this setting, need to be set to 'onboot' instead, using:"
|
||||
+ echo >&2 "
|
||||
+ ${_iadm_} -m node -p '${ip}' -T '${target}' -o update -n 'node.conn[0].startup' -v onboot"
|
||||
fi
|
||||
|
||||
- if [ ! -d device ] ; then
|
||||
- # no device link; return
|
||||
- popd > /dev/null
|
||||
- return;
|
||||
- fi
|
||||
+ # attached to an iSCSI device
|
||||
+ return 0
|
||||
+}
|
||||
|
||||
- cd -P device
|
||||
- cd ../..
|
||||
|
||||
- if [ -d connection* ]; then
|
||||
- cd -P connection*
|
||||
- cid=${PWD#*connection}
|
||||
- sid=${cid%%:*}
|
||||
- if [ -d /sys/class/iscsi_session/session$sid ]; then
|
||||
- cd -P /sys/class/iscsi_session/session$sid
|
||||
- echo $(basename $PWD)
|
||||
- fi
|
||||
- fi
|
||||
- popd > /dev/null
|
||||
-}
|
||||
|
||||
-for bd in $blockdev; do
|
||||
+_iadm_="/sbin/iscsiadm"
|
||||
+
|
||||
+# Are system device(s) attached to iSCSI devices?
|
||||
+# In case they are, ensure:
|
||||
+# (1) the iSCSI gets included in "initrd", and
|
||||
+# (2) the iSCSI sessions have been configured with
|
||||
+# "node.conn[0].startup = onboot".
|
||||
+for bd in $blockdev ; do
|
||||
update_blockdev $bd
|
||||
- sid=$(check_iscsi_root $bd)
|
||||
- if [ "$sid" ]; then
|
||||
- root_iscsi=1
|
||||
- iscsi_sessions="$iscsi_sessions ${sid#session}"
|
||||
- fi
|
||||
+ check_iscsi $bd && root_iscsi=1
|
||||
done
|
||||
|
||||
+# Are any of the defined file partitions to be mounted at system boot
|
||||
+# attached to iSCSI devices? In case they are, ensure:
|
||||
+# (1) the iSCSI gets included in "initrd", and
|
||||
+# (2) the iSCSI sessions have been configured with
|
||||
+# "node.conn[0].startup = onboot".
|
||||
+for bd in $(awk '/^[[:space:]]*(\/dev\/|(LABEL|UUID)=)/ { print $1 }' /etc/fstab)
|
||||
+do
|
||||
+ bd="${bd/LABEL=//dev/disk/by-label/}"
|
||||
+ bd="${bd/UUID=//dev/disk/by-uuid/}"
|
||||
+ update_blockdev $bd
|
||||
+ check_iscsi $bd && root_iscsi=1
|
||||
+done
|
||||
+
|
||||
+# Include the iSCSI stack, when at least one active iSCSI session has
|
||||
+# been configured with "node.conn[0].startup = onboot", even if it was
|
||||
+# not used for a system device or mounted partition.
|
||||
+if [[ -x "${_iadm_}" ]] ; then
|
||||
+ for node in $(${_iadm_} -m node 2>/dev/null | sed -e 's/ /,/g') ; do
|
||||
+ [[ "$(
|
||||
+ ${_iadm_} -m node -T "${node##*,}" -p "${node%%,*}" 2>/dev/null |
|
||||
+ grep "node.conn\[0\].startup"
|
||||
+ )" =~ [[:space:]]*=[[:space:]]*onboot ]] && root_iscsi=1
|
||||
+ done
|
||||
+fi
|
||||
+
|
||||
+unset _iadm_
|
||||
+
|
||||
save_var root_iscsi
|
||||
-save_var iscsi_sessions
|
||||
|
||||
if [ "${root_iscsi}" ]; then
|
||||
- for session in $iscsi_sessions; do
|
||||
- eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname)
|
||||
- eval TargetAddress${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/address)
|
||||
- eval TargetPort${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/port)
|
||||
-
|
||||
- save_var TargetName${session}
|
||||
- save_var TargetAddress${session}
|
||||
- save_var TargetPort${session}
|
||||
- done
|
||||
# copy the iscsi configuration
|
||||
cp -rp /etc/iscsi etc/
|
||||
+
|
||||
if [ -z "$interface" ] ; then
|
||||
- interface="default"
|
||||
+ interface="default" # needed?
|
||||
fi
|
||||
+
|
||||
+ # In case target port was not defined via command line, assign default port
|
||||
+ save_var TargetPort 3260
|
||||
fi
|
||||
|
||||
-save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 11 14:25:51 PST 2013 - lduncan@suse.com
|
||||
|
||||
- Add open-iscsi-support-non-root-boot-volume.patch: handle non-
|
||||
root boot-time iscsi volumes (bnc#630434)
|
||||
- Add open-iscsi-fix-sysfs-get-value-null.patch: accept "(null)"
|
||||
password as meaning no password, when using sysfs (bnc#766300)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 27 09:25:02 UTC 2011 - aj@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package open-iscsi
|
||||
#
|
||||
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -15,22 +15,21 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
# norootforbuild
|
||||
|
||||
|
||||
Name: open-iscsi
|
||||
BuildRequires: bison db-devel flex
|
||||
BuildRequires: bison
|
||||
BuildRequires: db-devel
|
||||
BuildRequires: flex
|
||||
Url: http://www.open-iscsi.org
|
||||
License: GPL-2.0+
|
||||
Group: Productivity/Networking/Other
|
||||
PreReq: %fillup_prereq %insserv_prereq
|
||||
AutoReqProv: on
|
||||
Version: 2.0.870
|
||||
Release: 39
|
||||
Release: 0
|
||||
Provides: linux-iscsi
|
||||
Obsoletes: linux-iscsi
|
||||
%define iscsi_release 865
|
||||
Summary: Linux* Open-iSCSI Software Initiator
|
||||
License: GPL-2.0+
|
||||
Group: Productivity/Networking/Other
|
||||
Source: %{name}-2.0-870-rc1.tar.bz2
|
||||
Source11: iscsi-gen-initiatorname.sh
|
||||
Patch1: %{name}-start-target-before-initiator
|
||||
@ -63,6 +62,8 @@ Patch27: %{name}-load-ibft-before-reading-sys-firmware
|
||||
Patch28: %{name}-remove-trailing-tilde
|
||||
Patch29: open-iscsi-2.0-870-rc1-static.patch
|
||||
Patch30: %{name}-header.patch
|
||||
Patch31: %{name}-fix-sysfs-get-value-null.patch
|
||||
Patch32: %{name}-support-non-root-boot-volume.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -122,6 +123,8 @@ Authors:
|
||||
%patch28 -p1
|
||||
%patch29
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
|
||||
%build
|
||||
%{__make} OPTFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -DLOCK_DIR=\\\"/etc/iscsi\\\""
|
||||
|
Loading…
Reference in New Issue
Block a user