From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55739 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtYo5-00034n-D7 for qemu-devel@nongnu.org; Sun, 27 Feb 2011 00:04:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtYo4-0007GN-F4 for qemu-devel@nongnu.org; Sun, 27 Feb 2011 00:04:33 -0500 Received: from mail-iw0-f173.google.com ([209.85.214.173]:36279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtYo4-0007GH-Af for qemu-devel@nongnu.org; Sun, 27 Feb 2011 00:04:32 -0500 Received: by iwl42 with SMTP id 42so2651436iwl.4 for ; Sat, 26 Feb 2011 21:04:31 -0800 (PST) From: Ronnie Sahlberg Date: Sun, 27 Feb 2011 16:04:14 +1100 Message-Id: <1298783055-5128-1-git-send-email-ronniesahlberg@gmail.com> Subject: [Qemu-devel] iSCSI block driver support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com 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