From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMT8D-00048V-MB for qemu-devel@nongnu.org; Tue, 26 Aug 2014 22:38:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMT86-0001iW-7i for qemu-devel@nongnu.org; Tue, 26 Aug 2014 22:38:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMT85-0001iS-WE for qemu-devel@nongnu.org; Tue, 26 Aug 2014 22:38:34 -0400 Date: Wed, 27 Aug 2014 10:38:45 +0800 From: Fam Zheng Message-ID: <20140827023845.GA2977@T430.nay.redhat.com> References: <1409086088-20910-1-git-send-email-rjones@redhat.com> <1409086088-20910-2-git-send-email-rjones@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1409086088-20910-2-git-send-email-rjones@redhat.com> 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" Cc: kwolf@redhat.com, danielhb@linux.vnet.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com On Tue, 08/26 21:48, 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 > -- > 2.0.4 > > Reviewed-by: Fam Zheng