EzDevInfo.com

iscsi interview questions

Top iscsi frequently asked interview questions

Role of iscsi offload driver (bnx2i)

I am using open-iscsi initiator and using bnx2i (broadcom offload driver)

However, there are many related drivers - bnx2, bnx2x and cnic drivers available.

Suppose that I want to perform discovery/login from the initiator using offload driver; In this case I prepare the iface configuration file for bnx2i and specify it while performing discovery. In this case bnx2i module is used instead of tcp.

Now I am getting confused about the role of other drivers - bnx2, bnx2x and cnic drivers. Are these drivers necessary for supporting bnx2i? Can someone elaborate on the data flow and dependency when using initiator and bnx2i?


Source: (StackOverflow)

ISCSI multiple connections using the same initiator IQN

Is it possible for multiple computers to connect to the same target at the same time, using the same initiator IQN?

Thank you.


Source: (StackOverflow)

Advertisements

How can use regex to validate iSCSI target names?

I am trying to craft a regexp to validate iSCSI qualified names. An example of a qualified name is iqn.2011-08.com.example:storage This is example is minimal, I have seen other examples that are more extended.

So far what I have to validate off of it this:

print "Enter a new target name: ";

my $target_name = <STDIN>;

chomp $target_name;

if ($target_name =~ /^iqn\.\d{4}-\d{2}/xmi) {

    print GREEN . "Target name is valid!" . RESET . "\n";

} else {

    print RED . "Target name is not valid!" . RESET . "\n";

}

How can I extend that to work with rest up to the : I am not going to parse after the : becuase it is a description tag.

Is there a limit to how big a domain name can be?


Source: (StackOverflow)

iscsiadm: Login I/O error, failed to receive a PDU

I'm trying to discover an iscsi target and am getting the following error:

iscsiadm: Connection to Discovery Address 172.18.1.4 closed
iscsiadm: Login I/O error, failed to receive a PDU

My target config is the following:

<target iqn.2012-4.com.mylab:first >
    backing-store /dev/vgsrv/storage
    initiator-address 172.18.1.1
</target>

Here are my details:

my initiator IP : 172.18.1.4
my target IP : 172.18.1.1
kernel : Linux 2.6.32-504.el6.x86_64 
iscsid version 6.2.0-873.13.el6

Any tips why I'm facing this issue? All firewalls and ips are off.


Source: (StackOverflow)

Is it possible to get the iSCSI initiator IQN of another Linux machine?

On a local machine, I can just do

cat /etc/iscsi/initiatorname.iscsi

to get the IQN that is sent to targets when establishing an ISCSI session. What I am trying to find out is whether it is possible to establish another machine's initiator IQN without ssh'ing to it. This is because, given a set of IPs or hostnames of machines I have no control over, I need to set up targets to allow ISCSI logins from those machines only.

It doesn't seem to be possible using, e.g., iscsiadm. I'm assuming the answer is No, but I'm no expert in ISCSI, so asking anyway. If the answer is No, we'll have to deal with the problem in some other way, perhaps by requiring the initiators to be set up with IQNs from a known pool, or even that the IQN is set to the same on all those machines (I suspect there might be adverse consequences with the latter workaround, but I'm not sure).


Source: (StackOverflow)

How can I assemble a file from iSCSI blocks?

I am new to iSCSI programming. I have security camera videos written in iSCSI blocks in a SAN. I need to construct playback of the some video from those blocks. I have hard time finding any tutorial or lead to solve this issue.

Thanks in advance.


Source: (StackOverflow)

iSCSI packets understanding and what each one does

I'm studying the iSCSI protocol and now im in the phase where i used Wireshark to capture the packets to see, which packets are used to mantain the sessions active, and when i copy a file to my logical volume, which packets are traded. Below is an image of that. I would appreciate help on enter image description heretrying to understand or pointing me to any website that explains it.


Source: (StackOverflow)

ISCSI Ubuntu different Portal shows different content

We use an ubuntu 12.04 LTS Server as ISCSI Target, this server used three network interface cards, each is configured for a different workloads and is configured in different network. One nic is for internal traffic, the second is for drbd replication and the third on is for extern (public).

Unfortunatly the clients which consume the iscsi target server, wasnt correct configured and connect to the iscsi target server via the public interface.

If we now change in the connect-statement the portal for the internal iface with the same iqn, we see old contents inside the mountpoint. We only usw an img-file on the target-server as the lun.

if i discover from a client i get the result:

1.1.1.1:3260,1 iqn.2020-12.de.domain.iscsi:www
172.16.0.13:3260,1 iqn.2020-12.de.domain.iscsi:www
192.168.0.13:3260,1 iqn.2020-12.de.domain.iscsi:www

(IP Adresses changed for post)

the current login-statement is:

iscsiadm -m node --targetname "iqn.2020-12.de.domain.iscsi:www" --portal "1.1.1.1:3260" --login

with this, all is working fine and all folders we except to be there are inplace.

If we now try to connect via the internal portal with:

iscsiadm -m node --targetname "iqn.2020-12.de.domain.iscsi:www" --portal "172.16.0.13:3260" --login

some folders are missing. We use OCFS2 for concurrent access, this as a side note

thanks for your time


Source: (StackOverflow)

Data corruption issue in read from disk with libaio

I am facing data corruption issue when using libaio to read data from an iscsi disk.

Steps Performed:

  • Allocate buffer(1MB) using posix_memalign with 4K Allignemnt.
  • Fill the buffer with 9 before submitting io.
  • Open iscsi disk with O_DIRECT flag.
  • Submit read requests using io_submit of libaio
  • In parallel execute vfork()
  • Call io_getevents and wait for io to complete
  • Check crc of buffer retrieved in io_getevents to check data is consistent or not.

The CRC matching is failed for some offset.

The CRC check is failing for some io. Before submitting io request i am filling the buffer with a pattern say '9', and i have analyzed the corrupted buffer and observed thatsome part of data in the buffer remains unchange, i.e same 9 is there in some part of buffer. The buffer is allocated with , 4K alligned using posix_memalign().

Is some one has also faced similar issue ? If there is any known limitation will you please share with me.


Source: (StackOverflow)

Execute readlink on a remote machine

I want to extract the attached iSCSI device of a remote machine

dev_by_path="/dev/disk/by-path/ip-10.1.1.240:3260-iscsi-iqn.2013-12.com.ryussi:swift1-lun-0"

DEVICE=`ssh -i key.pem root@10.0.0.2 'bash -s' << 'ENDSSH'
basename $(readlink $dev_by_path)
ENDSSH`

It gives error:

readlink: missing operand
Try `readlink --help' for more information.
basename: missing operand
Try `basename --help' for more information

However if I do

DEVICE=`ssh -i key.pem root@10.0.0.2 'bash -s' << 'ENDSSH'
basename $(readlink "/dev/disk/by-path/ip-10.1.1.240:3260-iscsi-iqn.2013-12.com.ryussi:swift1-lun-0")
ENDSSH`

then it executes successfully and echo $DEVICE gives sda. How should I execute this.


Source: (StackOverflow)

Connected Clients information on iscsi target server

I have created iscsi targets in ubuntu 14.04 using targetcli, is there any way to know the details of who has connected to the targets(like ip, connectection status)


Source: (StackOverflow)

Get iscsi mapped drive letter from iscsi initiator name

In PowerShell I'm trying to get the drive letter that an ISCSI target is mapped to. I'm using the following to get the ISCSI initiator name.

Get-IscsiTarget | ? {$_.IsConnected -eq $True} | Select -ExpandProperty NodeAddress

I have tried using Get-Disk | Select * and Get-PSDrive | Select * but these cmdlets do not seem to have any fields that I can link a target to, to obtain its drive letter.


Source: (StackOverflow)

TargetServer state at jSCSI

I am starting a TargetServer of jSCSI (http://jscsi.org/bundles/target/apidocs/org/jscsi/target/TargetServer.html) and I want to know how to check if it is initiated successfuly, than I can proceed doing other things.

Does anyone know how to check it?

Thanks a lot!


Source: (StackOverflow)

accesing WMI information from python

I have this small PS script which outputs a list of ip adresses and their respective ID's for the iSCSI initiator. Now I want to do some more extensive stuff with this information and since I don't really know PS and the way it works I would like to migrate the script to python and continue from there.

Now the PS script obtains these via the WMI. Here it is:

function Get-IscsiPortNumber {
    $PortalSummary = @()
    $portalInfo = get-wmiobject -namespace root\wmi -class msiscsi_portalinfoclass
    $eScriptBlock ={([Net.IPAddress]$_.ipaddr.IPV4Address).IPAddressToString}
    $customLabel = @{Label="IpAddress"; expression = $eScriptBlock}
    foreach ($portal in $portalInfo) {
        foreach ($p in ($portal.portalinformation)) {
            $CurrentPort = New-Object PsObject -Property @{ `
                NetID     = $p.port;`
                IP       = ([net.ipaddress]$p.ipaddr.IpV4Address).IPAddressToString `
            } 
            $PortalSummary += $CurrentPort
        }
    }
    return $PortalSummary
}

Get-IscsiPortNumber | ft -AutoSize

in python I started to do something like this but I always get errors while running it:

import wmi
test = wmi.WMI(namespace='root\wmi',moniker='msiscsi_portalinfoclass')

which say:

Traceback (most recent call last):
  File "C:\Users\rg\Desktop\diskchecktptest\getnicids.py", line 2, in <module>
    test = wmi.WMI(namespace='root\wmi',moniker='msiscsi_portalinfoclass')
  File "C:\Python27\lib\site-packages\wmi.py", line 1290, in connect
    handle_com_error ()
  File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
    raise klass (com_error=err)
wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147217406, 'OLE error 0x80041002', No
ne, None)>

I hope somebody with some knowledge on this subject can enlighten me


Source: (StackOverflow)

Iscsi Chap for discovery, mutual for targets will not connect.

OK I have a lab setup, I have a Freenas server iscsi setup with Chap setup for discovery and mutual chap for targets.

Here are the requirements: Implement CHAP security One-way CHAP for discovery Two-way (Mutual) CHAP for targets

I can connect and discover sucessfully with two esxi servers, windows 7, windows 2003, 2008, and 2012

Centos can see the discovery list, but when trying to connect with :

 iscsiadm --mode node --targetname iqn.2015.lab.com:centos --portal 192.168.1.60:3260 --login

the terminal outputs:

no records found

Here is my iscsid.conf, I left the comments in on the Chap section, but removed it for the rest as it is just so large:

    iscsid.startup = /etc/rc.d/init.d/iscsid force-start
    node.startup = automatic
    node.leading_login = No

    # *************
    # CHAP Settings
    # *************

    # To enable CHAP authentication set node.session.auth.authmethod
    # to CHAP. The default is None.
    node.session.auth.authmethod = CHAP

    # To set a CHAP username and password for initiator
    # authentication by the target(s), uncomment the following lines:
    #node.session.auth.username = group7
    #node.session.auth.password = passwordpassword

    # To set a CHAP username and password for target(s)
    # authentication by the initiator, uncomment the following lines:
    node.session.auth.username_in = group7
    node.session.auth.password_in = passwordpassword

    # To enable CHAP authentication for a discovery session to the target
    # set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
    discovery.sendtargets.auth.authmethod = CHAP

    # To set a discovery session CHAP username and password for the initiator
    # authentication by the target(s), uncomment the following lines:
    discovery.sendtargets.auth.username = group7
    discovery.sendtargets.auth.password = passwordpassword

    # To set a discovery session CHAP username and password for target(s)
    # authentication by the initiator, uncomment the following lines:
    #discovery.sendtargets.auth.username_in = group7
    #discovery.sendtargets.auth.password_in = passwordpassword


    node.session.timeo.replacement_timeout = 120
    node.conn[0].timeo.login_timeout = 15
    node.conn[0].timeo.logout_timeout = 15
    node.conn[0].timeo.noop_out_interval = 5
    node.conn[0].timeo.noop_out_timeout = 5
    node.session.err_timeo.abort_timeout = 15
    node.session.err_timeo.lu_reset_timeout = 30
    node.session.err_timeo.tgt_reset_timeout = 30
    node.session.initial_login_retry_max = 8
    node.session.cmds_max = 128
    node.session.queue_depth = 32
    node.session.xmit_thread_priority = -20
    node.session.iscsi.InitialR2T = No
    node.session.iscsi.ImmediateData = Yes
    node.session.iscsi.FirstBurstLength = 262144
    node.session.iscsi.MaxBurstLength = 16776192
    node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144
    node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
    node.conn[0].iscsi.HeaderDigest = None
    node.session.nr_sessions = 1
    node.session.iscsi.FastAbort = Yes

Any help is appreciated. Thank you.


Source: (StackOverflow)