From: Mike Christie <michaelc@xxxxxxxxxxx> targets.onf/tgt-admin does not support the readonly feature. To set this with tgtadm you can run: tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 \ --params readonly=1 This patch attempts to add it so you can set it in targets.conf by doing: <target iqn.2008-09.com.target> readonly 1 backing-store /storage/lun1 </target> Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx> Cc: Tomasz Chmielewski <mangoo@xxxxxxxx> --- conf/examples/targets.conf.example | 1 + scripts/tgt-admin | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/examples/targets.conf.example b/conf/examples/targets.conf.example index e6cf026..2a49976 100644 --- a/conf/examples/targets.conf.example +++ b/conf/examples/targets.conf.example @@ -135,6 +135,7 @@ default-driver iscsi #sense_format ... #removable ... #online ... + #readonly ... #path ... #mode_page 8:0:18:0x10:0:0xff.... #mode_page 8:0:18:0x10:0:0xff.... diff --git a/scripts/tgt-admin b/scripts/tgt-admin index 746186a..2c69e8b 100755 --- a/scripts/tgt-admin +++ b/scripts/tgt-admin @@ -406,7 +406,7 @@ sub add_params { if ($param eq "scsi_id" || $param eq "scsi_sn" || $param eq "vendor_id" || $param eq "product_id" || $param eq "product_rev" || $param eq "sense_format" || $param eq "removable" || $param eq "online" || - $param eq "path" || $param eq "mode_page") { + $param eq "path" || $param eq "mode_page" || $param eq "readonly") { return("tgtadm -C $control_port --lld $driver --op update --mode logicalunit --tid $next_tid --lun=$lun --params $param=\"$param_value\""); } if ($param eq "params") { @@ -561,7 +561,7 @@ sub add_backing_direct { } # Add these parameters if they were not overwritten in the config file - my @opts = ("scsi_id", "sense_format", "removable", "online", "path"); + my @opts = ("scsi_id", "sense_format", "removable", "online", "path", "readonly"); foreach my $single_opt (@opts) { check_if_hash_array($$target_options_ref{$single_opt},$single_opt); if ($params_added{$single_opt} ne 1 && length $$target_options_ref{$single_opt}) { -- 1.7.2.3 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html