From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMci0-0002kT-FC for qemu-devel@nongnu.org; Wed, 27 Aug 2014 08:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMchr-0001KI-9c for qemu-devel@nongnu.org; Wed, 27 Aug 2014 08:52:16 -0400 Received: from e24smtp05.br.ibm.com ([32.104.18.26]:32880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMchq-0001Jl-UO for qemu-devel@nongnu.org; Wed, 27 Aug 2014 08:52:07 -0400 Received: from /spool/local by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Aug 2014 09:52:04 -0300 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 8307C1DC005C for ; Wed, 27 Aug 2014 08:52:00 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7RCow6L12583176 for ; Wed, 27 Aug 2014 09:50:59 -0300 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7RCpxFO007102 for ; Wed, 27 Aug 2014 08:51:59 -0400 Message-ID: <53FDD46C.7000202@linux.vnet.ibm.com> Date: Wed, 27 Aug 2014 09:51:56 -0300 From: Daniel H Barboza MIME-Version: 1.0 References: <1409086088-20910-1-git-send-email-rjones@redhat.com> <1409086088-20910-2-git-send-email-rjones@redhat.com> In-Reply-To: <1409086088-20910-2-git-send-email-rjones@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] curl: Add override_accept_ranges flag to force sending range requests. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com On 08/26/2014 05:48 PM, Richard W.M. Jones wrote: > 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 > --- > 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 Reviewed-by: Daniel Barboza Tested-by: Daniel Barboza