iSCSI support for QEMU, update
Subsystems (2)
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
PATCH 1/1 iSCSI block driver support
This patch adds a new block driver : block.iscsi.c This driver interfaces with the multiplatform posix library for iscsi initiator/client access to iscsi devices hosted atgit://github.com/sahlberg/libiscsi.git
The patch adds the driver to interface with the iscsi library. It also updated the configure script to
* by default, probe is libiscsi is available and if so, build qemu against libiscsi.
* --enable-libiscsi
Force a build against libiscsi. If libiscsi is not available the build will fail.
* --disable-libiscsi
Do not link against libiscsi, even if it is available.
When linked with libiscsi, qemu gains support to access iscsi resources such as disks and cdrom directly, without having to make the devices visible to the host.
You can specify devices using a iscsi url of the form :
iscsi://[<username>[:<password>@]]<host>[:<port]/<target-iqn-name>/<lun> When using authentication, the password can optionally be set with LIBISCSI_CHAP_PASSWORD="password" to avoid it showing up in the process list
Example:
-drive file=iscsi://10.1.1.1:3260/iqn.ronnie.test/1
--- Makefile.objs | 1 + block/iscsi.c | 596 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure | 31 +++ trace-events | 6 + 4 files changed, 634 insertions(+), 0 deletions(-) create mode 100644 block/iscsi.c
Makefile.objs +1 -0
@@ -25,6 +25,7 @@ block-nested-y += qed-check.o block-nested-y += parallels.o nbd.o blkdebug.o sheepdog.o blkverify.o block-nested-$(CONFIG_WIN32) += raw-win32.o block-nested-$(CONFIG_POSIX) += raw-posix.o +block-nested-$(CONFIG_LIBISCSI) += iscsi.o block-nested-$(CONFIG_CURL) += curl.o block-nested-$(CONFIG_RBD) += rbd.o
block/iscsi.c new file +596 -0
596 lines not on this page · raw message
configure +31 -0
@@ -178,6 +178,7 @@ rbd="" smartcard="" smartcard_nss="" opengl="" +libiscsi="" # parse CC options first for opt do
@@ -632,6 +633,10 @@ for opt do ;; --enable-spice) spice="yes" ;; + --disable-libiscsi) libiscsi="no" + ;; + --enable-libiscsi) libiscsi="yes" + ;; --enable-profiler) profiler="yes" ;; --enable-cocoa)
@@ -941,6 +946,8 @@ echo " Default:trace-<pid>" echo " --disable-spice disable spice" echo " --enable-spice enable spice" echo " --enable-rbd enable building the rados block device (rbd)" +echo " --disable-libiscsi disable iscsi support" +echo " --enable-libiscsi enable iscsi support" echo " --disable-smartcard disable smartcard support" echo " --enable-smartcard enable smartcard support" echo " --disable-smartcard-nss disable smartcard nss support"
@@ -2290,6 +2297,25 @@ if compile_prog "" "" ; then fi ########################################## +# Do we have libiscsi +if test "$libiscsi" != "no" ; then + cat > $TMPC << EOF +#include <iscsi/iscsi.h> +int main(void) { iscsi_create_context(""); return 0; } +EOF + if compile_prog "-Werror" "-liscsi" ; then + libiscsi="yes" + LIBS="$LIBS -liscsi" + else + if test "$libiscsi" = "yes" ; then + feature_not_found "libiscsi" + fi + libiscsi="no" + fi +fi + + +########################################## # Do we need librt cat > $TMPC <<EOF #include <signal.h>
@@ -2623,6 +2649,7 @@ echo "rbd support $rbd" echo "xfsctl support $xfs" echo "nss used $smartcard_nss" echo "OpenGL support $opengl" +echo "libiscsi support $libiscsi" if test $sdl_too_old = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2917,6 +2944,10 @@ if test "$opengl" = "yes" ; then echo "CONFIG_OPENGL=y" >> $config_host_mak fi +if test "$libiscsi" = "yes" ; then + echo "CONFIG_LIBISCSI=y" >> $config_host_mak +fi + # XXX: suppress that if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak
trace-events +6 -0
@@ -361,3 +361,9 @@ disable milkymist_uart_pulse_irq_tx(void) "Pulse IRQ TX" # hw/milkymist-vgafb.c disable milkymist_vgafb_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x" disable milkymist_vgafb_memory_write(uint32_t addr, uint32_t value) "addr %08x value %08x" + +# block/iscsi.c +disable iscsi_aio_write10_cb(void *iscsi, int status, void *acb, int canceled) "iscsi %p status %d acb %p canceled %d" +disable iscsi_aio_writev(void *iscsi, int64_t sector_num, int nb_sectors, void *opaque, void *acb) "iscsi %p sector_num %"PRId64" nb_sectors %d opaque %p acb %p" +disable iscsi_aio_read10_cb(void *iscsi, int status, void *acb, int canceled) "iscsi %p status %d acb %p canceled %d" +disable iscsi_aio_readv(void *iscsi, int64_t sector_num, int nb_sectors, void *opaque, void *acb) "iscsi %p sector_num %"PRId64" nb_sectors %d opaque %p acb %p"
Signature · 1 line
1.7.3.1