qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, danielhb@linux.vnet.ibm.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH] curl: Add override_accept_ranges flag to force sending range requests.
Date: Tue, 26 Aug 2014 21:48:08 +0100	[thread overview]
Message-ID: <1409086088-20910-2-git-send-email-rjones@redhat.com> (raw)
In-Reply-To: <1409086088-20910-1-git-send-email-rjones@redhat.com>

Some servers (notably VMware ESX) accept range requests, but don't
send back the Accept-Ranges: bytes header in their initial response.

For these servers you can set override_accept_ranges to 'on' which
forces this block driver to send range requests anyway.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
 block/curl.c    | 10 +++++++++-
 qemu-options.hx |  5 +++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/block/curl.c b/block/curl.c
index 095b5a4..3905c6e 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -71,6 +71,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
 #define CURL_BLOCK_OPT_URL       "url"
 #define CURL_BLOCK_OPT_READAHEAD "readahead"
 #define CURL_BLOCK_OPT_SSLVERIFY "sslverify"
+#define CURL_BLOCK_OPT_OVERRIDE_ACCEPT_RANGES "override_accept_ranges"
 
 struct BDRVCURLState;
 
@@ -489,6 +490,11 @@ static QemuOptsList runtime_opts = {
             .type = QEMU_OPT_BOOL,
             .help = "Verify SSL certificate"
         },
+        {
+            .name = CURL_BLOCK_OPT_OVERRIDE_ACCEPT_RANGES,
+            .type = QEMU_OPT_BOOL,
+            .help = "Server accepts range requests"
+        },
         { /* end of list */ }
     },
 };
@@ -547,7 +553,9 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
 
     // Get file size
 
-    s->accept_range = false;
+    s->accept_range =
+        qemu_opt_get_bool(opts, CURL_BLOCK_OPT_OVERRIDE_ACCEPT_RANGES,
+                          false);
     curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1);
     curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION,
                      curl_header_cb);
diff --git a/qemu-options.hx b/qemu-options.hx
index c573dd8..626ebb3 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2351,6 +2351,11 @@ multiple of 512 bytes. It defaults to 256k.
 @item sslverify
 Whether to verify the remote server's certificate when connecting over SSL. It
 can have the value 'on' or 'off'. It defaults to 'on'.
+
+@item override_accept_ranges
+Some servers (notably VMware ESX) accept range requests, but don't
+declare this fact in the headers that they return. Setting this option
+to 'on' forces CURL to use range requests. The default is 'off'.
 @end table
 
 Note that when passing options to qemu explicitly, @option{driver} is the value
-- 
2.0.4

  reply	other threads:[~2014-08-26 20:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 20:48 [Qemu-devel] [PATCH] curl: Add override_accept_ranges flag to force sending range Richard W.M. Jones
2014-08-26 20:48 ` Richard W.M. Jones [this message]
2014-08-27  2:38   ` [Qemu-devel] [PATCH] curl: Add override_accept_ranges flag to force sending range requests Fam Zheng
2014-08-27  2:57     ` Eric Blake
2014-08-27  6:37       ` Markus Armbruster
2014-08-27 10:16         ` Richard W.M. Jones
2014-08-27  7:57       ` Richard W.M. Jones
2014-08-27 12:51   ` Daniel H Barboza

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=1409086088-20910-2-git-send-email-rjones@redhat.com \
    --to=rjones@redhat.com \
    --cc=danielhb@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).