From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Peter Lieven <pl@kamp.de>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 15/17] block/iscsi: restore compatiblity with libiscsi 1.9.0
Date: Thu, 2 Jul 2015 10:19:47 +0100 [thread overview]
Message-ID: <1435828789-9647-16-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1435828789-9647-1-git-send-email-stefanha@redhat.com>
From: Peter Lieven <pl@kamp.de>
RHEL7 and others are stuck with libiscsi 1.9.0 since there
unfortunately was an ABI breakage after that release.
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1435313881-19366-1-git-send-email-pl@kamp.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/iscsi.c | 32 +++++++++++++++++++++++++++-----
configure | 6 +++---
qemu-options.hx | 3 ++-
3 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index a6b8fe2..5002916 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -169,6 +169,19 @@ static inline unsigned exp_random(double mean)
return -mean * log((double)rand() / RAND_MAX);
}
+/* SCSI_STATUS_TASK_SET_FULL and SCSI_STATUS_TIMEOUT were introduced
+ * in libiscsi 1.10.0 as part of an enum. The LIBISCSI_API_VERSION
+ * macro was introduced in 1.11.0. So use the API_VERSION macro as
+ * a hint that the macros are defined and define them ourselves
+ * otherwise to keep the required libiscsi version at 1.9.0 */
+#if !defined(LIBISCSI_API_VERSION)
+#define QEMU_SCSI_STATUS_TASK_SET_FULL 0x28
+#define QEMU_SCSI_STATUS_TIMEOUT 0x0f000002
+#else
+#define QEMU_SCSI_STATUS_TASK_SET_FULL SCSI_STATUS_TASK_SET_FULL
+#define QEMU_SCSI_STATUS_TIMEOUT SCSI_STATUS_TIMEOUT
+#endif
+
static void
iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
void *command_data, void *opaque)
@@ -189,11 +202,12 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
iTask->do_retry = 1;
goto out;
}
- if (status == SCSI_STATUS_BUSY || status == SCSI_STATUS_TIMEOUT ||
- status == SCSI_STATUS_TASK_SET_FULL) {
+ if (status == SCSI_STATUS_BUSY ||
+ status == QEMU_SCSI_STATUS_TIMEOUT ||
+ status == QEMU_SCSI_STATUS_TASK_SET_FULL) {
unsigned retry_time =
exp_random(iscsi_retry_times[iTask->retries - 1]);
- if (status == SCSI_STATUS_TIMEOUT) {
+ if (status == QEMU_SCSI_STATUS_TIMEOUT) {
/* make sure the request is rescheduled AFTER the
* reconnect is initiated */
retry_time = EVENT_INTERVAL * 2;
@@ -1355,7 +1369,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
QemuOpts *opts;
Error *local_err = NULL;
const char *filename;
- int i, ret = 0;
+ int i, ret = 0, timeout = 0;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err);
@@ -1425,7 +1439,15 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
goto out;
}
- iscsi_set_timeout(iscsi, parse_timeout(iscsi_url->target));
+ /* timeout handling is broken in libiscsi before 1.15.0 */
+ timeout = parse_timeout(iscsi_url->target);
+#if defined(LIBISCSI_API_VERSION) && LIBISCSI_API_VERSION >= 20150621
+ iscsi_set_timeout(iscsi, timeout);
+#else
+ if (timeout) {
+ error_report("iSCSI: ignoring timeout value for libiscsi <1.15.0");
+ }
+#endif
if (iscsi_full_connect_sync(iscsi, iscsi_url->portal, iscsi_url->lun) != 0) {
error_setg(errp, "iSCSI: Failed to connect to LUN : %s",
diff --git a/configure b/configure
index 08f9a22..3063739 100755
--- a/configure
+++ b/configure
@@ -3618,15 +3618,15 @@ if compile_prog "" "" ; then
fi
##########################################
-# Do we have libiscsi >= 1.10.0
+# Do we have libiscsi >= 1.9.0
if test "$libiscsi" != "no" ; then
- if $pkg_config --atleast-version=1.10.0 libiscsi; then
+ if $pkg_config --atleast-version=1.9.0 libiscsi; then
libiscsi="yes"
libiscsi_cflags=$($pkg_config --cflags libiscsi)
libiscsi_libs=$($pkg_config --libs libiscsi)
else
if test "$libiscsi" = "yes" ; then
- feature_not_found "libiscsi" "Install libiscsi >= 1.10.0"
+ feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
fi
libiscsi="no"
fi
diff --git a/qemu-options.hx b/qemu-options.hx
index 0bdd59f..7b8efbf 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2296,7 +2296,8 @@ line or a configuration file.
Since version Qemu 2.4 it is possible to specify a iSCSI request timeout to detect
stalled requests and force a reestablishment of the session. The timeout
-is specified in seconds. The default is 0 which means no timeout.
+is specified in seconds. The default is 0 which means no timeout. Libiscsi
+1.15.0 or greater is required for this feature.
Example (without authentication):
@example
--
2.4.3
next prev parent reply other threads:[~2015-07-02 9:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 9:19 [Qemu-devel] [PULL 00/17] Block patches Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 01/17] block/iscsi: add support for request timeouts Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 02/17] qcow2: Handle EAGAIN returned from update_refcount Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 03/17] qapi: Rename 'dirty-bitmap' mode to 'incremental' Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 04/17] blockdev: no need to drain+flush in hmp_drive_del Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 05/17] timer: Move NANOSECONDS_PER_SECONDS to timer.h Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 06/17] timer: Use a single definition of NSEC_PER_SEC for the whole codebase Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 07/17] block: Add bdrv_get_block_status_above Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 08/17] qmp: Add optional bool "unmap" to drive-mirror Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 09/17] mirror: Do zero write on target if sectors not allocated Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 10/17] block: Fix dirty bitmap in bdrv_co_discard Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 11/17] block: Remove bdrv_reset_dirty Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 12/17] qemu-iotests: Make block job methods common Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 13/17] qemu-iotests: Add test case for mirror with unmap Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 14/17] iotests: Use event_wait in wait_ready Stefan Hajnoczi
2015-07-02 9:19 ` Stefan Hajnoczi [this message]
2015-07-02 9:19 ` [Qemu-devel] [PULL 16/17] block/nfs: limit maximum readahead size to 1MB Stefan Hajnoczi
2015-07-02 9:19 ` [Qemu-devel] [PULL 17/17] block: remove redundant check before g_slist_find() Stefan Hajnoczi
2015-07-02 12:46 ` [Qemu-devel] [PULL 00/17] Block patches Peter Maydell
2015-07-07 13:47 ` Peter Maydell
2015-07-08 13:52 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435828789-9647-16-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).