lib/iscsi.pm

SYNOPSIS

Library for easy use of iSCSI server and client tools.

iscsi_discovery

iscsi_discovery( $target );

Runs iscsiadm -m discovery -t st -p $target in the SUT to discover iSCSI targets on the $target which could be IP address or host name.

iscsi_login

iscsi_login( $iqn, $target );

Runs iscsiadm -m node --targetname $iqn -p $target -l in the SUT to login client to the iSCSI IQN $iqn on the iSCSI server $target

iscsi_logout

iscsi_logout( $iqn, $target);

Runs iscsiadm -m node --targetname $iqn -p $target -u in the SUT to logout client from the iSCSI IQN $iqn on the iSCSI server $target

tgt_show

tgt_show();

Usable only with TGTD iSCSI server.

Runs the tgtadm --lld iscsi --op show --mode target in the SUT, to show up configured iSCSI LUNs.

tgt_new_target

tgt_new_target( $tid, $iqn );

Usable only with TGTD iSCSI server.

Runs tgtadm --lld iscsi --op new --mode target --tid $tid -T $iqn in the SUT, to add new LUN $lun from device $device to the existing TARGET with ID $tid

tgt_new_lun

tgt_new_lun( $tid, $lun, $device );

Usable only with TGTD iSCSI server.

Runs tgtadm --lld iscsi --op new --mode logicalunit --tid $tid --lun $lun -b $device in the SUT, to add new LUN $lun from device $device to the existing TARGET with ID $tid

tgt_update_lun_params

tgt_update_lun_params( $tid, $lun, $params );

Usable only with TGTD iSCSI server.

Runs tgtadm --lld iscsi --op update --mode logicalunit --tid $tid --lun $lun --params $params in the SUT, to update parameters $params of existing LUN $lun on iSCSI target ID $tid

tgt_auth_all

tgt_auth_all( $tid );

Usable only with TGTD iSCSI server.

Runs tgtadm --lld iscsi --op bind --mode target --tid $tid -I ALL in the SUT, to allow all clients to use list of targets $tid on the iSCSI server.

lio_show_all

lio_show_all();

Usable only on the LIO iSCSI server.

Runs targetcli ls in the SUT.

Returns the whole LIO iSCSI server configuration.

lio_show_target

lio_show_target();

Usable only on the LIO iSCSI server.

Runs targetcli ls iscsi in the SUT.

Returns the iSCSI targets configuration from the LIO iSCSI server.

lio_show_backstores

lio_show_backstores();

Usable only on the LIO iSCSI server.

Runs targetcli ls backstores in SUT.

Returns the list of back stores on the LIO iSCSI server.

lio_show_iqn

lio_show_iqn();

Usable only on the LIO iSCSI server.

Returns the existing targets on the LIO iSCSI server if any.

lio_target_create

lio_target_create( $tid, $iqn );

Usable only on the LIO iSCSI server.

Runs targetcli /iscsi create $iqn:$tid in the SUT.

Creates new iSCSI target on LIO iSCSI server with IQN $iqn and ID $tid.

lio_target_delete

lio_target_delete( $tid, $iqn );

Usable only on the LIO iSCSI server.

Runs targetcli /iscsi delete $iqn:$tid in the SUT.

Remove the whole iSCSI target IQN $iqn and ID $tid from LIO iSCSI server including all of it LUNs and portals and unlink back stores from it.

lio_lun_create

lio_lun_create( $tid, $iqn, $device );

Usable only on the LIO iSCSI server.

Creates new back store from the device $device (in full path) and link it to the newly created LUN on target IQN $iqn , ID $tid

lio_lun_set_attr

lio_lun_set_attr( $tid, $iqn, $attr );

Usable only on the LIO iSCSI server.

Set the attribute $attr of the LUN on the LIO iSCSI server.

lio_portal_create

lio_portal_create( $tid, $iqn, $ip, $port );

Usable only on the LIO iSCSI server.

Assign IP address $ip and port $post to the LUN network portal on iSCSI target with IQN $iqn and ID $tid

lio_portal_delete

lio_portal_delete( $tid, $iqn, $ip, $port );

Usable only on the LIO iSCSI server.

Removes the network portal on IP address $ip and port $post from the iSCSI target IQN $iqn and ID $tid

lio_auth_all

lio_auth_all( $tid, $iqn );

Usable only on the LIO iSCSI server.

Allow access from all clients to the iSCSI target IQN $iqn with ID $tid

lio_global_get

lio_global_get( $global_pref );

Usable only on the LIO iSCSI server.

Returns the value of the global preference global_pref in LIO iSCSI server.

lio_global_set

lio_global_set( $global_pref, $gp_value );

Usable only on the LIO iSCSI server.

Set the global preference $global_pref to the value $gp_value in LIO iSCSI server.