iSCSI commands

Probe the SR:

xe sr-probe type=lvmoiscsi device-config:target=<device ip> device-config:targetIQN=<iqn>


Introduce the existing SR to XenServer:

xe sr-introduce uuid=<device uuid> shared=true type=lvmoiscsi name-label=<name>


Create a PBD for each host in the pool:

xe pbd-create sr-uuid=<device uuid> host-uuid=<host uuid> device-config:target=<device ip> device-config:targetIQN=<iqn> device-config:SCSIid=<scsi id>


Plug in the new PBD:

xe pbd-plug uuid=<pbd uuid>


Scan the SR:

xe sr-scan uuid=<uuid>


Discover available targets from a discovery portal:

iscsiadm -m discovery -t sendtargets -p ipaddress


Log into all targets:

iscsiadm -m node -l


Log into a specific target:

iscsiadm -m node -T targetname -p ipaddress –l


Log out of all targets:

iscsiadm -m node -u


Log out of a specific target:

iscsiadm -m node -T targetname -p ipaddress -u


Display information about a target:

iscsiadm -m node -T targetname -p ipaddress


Display statistics of a target:

iscsiadm -m node -s -T targetname -p ipaddress


Display a list of all current sessions logged in:

iscsiadm -m session


View iSCSI database regarding discovery:

iscsiadm -m discovery -o show


View iSCSI database regarding targets to log into:

iscsiadm -m node -o show


View iSCSI database regarding sessions logged into:

iscsiadm -m session -o show


Find newly created device name:

Find the newly created device name, using the iscsiadm command. In this test configuration, the new volume is /dev/sdb. At the end of the output you could see attached scsi disk name.

iscsiadm -m session -P3


Rescan:

When you expand the volume or disk, you might need to rescan. So the below command will help:

iscsiadm -m node -p 192.168.40.10 --rescan


Identify what is the current SCSI ID on the LUN containing your Storage Repository:

# xe sr-probe type=lvmoiscsi device-config:target=<Target IP> device-config:targetIQN=<Target IQN>

Example:

# xe sr-probe type=lvmoiscsi device-config:target=10.12.45.10 device-config:targetIQN=iqn.1992-08.com.netapp:sn.135027806
Error code: SR_BACKEND_FAILURE_107
Error parameters: , The SCSIid parameter is missing or incorrect, <?xml \version="1.0" ?>
<iscsi-target>
        <LUN>
                <vendor>
                        NETAPP
                </vendor>
                <serial>
                        P3LfCZIcoVML
                </serial>
                <LUNid>
                        150
                </LUNid>
                <size>
                        23622320128
                </size>
                <SCSIid>
                        360a9800050334c66435a49636f564d4c
                </SCSIid>
        </LUN>
</iscsi-target>


Identify what SCSI ID the XenServer expects to be on the LUN containing your Storage Repository by running the following commands:

Identify UUID of the SR that is unplugged:

# xe sr-list type=lvmoiscsi

Identify expected SCSI ID of the LUN containing SR that is unplugged:

# xe pbd-list sr-uuid=<SR UUID>

Example:

# xe sr-list type=lvmoiscsi
uuid ( RO)                : f6a7d8be-cd21-d9b2-1864-9c67d7ed1724
          name-label ( RW): iSCSI virtual disk storage
    name-description ( RW): iSCSI SR [10.12.45.10 (iqn.1992-08.com.netapp:sn.135027806)]
                host ( RO): xenserver-dellAMDR131
                type ( RO): lvmoiscsi
content-type ( RO):
# xe pbd-list sr-uuid=f6a7d8be-cd21-d9b2-1864-9c67d7ed1724
uuid ( RO)                  : 9cd47f3e-944d-0ea2-522c-5c7e399543ab
             host-uuid ( RO): ac3e1d25-c12e-4588-bc35-857ad1fa7e43
               sr-uuid ( RO): f6a7d8be-cd21-d9b2-1864-9c67d7ed1724
         device-config (MRO): port: 3260; target: 10.12.45.10; SCSIid:\ 360a9800050334c66435a49636f545143; targetIQN: iqn.1992-08.com.netapp:sn.135027806
    currently-attached ( RO): false

Note: This SCSI ID should match the entry under the XenCenter iSCSI SR General Tab. SCSI ID collected from steps 3 and 4 must match. If they do not your LUN SCSI ID has been changed.



Authors:
  • Jochen Schnuerle