Bugzilla – Attachment 48306 Details for
Bug 114382
unh_iscsi_target - init script device handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
Patch proposal for LV block devices
unh_iscsi_target.dif (text/plain), 2.96 KB, created by
Marius Tomaschewski
on 2005-08-31 12:18:24 UTC
(
hide
)
Description:
Patch proposal for LV block devices
Filename:
MIME Type:
Creator:
Marius Tomaschewski
Created:
2005-08-31 12:18:24 UTC
Size:
2.96 KB
patch
obsolete
>--- unh_iscsi_target 2005/08/31 00:35:22 1.1 >+++ unh_iscsi_target 2005/08/31 10:31:13 >@@ -137,26 +137,64 @@ > continue > fi > >- if [ -b "$FILENAME" ] ; then >- dev=`basename "$FILENAME"` >- part=$dev >- dev=${dev/[0-9]*/} >- [ "$part" == "$dev" ] && part="" >- sys="/sys/block/$dev/$part/size" >- BLOCKS=`cat $sys 2>&1` >> ${UNH_ISCSI_LOG} >- if [ $? -ne 0 ]; then >- unh_log "Failed to query the size of '$FILENAME' block device." >+ # resolve one symlink level if needed, e.g. for >+ # LVM: /dev/lvg/lvolume-name to /dev/mapper/name >+ if [ -L "$FILENAME" ] ; then >+ REALNAME=$(/usr/bin/readlink "$FILENAME" 2>/dev/null) >+ if [ -z "$REALNAME" ] || \ >+ [ ! -e "$REALNAME" ] || \ >+ [ -L "$REALNAME" ] ; then >+ unh_log "error in export file: invalid symlink '${FILENAME}'" > error=1 > break > fi > else >- BLOCKS=`stat --format="%s" "${FILENAME}" 2>&1` >> ${UNH_ISCSI_LOG} >+ REALNAME=$FILENAME >+ fi >+ >+ if [ -b "$REALNAME" ] ; then >+ BLOCKS="" >+ major=$(printf "%d" 0x$(stat --format="%t" "$REALNAME")) >+ minor=$(printf "%d" 0x$(stat --format="%T" "$REALNAME")) >+ case "$major" in >+ 253) # device-mapper / LVM >+ for dev in /sys/block/dm-*/dev ; do >+ [ "/sys/block/dm-*/dev" == "$dev" ] && continue >+ num=$(cat $dev 2>/dev/null) >+ if [ "$num" == "${major}:${minor}" ] ; then >+ BLOCKS=$(cat ${dev%dev}size 2>> ${UNH_ISCSI_LOG}) >+ break >+ fi >+ done >+ ;; >+ >+ *) # other (/dev/sdaX, /dev/hda, ...) >+ dev=`basename "$REALNAME"` >+ part=$dev >+ dev=${dev/[0-9]*/} >+ [ "$part" == "$dev" ] && part="" >+ sys="/sys/block/$dev/$part/size" >+ BLOCKS=`cat $sys 2>> ${UNH_ISCSI_LOG}` >+ ;; >+ esac >+ >+ if [ -z "$BLOCKS" ] && [ $(($BLOCKS)) -le 0 ]; then >+ unh_log "Failed to query the size of '$FILENAME' block device." >+ error=1 >+ break >+ fi >+ elif [ -f "$REALNAME" ] ; then >+ BLOCKS=`stat --format="%s" "${REALNAME}" 2>> ${UNH_ISCSI_LOG}` > if [ $? -ne 0 ]; then > unh_log "Failed to query size of '$FILENAME' file." > error=1 > break > fi > BLOCKS=$(( (BLOCKS+511) / 512 )) >+ else >+ unh_log "error in export file: '${FILENAME}' is not file or block device" >+ error=1 >+ break > fi > > unh_log "Exporting target: $TID $LUN $FILENAME $SCRIPT"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 114382
: 48306