Skip to contentSkip to conversation

(no subject)

Qemu-devel In review Ronnie Sahlberg 3 participants 5 messages Nov 11, 2011 – Nov 12, 2011

lore
Share & tools
lore
#0 lore raw

List,

Please find a patch that adds a new section for iSCSI to qemu-doc.

This section provides much more verbose description of iSCSI and its use than the manpage and also includes a short description on how to set up a simple iSCSI target on loopback and then accessing it from QEMU.

The example on how to set up iSCSI Target uses the STGT iscsi target,
so the example would only work on a subset of linux/bsd systems.
I recognize also that this might be controversion, since why show how to
configure "xyz unrelated package" in QEMU documentation.
My intention here is to provide a howto that describes how to quickly get iSCSI target up and running and to get QEMU to use it. As a quick howto for people that are not familiar with iSCSI but still want to test it out quickly.

Learning how to set up iSCSI target can often be somewhat complex and daunting and could otherwise act as huge treshold for people that would just want to get iSCSI running and experiment with QMEU, but would otherwise not want to spend a lot of time learning about the target side of iscsi.

I think having examples like this is useful but see that it could be seen as controversial.
Feel free to remove that part of the patch if you think this does not belong in the qemu docs.

regards
ronnie sahlberg

#1 lore raw

PATCH 1/1 Documentation: Add section about iSCSI LUNS to qemu-doc

Add a new section about using iSCSI LUNs with qemu
and provide a short example on how to set up a target and access it using the built-in initiator

---
 qemu-doc.texi |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
qemu-doc.texi +53 -0
index 149e9bd..c1b293e 100644
@@ -421,6 +421,7 @@ snapshots.
 * disk_images_fat_images::    Virtual FAT disk images
 * disk_images_nbd::           NBD access
 * disk_images_sheepdog::      Sheepdog disk images
+* disk_images_iscsi::         iSCSI LUNs
 @end menu
 
 @node disk_images_quickstart
@@ -695,6 +696,58 @@ qemu-img create sheepdog:@var{hostname}:@var{port}:@var{image} @var{size}
 qemu sheepdog:@var{hostname}:@var{port}:@var{image}
 @end example
 
+@node disk_images_iscsi
+@subsection iSCSI LUNs
+
+iSCSI is a popular protocol used to access SCSI devices across a computer
+network. 
+
+There are two different ways iSCSI devices can be used by QEMU.
+
+The first method is to mount the iSCSI LUN on the host, and make it appear as
+any other ordinary SCSI device on the host and then to access this device as a
+/dev/sd device from QEMU. How to do this differs between host OSes.
+
+The second method involves using the iSCSI initiator that is built into
+QEMU. This provides a mechanism that works the same way regardless of which
+host OS you are running QEMU on. This section will describe this second method
+of using iSCSI together with QEMU.
+
+In QEMU, iSCSI devices are described using special iSCSI URLs
+
+@example
+URL syntax:
+iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
+@end example
+
+Username and password are optional and only used if your taget is set up
+using CHAP authentication for access control.
+Alternatively the username and passwords can also be set via environment
+variables to have these not show up in the process list
+
+@example
+export LIBISCSI_CHAP_USERNAME=<username>
+export LIBISCSI_CHAP_PASSWORD=<password>
+iscsi://<host>/<target-iqn-name>/<lun>
+@end example
+
+Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
+@example
+Setting up a iSCSI target with one CDROM and one DISK:
+tgtd --iscsi portal=127.0.0.1:3260
+tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
+    -b /IMAGES/disk.img --device-type=disk
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
+    -b /IMAGES/cd.iso --device-type=cd
+tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
+
+qemu -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
+    -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
+@end example
+
+
+
 @node pcsys_network
 @section Network emulation
 
Signature · 1 line
1.7.3.1
#2 lore raw

Re: [Qemu-devel] [PATCH] Documentation: Add section about iSCSI LUNS to qemu-doc

Hi,

I have only some small remarks, see my inline comments below.

Am 11.11.2011 22:46, schrieb Ronnie Sahlberg:

Quoted 45 lines

Add a new section about using iSCSI LUNs with qemu
and provide a short example on how to set up a target and access it using the built-in initiator

---
qemu-doc.texi | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++

1 files changed, 53 insertions(+), 0 deletions(-)
qemu-doc.texi +1 -0
index 149e9bd..c1b293e 100644
@@ -421,6 +421,7 @@ snapshots.
 * disk_images_fat_images:: Virtual FAT disk images
 * disk_images_nbd:: NBD access
 * disk_images_sheepdog:: Sheepdog disk images
+* disk_images_iscsi:: iSCSI LUNs

@end menu

@node disk_images_quickstart

qemu-doc.texi +0 -0
@@ -695,6 +696,58 @@ qemu-img create 
 sheepdog:@var{hostname}:@var{port}:@var{image} @var{size}
 qemu sheepdog:@var{hostname}:@var{port}:@var{image}

@end example

+@node disk_images_iscsi
+@subsection iSCSI LUNs

qemu-doc.texi +7 -0
+
+iSCSI is a popular protocol used to access SCSI devices across a computer
+network.
+
+There are two different ways iSCSI devices can be used by QEMU.
+
+The first method is to mount the iSCSI LUN on the host, and make it 

appear as
+any other ordinary SCSI device on the host and then to access this device as a

qemu-doc.texi +4 -0
+/dev/sd device from QEMU. How to do this differs between host OSes.
+
+The second method involves using the iSCSI initiator that is built into
+QEMU. This provides a mechanism that works the same way regardless of 

which
+host OS you are running QEMU on. This section will describe this second method

qemu-doc.texi qemu-img create sheepdog:@var{hostname}:@var{port}:@var{image} @var{size} · line 723

Quoted 10 lines
qemu-doc.texi +10 -0
+of using iSCSI together with QEMU.
+
+In QEMU, iSCSI devices are described using special iSCSI URLs
+
+@example
+URL syntax:
+iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
+@end example
+
+Username and password are optional and only used if your taget is set up

taget -> target

qemu-doc.texi qemu-img create sheepdog:@var{hostname}:@var{port}:@var{image} @var{size} · line 725

Quoted 2 lines
qemu-doc.texi +2 -0
+using CHAP authentication for access control.
+Alternatively the username and passwords can also be set via environment

password instead of passwords?

Quoted 10 lines
qemu-doc.texi +10 -0
+variables to have these not show up in the process list
+
+@example
+export LIBISCSI_CHAP_USERNAME=<username>
+export LIBISCSI_CHAP_PASSWORD=<password>
+iscsi://<host>/<target-iqn-name>/<lun>
+@end example
+
+Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
+@example

qemu-doc.texi qemu-img create sheepdog:@var{hostname}:@var{port}:@var{image} @var{size} · line 745

Quoted 10 lines
qemu-doc.texi +10 -0
+Setting up a iSCSI target with one CDROM and one DISK:
+tgtd --iscsi portal=127.0.0.1:3260
+tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
+ -b /IMAGES/disk.img --device-type=disk
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
+ -b /IMAGES/cd.iso --device-type=cd
+tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
+
+qemu -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \

There is no qemu executable any longer. You may choose from a large number of executable names, e.g. qemu-system-i386.

Quoted 7 lines

+ -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
+@end example

qemu-doc.texi +3 -0
+
+
+

@node pcsys_network
@section Network emulation

Thanks for providing this documentation.

Kind regards,

Stefan Weil

#3 lore raw

Re: [Qemu-devel] [PATCH] Documentation: Add section about iSCSI LUNS to qemu-doc

In reply to Ronnie Sahlberg

Hi,

Am 11.11.2011 22:46, schrieb Ronnie Sahlberg:

Quoted 14 lines

Add a new section about using iSCSI LUNs with qemu
and provide a short example on how to set up a target and access it using the built-in initiator

---
 qemu-doc.texi |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
qemu-doc.texi +0 -0
index 149e9bd..c1b293e 100644
 

qemu-doc.texi qemu-img create sheepdog:@var{hostname}:@var{port}:@var{image} @var{size} · line 743

Quoted 10 lines
qemu-doc.texi +10 -0
+Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
+@example
+Setting up a iSCSI target with one CDROM and one DISK:
+tgtd --iscsi portal=127.0.0.1:3260
+tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
+    -b /IMAGES/disk.img --device-type=disk
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
+    -b /IMAGES/cd.iso --device-type=cd
+tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

Having an example is always good.

These commands and parameters don't seem familiar to me, having worked with iSCSI on Solaris, so this part of the example seems platform-specific. Could you mention that this example is for Linux? Or what specific upstream project these tools can be obtained from?

Please also remember to choose a subject, a recurring fault. ;)

Thanks,

Andreas

#4 lore raw

Re: [Qemu-devel] [PATCH] Documentation: Add section about iSCSI LUNS to qemu-doc

Hi,

Quoted 30 lines · Andreas Färber

Hi,

Am 11.11.2011 22:46, schrieb Ronnie Sahlberg:

Quoted 14 lines

Add a new section about using iSCSI LUNs with qemu
and provide a short example on how to set up a target and access it using the built-in initiator

---
 qemu-doc.texi |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++

 1 files changed, 53 insertions(+), 0 deletions(-)
qemu-doc.texi +0 -0
index 149e9bd..c1b293e 100644
 

qemu-doc.texi qemu-img create sheepdog:@var{hostname}:@var{port}:@var{image} @var{size} · line 743

Quoted 10 lines
qemu-doc.texi +10 -0
+Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
+@example
+Setting up a iSCSI target with one CDROM and one DISK:
+tgtd --iscsi portal=127.0.0.1:3260
+tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
+    -b /IMAGES/disk.img --device-type=disk
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
+    -b /IMAGES/cd.iso --device-type=cd
+tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

Having an example is always good.

Quoted 5 lines

These commands and parameters don't seem familiar to me, having worked with iSCSI on Solaris, so this part of the example seems platform-specific. Could you mention that this example is for Linux? Or what specific upstream project these tools can be obtained from?

I have mentioned now that this is Linux STGT target and that it comes in the scsi-target-utils package.

Maybe add an example for Solaris too?
I don't use Solaris myself so I dont know how to configure iSCSI target on Solaris.

Does OpenSolaris come with the same iSCSI target as Real-Solaris? If so I could set it up in a VM and
try to figure out what a Solaris example could look like.

IMHO, examples are useful to get people up and running real quick to get to a point where one they start experimenting. straight away without having to search/learn lots of stuff first.

Quoted 1 line

Please also remember to choose a subject, a recurring fault. ;)

I know, I am completely hopless with 'git-send-email' :-)

regards
ronnie sahlberg