iSCSI (pyTarget)

pyTarget is a Windows iSCSI Target with a GPLv2 licence. The project homepage (here) states that pyTarget can be used to "...Implement a powerful iSCSI target in python, easily use under most popular systems. It also includes the following features: multi-target, multi-connect/session support chap authentication support header & data digest support erl =2..."

A standalone binary is available for Windows 32-bit - this version does not require that the python environment be installed on the Target system. The pyTarget executable is a console application and can be configured from a web interface. Alternatively the pytarget configuration file can be manually edited.

A third party GUI is being developed by Erwan and is available for download here. The pyTarget GUI is in active development at the time of writing. Screenshots in this page are from version 0.3 - screenshots in this page may not reflect the GUI in any newer version(s).

A Discussion topic on reboot.pro may cover additional settings not discussed in this guide - see here.

pyTarget documentation is limited. A .pdf document is included in the download package and a .txt document is available here. This page covers creating a basic Target using either the configuration file or the GUI.

This page contains the following sections -

Supported Disk Images

pyTarget supports fixed type disks including RAW files and Virtual Hard Disks (VHD). pyTarget does not support EXPANDABLE type VHD files, however it does support SPARSE type disk images\files.

An existing disk image can be specified in the configuration file. The disk capacity will also need to be specified - 1 x unit = 512 bytes. The following may be useful in calculating disk image capacity -

If a disk specified in the configuration file does not exist, the pyTarget executable will create a RAW file of the size specified in the capacity= field in config.xml.

GUI

Running the GUI will parse data from any existing configuration file (config.xml). Any settings changed in the GUI will be written to the configuration file and will start the pyTarget executable when the Start button is selected. The pyTarget executable will be hidden, however any output will be displaying in the GUI. Starting the GUI without an existing configuration file will display settings similar to the following (GUI version 0.3 - released on 6th February 2017) -

Working from the top to the bottom (and left to right), the fields in the GUI displayed in the image above -

Any changes made in the GUI will be written to the configuration file when the Start button is pressed.

Configuration File

A configuration file config.xml is included in the pyTarget download, however I recommend that you use the GUI to create a configuration file or compile your own.

The following entries can be used as the header for config.xml

Now add a Target -

Where

Now add a Host for authentication purposes. Connections to this Target will be refused from any Client/Host not specified -

Now specify/add a disk image -

Where

And now add a second disk image -

Observe that the LUN ID has been changed (id=1), type is still 0 for a disk (type="0"), path is for a different disk image (path="D:\iSCSI_target2.ima") and the disk capacity is 10 GiB (capacity="20971520").

Resulting config.ini file with XML closing tags added for all elements -

NOTE - Multiple Targets can be specified in the Configuration file - this is not (yet?) possible in the GUI.

iSCSI Negotiation Parameters

NOTE - It is not (yet?) possible to set negotiation parameters in the GUI.

iSCSI Negotiation Parameters for individual Targets can be set in the pyTarget configuration file. Supported parameters are -

NOTE - the above negotiation parameters are the default values used for each Target. The configuration file can be used to change the default values.

Sample config.xml including negotiation parameters -

Error Messages

pyTarget documentation is limited and the error messages appear obscure at times.

An error message similar to the following may indicate that another application is listening on port 80 (used by web servers) -

An error message similar to the following may indicate that another application is listening on port 3260 - the default iSCSI port. This may indicate another iSCSI Target is running (including a hidden pyTarget.exe launched from the GUI) -

Client/Host Connections

As stated elsewhere in this page, connections from Client/Host systems will require authentication. Assuming that the Client/Host identifier was set as iqn.client, add the following command to your iPXE script -

E.g. -

Installing Windows 7 to iSCSI Target

Installing Windows 7 is unusually slow when installing to a pyTarget iSCSI Target. This is covered here.

In tests it took several hours to install Windows 7 when using pyTarget - via a Gigabit Ethernet connection. It is possible that changing the Negotiation parameters may increase the installation speed.

Document date - 28th February 2017(DRAFT)