qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] (no subject)
@ 2011-06-12  2:47 Ronnie Sahlberg
  2011-06-12  2:47 ` [Qemu-devel] [PATCH] iSCSI block driver support Ronnie Sahlberg
  0 siblings, 1 reply; 6+ messages in thread
From: Ronnie Sahlberg @ 2011-06-12  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha, hch

Please find attached a patch to add built-in support for iSCSI into QEMU.
Please review and/or apply this patch.

This is the latest version of this patch and I think I have addressed all previous concerns and suggestions.


Using built-in iSCSI support has many advantages for certain use cases :

* if you have very many iSCSI devices it may be impractical to expose
all LUNs to the underlying host.

* the devices become private to the guest and are not visible to the host.
This automatically avoids polluting the page-cache on the host.

* security, the devices are private to the guest, which prevents other guests or the host itself from accessing the devices.

* security, it allows non-root users a secure way to get private and password protected access to the device by using CHAP authentication.

* migration, many other virtualization systems provide built-in iscsi clients like this. Also providing this as feature in QEMU may make it easier for such users to migrate over to QEMU/KVM.

* easier to maintain. For users with very many QEMU instances I think having guest-private iscsi targets and LUNs may be easier to manage than 'huge set of files in /dev/scsi/*'

* easier to maintain, when copying a QEMU instance from one host to another, this offers a more self-contained solution where the QEMU command line itself cotnains all required storage configuration, instead of also having to coordinate this move with setting up and tearing down open-iscsi logins on the underlying hosts.




The patch has been tested by installing and running several distributions such as RHEL6 and Ubuntu on devices, both system disk as well as the installer CDROM as being iscsi devices.

This testing has also been performed by running full QEMU under valgrind.

Performance is comparable to using open-iscsi devices.

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [Qemu-devel] iSCSI support for QEMU, update
@ 2011-05-07  6:17 Ronnie Sahlberg
  2011-05-07  6:17 ` [Qemu-devel] [PATCH] iSCSI block driver support Ronnie Sahlberg
  0 siblings, 1 reply; 6+ messages in thread
From: Ronnie Sahlberg @ 2011-05-07  6:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha, hch

This is a patch that adds support for iSCSI to QEMU when QEMU is built against libiscsi (https://github.com/sahlberg/libiscsi)

ISCSI devices are specified using a special iSCSI URL:
  -drive file=iscsi://10.1.1.1:3260/iqn.ronnie.test/1


This allows a guest to access iscsi devices without exposing these devices to the host. Which is nice if/when you have a very large number of LUNs that are dedicated for virtual guests.


This patch is updated to set FUA for all writes, unless any of the NOCACHE or CACHE_WB flags are set for the device.


Please review and/or apply.



regards
ronnie sahlberg

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [Qemu-devel] iSCSI support for QEMU
@ 2011-04-21  8:43 Ronnie Sahlberg
  2011-04-21  8:43 ` [Qemu-devel] [PATCH] iSCSI block driver support Ronnie Sahlberg
  0 siblings, 1 reply; 6+ messages in thread
From: Ronnie Sahlberg @ 2011-04-21  8:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

Please find attached a new version of the patch for iSCSI support.
iSCSI support is automaticallt detected and activated during configure/build
if the libiscsi library is available on the build host.

This library is available at : https://github.com/sahlberg/libiscsi


This new version contains two changes since previous versions
* avoid copying data in the read path and use the api for reading directly
into the application buffers
* use proper task management functions to abort tasks that are cancelled
by qemu


A built in iSCSI initiator has many benefits
* the LUNs used are local to the guest and are not exposed to the host, nor any of the processes running on the host.
* it provides very high performance out-of-the-box, compared to open-iscsi
that requires several special flags to iscsi to match libiscsi
* it avoids cache trashing and having two copies of the same data, once in the 
hosts cache and a second copy in the guest. I.e. O_DIRECT like behaviour.
* management of LUNs are much easier for high-end or enterprise users with
very many iscsi devices. You no longer need to expose many hundreds of devices
to the local host and have them pollute the caches.


Performance is acceptable with libiscsi.
Some basic tests thatve been performed show it to be significantly faster
than an out-of-the-box open-iscsi mounted LUN being accessed by default
QEMU i/o options.

Test was performed as booting a Ubuntu 10.04 host, mounted on a 8GB STGT LUN 
exposed across a 1GbE network.
Test was once the system booted, how long would it take to run, inside the guest, "sudo time dd if=/dev/sda of=/dev/null bs=1M"
i.e. just have the guest read the 8GB system disk.

QEMU+libiscsi                   : 228 seconds
QEMU, default device options    : 273 seconds
QEMU with cache=none            : 387 seconds
QEMU with cache=none,aio=native : 218 seconds


Please review and consider for inclusion.

regards
ronnie sahlberg



From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: iSCSI support for QEMU
In-Reply-To: 

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [Qemu-devel] iSCSI block driver support
@ 2011-02-27  5:04 Ronnie Sahlberg
  2011-02-27  5:04 ` [Qemu-devel] [PATCH] " Ronnie Sahlberg
  0 siblings, 1 reply; 6+ messages in thread
From: Ronnie Sahlberg @ 2011-02-27  5:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha



The following patch adds a new block driver to QEMU/KVM for iSCSI.
This utilizes the userspace client library for iscsi at https://github.com/sahlberg/libiscsi and will link with this library if available.

This allows using iSCSI resources with QEMU/KVM without making them visible to the underlying host. Which is very useful when having very large number of iscsi devices, or when you for other reasons do not want to expose these devicdes to others.


I have used this patch and installed a RHEL6 system from an iscsi dvd onto a iscsi disk. I have done extensive testing.
Both normally and also running under valgrind (which is very slow)

./x86_64-softmmu/qemu-system-x86_64 -m 1024 --enable-kvm -cdrom iscsi://127.0.0.1:3262/iqn.ronnie.test/2 -drive if=virtio,file=iscsi://127.0.0.1:3262/iqn.ronnie.test/1 -boot c

Please review and/or apply.



This is version 4 of the patch :
Version 4 adds :

 - Remove iscsi_is_inserted() since we dont need that function.
 - Change status to -ECANCELED instead of -EIO when aios are cancelled
 - Check that the i/o is not cancelled before calling the callback function.
 - Replace the flush fuinction with an async version.
 - Verify that qemu block size is at least 512 bytes
 - Handle the case where qemu blocksize is smaller than lun blocksize and
   qemu issues an unaligned read.


-----

Version 3 :
 - Fix a bug when writing freed data to the disk
 - Convert TAB to spaces
 - Add tracing functions (From Stefan Hajnoczi)
 - Add a io_flush() handler

-----

   Version 2:
   Changes from Blue Swirl's suggestions
   - Change naming of structures and typedefs to match coding style
   - Use CONFIG_ISCSI in the makefile to conditionally compile iscsi.c
   - Missing spaces added around operators
   - Use uint8_t instead of unsigned char for buffer pointer
   - Use a temporary variable for the result of long functions, to move them
     out from the if(...) expressions. Making the code easier to read.
   - Create a function sector_qemu2lun() and use it instead of performing
     the same conversion explicitely at several palces in the code.
   - Use the name opaque instead of private_data
   - Use memset() instead of bzero()
   - Use the common library function to parse the iSCSI URL
   - Add support for CHAP authentication

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

end of thread, other threads:[~2011-06-12  2:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1303417439-7574-1-git-send-email-y>
2011-04-21 20:23 ` [Qemu-devel] [PATCH] iSCSI block driver support ronniesahlberg
2011-04-21 21:05   ` ronnie sahlberg
2011-06-12  2:47 [Qemu-devel] (no subject) Ronnie Sahlberg
2011-06-12  2:47 ` [Qemu-devel] [PATCH] iSCSI block driver support Ronnie Sahlberg
  -- strict thread matches above, loose matches on Subject: below --
2011-05-07  6:17 [Qemu-devel] iSCSI support for QEMU, update Ronnie Sahlberg
2011-05-07  6:17 ` [Qemu-devel] [PATCH] iSCSI block driver support Ronnie Sahlberg
2011-04-21  8:43 [Qemu-devel] iSCSI support for QEMU Ronnie Sahlberg
2011-04-21  8:43 ` [Qemu-devel] [PATCH] iSCSI block driver support Ronnie Sahlberg
2011-02-27  5:04 [Qemu-devel] " Ronnie Sahlberg
2011-02-27  5:04 ` [Qemu-devel] [PATCH] " Ronnie Sahlberg

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).