aboutsummaryrefslogtreecommitdiff
path: root/net/tgt/files
diff options
context:
space:
mode:
authorMaxim Storchak <m.storchak@gmail.com>2019-05-06 15:45:19 +0300
committerMaxim Storchak <m.storchak@gmail.com>2019-05-06 20:08:39 +0300
commite8248bd86e74a16f06f01530770da56cb171b3b3 (patch)
tree15dc86207c55723e0f134d5877567ff3e6cf3b75 /net/tgt/files
parent1ccfdcc5b573f4a09af6804ced9d7c1831697d2c (diff)
tgt: update to 1.0.77
- update to 1.0.77 - apply patches from Rosen Penev for compatibility with uClibc-ng - add an option for rotation_rate selection Signed-off-by: Maxim Storchak <m.storchak@gmail.com>
Diffstat (limited to 'net/tgt/files')
-rw-r--r--net/tgt/files/tgt.config2
-rwxr-xr-xnet/tgt/files/tgt.init33
2 files changed, 19 insertions, 16 deletions
diff --git a/net/tgt/files/tgt.config b/net/tgt/files/tgt.config
index de5239d36..e226f6586 100644
--- a/net/tgt/files/tgt.config
+++ b/net/tgt/files/tgt.config
@@ -44,6 +44,8 @@ config target 1
# option 'removable' '0'
# 0 = Classic sense format, 1 = Support descriptor format.
# option 'sense_format' '0'
+# Rotaion rate: 0: not reported, 1: non-rotational medium (SSD), 2-1024: reserverd, 1025+: "Nominal rotation rate"
+# option 'rotation_rate' '0'
#config lun 2_1
# option device /mnt/iscsi.img
diff --git a/net/tgt/files/tgt.init b/net/tgt/files/tgt.init
index b627d5dbd..c10057d65 100755
--- a/net/tgt/files/tgt.init
+++ b/net/tgt/files/tgt.init
@@ -28,7 +28,8 @@ validate_lun_section() {
'scsi_id:string' \
'scsi_sn:string' \
'sense_format:range(0, 1)' \
- 'vendor_id:string'
+ 'vendor_id:string' \
+ 'rotation_rate:uinteger'
}
handle_lun() {
@@ -36,7 +37,7 @@ handle_lun() {
local my_tgtid=${tgt_lun%_*}
local lun=${tgt_lun#*_}
- [ $my_tgtid -eq $tgtid ] || return 0
+ [ "$my_tgtid" -eq "$tgtid" ] || return 0
[ "$2" = 0 ] || {
$logger "Validation failed for LUN $tgt_lun"
@@ -47,22 +48,22 @@ handle_lun() {
return 1
}
- if [ $sync -ne 0 -o $direct -ne 0 ]; then
+ if [ "$sync" -ne 0 ] || [ "$direct" -ne 0 ]; then
local bsoflags
- [ $sync -ne 0 ] && bsoflags="sync"
- [ $direct -ne 0 ] && bsoflags="direct"
- [ $sync -ne 0 -a $direct -ne 0 ] && bsoflags="sync:direct"
+ [ "$sync" -ne 0 ] && bsoflags="sync"
+ [ "$direct" -ne 0 ] && bsoflags="direct"
+ [ "$sync" -ne 0 ] && [ "$direct" -ne 0 ] && bsoflags="sync:direct"
bsoflags="--bsoflags $bsoflags"
fi
blocksize=${blocksize+--blocksize=$blocksize}
local params='' i
- for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id; do
+ for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id rotation_rate; do
eval params=\${$i+$i=\$$i,}\$params
done
local _tgtadm="$tgtadm --mode logicalunit --tid $tgtid --lun $lun"
- $_tgtadm --op new --backing-store $device --device-type $type --bstype $bstype $bsoflags $blocksize || {
+ $_tgtadm --op new --backing-store "$device" --device-type "$type" --bstype "$bstype" $bsoflags $blocksize || {
$logger "Failed to create lun $tgt_lun"
return 1
}
@@ -117,7 +118,7 @@ bind_account_to_target() {
local t
for t in $target; do
[ "$t" -eq "$tgtid" ] && {
- $_tgtadm --op bind --tid $tgtid --user "$user" $outgoing || {
+ $_tgtadm --op bind --tid "$tgtid" --user "$user" $outgoing || {
$logger "Failed to bind user $username to target $tgtid"
return 1
}
@@ -137,24 +138,24 @@ handle_target() {
local tgtid=$1
local _tgtadm="$tgtadm --mode target"
- [ $tgtid -ge 0 ] || return 1
+ [ "$tgtid" -ge 0 ] || return 1
[ "$2" = 0 ] || {
$logger "Validation failed for target $tgtid"
return 1
}
- $_tgtadm --op new --tid $tgtid --targetname $name || {
+ $_tgtadm --op new --tid "$tgtid" --targetname "$name" || {
$logger "Failed to create target $tgtid"
return 1
}
local i
for i in $allow_address; do
- $_tgtadm --op bind --tid $tgtid --initiator-address $i || {
+ $_tgtadm --op bind --tid "$tgtid" --initiator-address "$i" || {
$logger "Failed to set allow $i to connect to target $tgtid"
return 1
}
done
for i in $allow_name; do
- $_tgtadm --op bind --tid $tgtid --initiator-name $i || {
+ $_tgtadm --op bind --tid "$tgtid" --initiator-name "$i" || {
$logger "Failed to set allow $i to connect to target $tgtid"
return 1
}
@@ -193,7 +194,7 @@ start_tgt_instance() {
}
procd_open_instance
procd_set_param command $PROG -f
- [ "$iothreads" ] && procd_append_param command -t $iothreads
+ [ "$iothreads" ] && procd_append_param command -t "$iothreads"
[ "$portal$nop_interval$nop_count" ] && {
local iscsi="" i
for i in nop_interval nop_count; do
@@ -202,11 +203,11 @@ start_tgt_instance() {
for i in $portal; do
iscsi="portal=$i,$iscsi"
done
- procd_append_param command --iscsi $iscsi
+ procd_append_param command --iscsi "$iscsi"
}
procd_set_param respawn
procd_close_instance
- logger -p daemon.info -t $NAME -s "Configuration will be loaded in seconds"
+ logger -p daemon.info -t "$NAME" -s "Configuration will be loaded in seconds"
( sleep 5; configure || { stop_service; exit 1; } ) &
}