qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
@ 2010-11-21 22:17 ronnie sahlberg
  2010-11-21 23:13 ` FUJITA Tomonori
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: ronnie sahlberg @ 2010-11-21 22:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Hannes Reinecke, Nicholas A. Bellinger

List,

Please find attached a gzipped patch against master that adds support of iSCSI.
It is sent in gz format because of its uncompressed size, >100kb.


This patch adds support for attaching directorly to iSCSI resources,
both DISK/SBC and CDROM/MMC, without the need to make the devices
visible to the host.

There are two parts to this support :

./block/iscsi/* : This is a fully async iscsi initiator client
library. This directory does not contain any QEMU specific code with
the hope it can later be re-used by other projects that also need
iscsi-initiator functionality.

./block/iscsi.c : The QEMU block driver that intergrates the
iscsi-initiator library with QEMU.


The iscsi library is incomplete, but sufficient to interoperate with
TGTD. With trivial enhancements(target-NOP) it should work with most
other targets too.

The goal is to expand the library to add more features over time, so
that over time it will become a full-blown iscsi initiator
implementation as a library.

Some features that should be added are
* support for target initiated NOP.  TGTD does not use these but some
other targets do.
* support for uni- and bi-directional CHAP authentication.
* additional iscsi functionality

The syntax to specify a iscsi resource is
   iscsi://<host>[:port]/<target-iqn-name>/<lun>

Example :
   -drive file=iscsi://127.0.0.1:3260/iqn.ronnie.test/1

  -cdrom iscsi://127.0.0.1:3260/iqn.ronnie.test/2


Please review and/or commit.


regards
ronnie sahlberg

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-21 22:17 [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support ronnie sahlberg
@ 2010-11-21 23:13 ` FUJITA Tomonori
  2010-11-21 23:39   ` ronnie sahlberg
  2010-11-22  9:27 ` [Qemu-devel] " Kevin Wolf
  2010-11-24 17:04 ` [Qemu-devel] " Christoph Hellwig
  2 siblings, 1 reply; 9+ messages in thread
From: FUJITA Tomonori @ 2010-11-21 23:13 UTC (permalink / raw)
  To: ronniesahlberg; +Cc: kwolf, qemu-devel, nab, hare

On Mon, 22 Nov 2010 09:17:50 +1100
ronnie sahlberg <ronniesahlberg@gmail.com> wrote:

> This patch adds support for attaching directorly to iSCSI resources,
> both DISK/SBC and CDROM/MMC, without the need to make the devices
> visible to the host.

This adds the iscsi initiator feature to qemu (as you did to dbench),
right?


> The syntax to specify a iscsi resource is
>    iscsi://<host>[:port]/<target-iqn-name>/<lun>
> 
> Example :
>    -drive file=iscsi://127.0.0.1:3260/iqn.ronnie.test/1
> 
>   -cdrom iscsi://127.0.0.1:3260/iqn.ronnie.test/2

Specifying lun looks odd (from the perspective of SCSI initiator)?

btw, how do we specify initiator's configuration (iscsi params, chap,
initiator iqn, etc)?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-21 23:13 ` FUJITA Tomonori
@ 2010-11-21 23:39   ` ronnie sahlberg
  0 siblings, 0 replies; 9+ messages in thread
From: ronnie sahlberg @ 2010-11-21 23:39 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: kwolf, qemu-devel, nab, hare

On Mon, Nov 22, 2010 at 10:13 AM, FUJITA Tomonori
<fujita.tomonori@lab.ntt.co.jp> wrote:
> On Mon, 22 Nov 2010 09:17:50 +1100
> ronnie sahlberg <ronniesahlberg@gmail.com> wrote:
>
>> This patch adds support for attaching directorly to iSCSI resources,
>> both DISK/SBC and CDROM/MMC, without the need to make the devices
>> visible to the host.
>
> This adds the iscsi initiator feature to qemu (as you did to dbench),
> right?

Yes.

>
>
>> The syntax to specify a iscsi resource is
>>    iscsi://<host>[:port]/<target-iqn-name>/<lun>
>>
>> Example :
>>    -drive file=iscsi://127.0.0.1:3260/iqn.ronnie.test/1
>>
>>   -cdrom iscsi://127.0.0.1:3260/iqn.ronnie.test/2
>
> Specifying lun looks odd (from the perspective of SCSI initiator)?
>

Ok.
I can easily to change this.
How would you prefer the iscsi:// url look like ?


> btw, how do we specify initiator's configuration (iscsi params, chap,
> initiator iqn, etc)?
>

You cant yet. :-(

Right now they are hardcoded to reasonable defaults I think will work
for most targets.
I want to add more of these features and make them settable from the
command line,
but that will take a lot of time.

Hopefully having a basic/non-flexible implementation as a first step
may even encourage others to
contribute to improve it until it is full featured.


regards
ronnie sahlberg

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] Re: [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-21 22:17 [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support ronnie sahlberg
  2010-11-21 23:13 ` FUJITA Tomonori
@ 2010-11-22  9:27 ` Kevin Wolf
  2010-11-24 17:04 ` [Qemu-devel] " Christoph Hellwig
  2 siblings, 0 replies; 9+ messages in thread
From: Kevin Wolf @ 2010-11-22  9:27 UTC (permalink / raw)
  To: ronnie sahlberg; +Cc: qemu-devel, Nicholas A. Bellinger, Hannes Reinecke

Am 21.11.2010 23:17, schrieb ronnie sahlberg:
> List,
> 
> Please find attached a gzipped patch against master that adds support of iSCSI.
> It is sent in gz format because of its uncompressed size, >100kb.

I think there's something missing in your mail. :-)

Anyway, I got the code from the KVM list, and I have some general comments:

* Please split this into some smaller patches and send them as a patch
  series. Inline the patches instead of a gzipped attachment, because
  that makes it a lot easier to comment the code when replying to your
  mail.
* Have a look at CODING_STYLE in the repository, especially at the
  sections about 80 chars per line and whitespace.
* Don't use printf() but error_report() for error messages
* Try to use qemu functions instead of POSIX ones so that the code
  will also work on Windows and other platforms. If you can't make it
  run on Windows, still use qemu functions where possible and change
  the Makefile to compile it only for POSIX hosts.
* Once you use qemu_malloc, you can drop your NULL checks. qemu_malloc
  never returns an error.
* Use QLISTs (qemu-queue.h) instead of introducing a new SLIST

Kevin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-21 22:17 [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support ronnie sahlberg
  2010-11-21 23:13 ` FUJITA Tomonori
  2010-11-22  9:27 ` [Qemu-devel] " Kevin Wolf
@ 2010-11-24 17:04 ` Christoph Hellwig
  2010-11-24 19:14   ` Stefan Hajnoczi
  2 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2010-11-24 17:04 UTC (permalink / raw)
  To: ronnie sahlberg
  Cc: Kevin Wolf, qemu-devel, Nicholas A. Bellinger, Hannes Reinecke

I don't really see the point of this.  It's implemented as a protocol,
and thus the bottom of the qemu protocol stack.  So we might get SCSI
commands in from the guest, decode them, just to re-encode them again
and send them off to the network all inside qemu.

Do you have any performance numbers showing why the addition of the
code is nessecary over just using the kernel iscsi initiator?  Which
btw, is a lot more flexible as it also supports SG_IO passthrough
and thus accessing other devices not supporting the SBC command set.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-24 17:04 ` [Qemu-devel] " Christoph Hellwig
@ 2010-11-24 19:14   ` Stefan Hajnoczi
  2010-11-25  4:32     ` Nicholas A. Bellinger
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Hajnoczi @ 2010-11-24 19:14 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Kevin Wolf, Nicholas A. Bellinger, qemu-devel, ronnie sahlberg,
	Hannes Reinecke

On Wed, Nov 24, 2010 at 5:04 PM, Christoph Hellwig <hch@lst.de> wrote:
> Do you have any performance numbers showing why the addition of the
> code is nessecary over just using the kernel iscsi initiator?  Which
> btw, is a lot more flexible as it also supports SG_IO passthrough
> and thus accessing other devices not supporting the SBC command set.

With userspace iSCSI initiator support setup becomes easy, portable,
and doesn't require admin privileges:
qemu -drive file=iscsi:...

That's pretty compelling.  I don't know if people who already use
iSCSI today will want to switch but it provides an easy entry into
iSCSI.

Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-24 19:14   ` Stefan Hajnoczi
@ 2010-11-25  4:32     ` Nicholas A. Bellinger
  2010-11-25  5:22       ` ronnie sahlberg
  0 siblings, 1 reply; 9+ messages in thread
From: Nicholas A. Bellinger @ 2010-11-25  4:32 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Kevin Wolf, Hannes Reinecke, Christoph Hellwig, ronnie sahlberg,
	qemu-devel

On Wed, 2010-11-24 at 19:14 +0000, Stefan Hajnoczi wrote:
> On Wed, Nov 24, 2010 at 5:04 PM, Christoph Hellwig <hch@lst.de> wrote:
> > Do you have any performance numbers showing why the addition of the
> > code is nessecary over just using the kernel iscsi initiator?  Which
> > btw, is a lot more flexible as it also supports SG_IO passthrough
> > and thus accessing other devices not supporting the SBC command set.
> 
> With userspace iSCSI initiator support setup becomes easy, portable,
> and doesn't require admin privileges:
> qemu -drive file=iscsi:...
> 
> That's pretty compelling.  I don't know if people who already use
> iSCSI today will want to switch but it provides an easy entry into
> iSCSI.
> 

So I have had a bit of experience with the VirtualBox iSCSI initiator,
which is similar in the sense that it also runs in userspace, and is
independent of the host OS, etc..  The primary issue tends to be the
threading model, ie: that the stack is limited to a single thread, which
makes it very limiting in terms of scaling (in my experience) at
1 Gb/sec speeds.

But existing code aside, I think having a small userspace iSCSI
initiator built into QEMU that 'just works' across all host environments
would be a pretty useful thing, even if the scalibility / scope is
limited compared to existing kernel host level iSCSI initiator stacks,
et al.  I have not yet had a chance to look at Ronnie's code, but would
be interested to understand how the threading model currently functions.

Ronnie, I would recommending following Kevin's earlier advice and split
your work into a reviewable series of commits (preferrably generated by
git-format-patch) and repost the series for feedback to qemu-devel.  You
can read that as coded language for 'you will want to learn git to
submit your patch', but it really does work.  ;)

--nab

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-25  4:32     ` Nicholas A. Bellinger
@ 2010-11-25  5:22       ` ronnie sahlberg
  2010-11-25  9:30         ` Kevin Wolf
  0 siblings, 1 reply; 9+ messages in thread
From: ronnie sahlberg @ 2010-11-25  5:22 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: Kevin Wolf, Stefan Hajnoczi, Hannes Reinecke, Christoph Hellwig,
	qemu-devel

Nicholas,
below.

On Thu, Nov 25, 2010 at 3:32 PM, Nicholas A. Bellinger
<nab@linux-iscsi.org> wrote:

> But existing code aside, I think having a small userspace iSCSI
> initiator built into QEMU that 'just works' across all host environments
> would be a pretty useful thing, even if the scalibility / scope is
> limited compared to existing kernel host level iSCSI initiator stacks,
> et al.  I have not yet had a chance to look at Ronnie's code, but would
> be interested to understand how the threading model currently functions.
>
> Ronnie, I would recommending following Kevin's earlier advice and split
> your work into a reviewable series of commits (preferrably generated by
> git-format-patch) and repost the series for feedback to qemu-devel.  You
> can read that as coded language for 'you will want to learn git to
> submit your patch', but it really does work.  ;)

Thanks,

I will work on the suggestions over the weekend, so Ill resend either
this weekend or next weekend.
So don't spend/waste time reviewing now.

As for the threading model.
Currently it is not threads safe, so all calls into the library would
have to be protected through a mutex if used from concurrent threads.
I couldn't see any such mutexes when looking at sheepdog as an
example, so do the block drivers need to be threads-safe in qemu?

One goal of the library is to be 100% async and to never make any
blocking syscalls.
So the library will never block and should be able to reach good
performance, even with one single thread.

(I assume your VirtualBOX performance problem was not the threading in
itself but that the threads use blocking calls?)


regards
ronnie sahlberg

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support
  2010-11-25  5:22       ` ronnie sahlberg
@ 2010-11-25  9:30         ` Kevin Wolf
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Wolf @ 2010-11-25  9:30 UTC (permalink / raw)
  To: ronnie sahlberg
  Cc: Stefan Hajnoczi, Hannes Reinecke, Christoph Hellwig,
	Nicholas A. Bellinger, qemu-devel

Am 25.11.2010 06:22, schrieb ronnie sahlberg:
> Nicholas,
> below.
> 
> On Thu, Nov 25, 2010 at 3:32 PM, Nicholas A. Bellinger
> <nab@linux-iscsi.org> wrote:
> 
>> But existing code aside, I think having a small userspace iSCSI
>> initiator built into QEMU that 'just works' across all host environments
>> would be a pretty useful thing, even if the scalibility / scope is
>> limited compared to existing kernel host level iSCSI initiator stacks,
>> et al.  I have not yet had a chance to look at Ronnie's code, but would
>> be interested to understand how the threading model currently functions.
>>
>> Ronnie, I would recommending following Kevin's earlier advice and split
>> your work into a reviewable series of commits (preferrably generated by
>> git-format-patch) and repost the series for feedback to qemu-devel.  You
>> can read that as coded language for 'you will want to learn git to
>> submit your patch', but it really does work.  ;)
> 
> Thanks,
> 
> I will work on the suggestions over the weekend, so Ill resend either
> this weekend or next weekend.
> So don't spend/waste time reviewing now.
> 
> As for the threading model.
> Currently it is not threads safe, so all calls into the library would
> have to be protected through a mutex if used from concurrent threads.
> I couldn't see any such mutexes when looking at sheepdog as an
> example, so do the block drivers need to be threads-safe in qemu?

No, block drivers are not threaded currently. You don't have to take
care of that yourself, everything is already protected by a mutex.

> One goal of the library is to be 100% async and to never make any
> blocking syscalls.
> So the library will never block and should be able to reach good
> performance, even with one single thread.

That would match what other block drivers do.

Kevin

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-11-25  9:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-21 22:17 [Qemu-devel] [PATCH 1/1] iscsi: add iSCSI block device support ronnie sahlberg
2010-11-21 23:13 ` FUJITA Tomonori
2010-11-21 23:39   ` ronnie sahlberg
2010-11-22  9:27 ` [Qemu-devel] " Kevin Wolf
2010-11-24 17:04 ` [Qemu-devel] " Christoph Hellwig
2010-11-24 19:14   ` Stefan Hajnoczi
2010-11-25  4:32     ` Nicholas A. Bellinger
2010-11-25  5:22       ` ronnie sahlberg
2010-11-25  9:30         ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).