Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 932642 Details for
Bug 1132569
RFE: Enable curl driver in qemu-kvm-rhev: https only
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
testing patch
0001-ENABLE-BLOCK-DRIVER-WITH-PATCHES.patch (text/plain), 15.48 KB, created by
Richard W.M. Jones
on 2014-08-29 11:59:27 UTC
(
hide
)
Description:
testing patch
Filename:
MIME Type:
Creator:
Richard W.M. Jones
Created:
2014-08-29 11:59:27 UTC
Size:
15.48 KB
patch
obsolete
>From f64361218062005d76c008845424f1bc780282b6 Mon Sep 17 00:00:00 2001 >From: "Richard W.M. Jones" <rjones@redhat.com> >Date: Fri, 29 Aug 2014 12:24:08 +0100 >Subject: [PATCH] ENABLE BLOCK DRIVER WITH PATCHES > >--- > ...-t-deref-NULL-pointer-in-call-to-aio_poll.patch | 74 ++++++++++++ > ...a-cookie-or-cookies-to-be-sent-with-http-.patch | 129 +++++++++++++++++++++ > 0003-block.curl-adding-timeout-option.patch | 111 ++++++++++++++++++ > qemu-kvm.spec | 22 +++- > 4 files changed, 333 insertions(+), 3 deletions(-) > create mode 100644 0001-curl-Don-t-deref-NULL-pointer-in-call-to-aio_poll.patch > create mode 100644 0002-curl-Allow-a-cookie-or-cookies-to-be-sent-with-http-.patch > create mode 100644 0003-block.curl-adding-timeout-option.patch > >diff --git a/0001-curl-Don-t-deref-NULL-pointer-in-call-to-aio_poll.patch b/0001-curl-Don-t-deref-NULL-pointer-in-call-to-aio_poll.patch >new file mode 100644 >index 0000000..9bd2f22 >--- /dev/null >+++ b/0001-curl-Don-t-deref-NULL-pointer-in-call-to-aio_poll.patch >@@ -0,0 +1,74 @@ >+From c56a596c63db74e16cdf4a04d70969572b32159d Mon Sep 17 00:00:00 2001 >+From: "Richard W.M. Jones" <rjones@redhat.com> >+Date: Wed, 27 Aug 2014 16:05:59 +0100 >+Subject: [PATCH 1/3] curl: Don't deref NULL pointer in call to aio_poll. >+ >+In commit 63f0f45f2e89b60ff8245fec81328ddfde42a303 the following >+mechanical change was made: >+ >+ if (!state) { >+- qemu_aio_wait(); >++ aio_poll(state->s->aio_context, true); >+ } >+ >+The new code now checks if state is NULL and then dereferences it >+('state->s') which is obviously incorrect. >+ >+This commit replaces state->s->aio_context with >+bdrv_get_aio_context(bs), fixing this problem. The two other hunks >+are concerned with getting the BlockDriverState pointer bs to where it >+is needed. >+ >+The original bug causes a segfault when using libguestfs to access a >+VMware vCenter Server and doing any kind of complex read-heavy >+operations. With this commit the segfault goes away. >+ >+Signed-off-by: Richard W.M. Jones <rjones@redhat.com> >+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> >+--- >+ block/curl.c | 8 ++++---- >+ 1 file changed, 4 insertions(+), 4 deletions(-) >+ >+diff --git a/block/curl.c b/block/curl.c >+index d4b85d2..f59615d 100644 >+--- a/block/curl.c >++++ b/block/curl.c >+@@ -352,7 +352,7 @@ static void curl_multi_timeout_do(void *arg) >+ #endif >+ } >+ >+-static CURLState *curl_init_state(BDRVCURLState *s) >++static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) >+ { >+ CURLState *state = NULL; >+ int i, j; >+@@ -370,7 +370,7 @@ static CURLState *curl_init_state(BDRVCURLState *s) >+ break; >+ } >+ if (!state) { >+- aio_poll(state->s->aio_context, true); >++ aio_poll(bdrv_get_aio_context(bs), true); >+ } >+ } while(!state); >+ >+@@ -541,7 +541,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, >+ DPRINTF("CURL: Opening %s\n", file); >+ s->aio_context = bdrv_get_aio_context(bs); >+ s->url = g_strdup(file); >+- state = curl_init_state(s); >++ state = curl_init_state(bs, s); >+ if (!state) >+ goto out_noclean; >+ >+@@ -625,7 +625,7 @@ static void curl_readv_bh_cb(void *p) >+ } >+ >+ // No cache found, so let's start a new request >+- state = curl_init_state(s); >++ state = curl_init_state(acb->common.bs, s); >+ if (!state) { >+ acb->common.cb(acb->common.opaque, -EIO); >+ qemu_aio_release(acb); >+-- >+1.8.3.1 >+ >diff --git a/0002-curl-Allow-a-cookie-or-cookies-to-be-sent-with-http-.patch b/0002-curl-Allow-a-cookie-or-cookies-to-be-sent-with-http-.patch >new file mode 100644 >index 0000000..a6b28fa >--- /dev/null >+++ b/0002-curl-Allow-a-cookie-or-cookies-to-be-sent-with-http-.patch >@@ -0,0 +1,129 @@ >+From 79293a478ca449458bd3e2dbfc3f3db56aa9271e Mon Sep 17 00:00:00 2001 >+From: "Richard W.M. Jones" <rjones@redhat.com> >+Date: Thu, 28 Aug 2014 14:46:53 +0100 >+Subject: [PATCH 2/3] curl: Allow a cookie or cookies to be sent with >+ http/https requests. >+ >+In order to access VMware ESX efficiently, we need to send a session >+cookie. This patch is very simple and just allows you to send that >+session cookie. It punts on the question of how you get the session >+cookie in the first place, but in practice you can just run a `curl' >+command against the server and extract the cookie that way. >+ >+To use it, add file.cookie to the curl URL. For example: >+ >+$ qemu-img info 'json: { >+ "file.driver":"https", >+ "file.url":"https://vcenter/folder/Windows%202003/Windows%202003-flat.vmdk?dcPath=Datacenter&dsName=datastore1", >+ "file.sslverify":"off", >+ "file.cookie":"vmware_soap_session=\"52a01262-bf93-ccce-d379-8dabb3e55560\""}' >+image: [...] >+file format: raw >+virtual size: 8.0G (8589934592 bytes) >+disk size: unavailable >+ >+Signed-off-by: Richard W.M. Jones <rjones@redhat.com> >+--- >+ block/curl.c | 20 ++++++++++++++++++++ >+ qemu-options.hx | 5 +++++ >+ 2 files changed, 25 insertions(+) >+ >+diff --git a/block/curl.c b/block/curl.c >+index f59615d..c1c2e35 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_COOKIE "cookie" >+ >+ struct BDRVCURLState; >+ >+@@ -109,6 +110,7 @@ typedef struct BDRVCURLState { >+ char *url; >+ size_t readahead_size; >+ bool sslverify; >++ char *cookie; >+ bool accept_range; >+ AioContext *aio_context; >+ } BDRVCURLState; >+@@ -382,6 +384,9 @@ static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) >+ curl_easy_setopt(state->curl, CURLOPT_URL, s->url); >+ curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER, >+ (long) s->sslverify); >++ if (s->cookie) { >++ curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie); >++ } >+ curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5); >+ curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, >+ (void *)curl_read_cb); >+@@ -489,6 +494,11 @@ static QemuOptsList runtime_opts = { >+ .type = QEMU_OPT_BOOL, >+ .help = "Verify SSL certificate" >+ }, >++ { >++ .name = CURL_BLOCK_OPT_COOKIE, >++ .type = QEMU_OPT_STRING, >++ .help = "Pass the cookie or list of cookies with each request" >++ }, >+ { /* end of list */ } >+ }, >+ }; >+@@ -501,6 +511,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, >+ QemuOpts *opts; >+ Error *local_err = NULL; >+ const char *file; >++ const char *cookie; >+ double d; >+ >+ static int inited = 0; >+@@ -527,6 +538,13 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, >+ >+ s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true); >+ >++ cookie = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); >++ if (cookie) { >++ s->cookie = g_strdup(cookie); >++ } else { >++ s->cookie = NULL; >++ } >++ >+ file = qemu_opt_get(opts, CURL_BLOCK_OPT_URL); >+ if (file == NULL) { >+ error_setg(errp, "curl block driver requires an 'url' option"); >+@@ -582,6 +600,7 @@ out: >+ curl_easy_cleanup(state->curl); >+ state->curl = NULL; >+ out_noclean: >++ g_free(s->cookie); >+ g_free(s->url); >+ qemu_opts_del(opts); >+ return -EINVAL; >+@@ -684,6 +703,7 @@ static void curl_close(BlockDriverState *bs) >+ DPRINTF("CURL: Close\n"); >+ curl_detach_aio_context(bs); >+ >++ g_free(s->cookie); >+ g_free(s->url); >+ } >+ >+diff --git a/qemu-options.hx b/qemu-options.hx >+index c573dd8..7b4a58a 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 cookie >++Send this cookie (it can also be a list of cookies separated by ';') with >++each outgoing request. Only supported when using protocols such as HTTP >++which support cookies, otherwise ignored. >+ @end table >+ >+ Note that when passing options to qemu explicitly, @option{driver} is the value >+-- >+1.8.3.1 >+ >diff --git a/0003-block.curl-adding-timeout-option.patch b/0003-block.curl-adding-timeout-option.patch >new file mode 100644 >index 0000000..33f8a24 >--- /dev/null >+++ b/0003-block.curl-adding-timeout-option.patch >@@ -0,0 +1,111 @@ >+From 3914e8fd22eca4ddf9809af213b6e4cff78137bd Mon Sep 17 00:00:00 2001 >+From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> >+Date: Wed, 13 Aug 2014 12:44:27 -0300 >+Subject: [PATCH 3/3] block.curl: adding 'timeout' option >+ >+The curl hardcoded timeout (5 seconds) sometimes is not long >+enough depending on the remote server configuration and network >+traffic. The user should be able to set how much long he is >+willing to wait for the connection. >+ >+Adding a new option to set this timeout gives the user this >+flexibility. The previous default timeout of 5 seconds will be >+used if this option is not present. >+ >+Reviewed-by: Fam Zheng <famz@redhat.com> >+Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> >+--- >+ block/curl.c | 12 ++++++++++++ >+ qemu-options.hx | 10 ++++++++-- >+ 2 files changed, 20 insertions(+), 2 deletions(-) >+ >+diff --git a/block/curl.c b/block/curl.c >+index c1c2e35..835e4e7 100644 >+--- a/block/curl.c >++++ b/block/curl.c >+@@ -63,6 +63,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle, >+ #define CURL_NUM_ACB 8 >+ #define SECTOR_SIZE 512 >+ #define READ_AHEAD_DEFAULT (256 * 1024) >++#define CURL_TIMEOUT_DEFAULT 5 >+ >+ #define FIND_RET_NONE 0 >+ #define FIND_RET_OK 1 >+@@ -71,6 +72,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_TIMEOUT "timeout" >+ #define CURL_BLOCK_OPT_COOKIE "cookie" >+ >+ struct BDRVCURLState; >+@@ -110,6 +112,7 @@ typedef struct BDRVCURLState { >+ char *url; >+ size_t readahead_size; >+ bool sslverify; >++ int timeout; >+ char *cookie; >+ bool accept_range; >+ AioContext *aio_context; >+@@ -384,6 +387,7 @@ static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) >+ curl_easy_setopt(state->curl, CURLOPT_URL, s->url); >+ curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER, >+ (long) s->sslverify); >++ curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, s->timeout); >+ if (s->cookie) { >+ curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie); >+ } >+@@ -495,6 +499,11 @@ static QemuOptsList runtime_opts = { >+ .help = "Verify SSL certificate" >+ }, >+ { >++ .name = CURL_BLOCK_OPT_TIMEOUT, >++ .type = QEMU_OPT_NUMBER, >++ .help = "Curl timeout" >++ }, >++ { >+ .name = CURL_BLOCK_OPT_COOKIE, >+ .type = QEMU_OPT_STRING, >+ .help = "Pass the cookie or list of cookies with each request" >+@@ -536,6 +545,9 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, >+ goto out_noclean; >+ } >+ >++ s->timeout = qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT, >++ CURL_TIMEOUT_DEFAULT); >++ >+ s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true); >+ >+ cookie = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); >+diff --git a/qemu-options.hx b/qemu-options.hx >+index 7b4a58a..5479cf5 100644 >+--- a/qemu-options.hx >++++ b/qemu-options.hx >+@@ -2356,6 +2356,11 @@ can have the value 'on' or 'off'. It defaults to 'on'. >+ Send this cookie (it can also be a list of cookies separated by ';') with >+ each outgoing request. Only supported when using protocols such as HTTP >+ which support cookies, otherwise ignored. >++ >++@item timeout >++Set the timeout in seconds of the CURL connection. This timeout is the time >++that CURL waits for a response from the remote server to get the size of the >++image to be downloaded. If not set, the default timeout of 5 seconds is used. >+ @end table >+ >+ Note that when passing options to qemu explicitly, @option{driver} is the value >+@@ -2377,9 +2382,10 @@ qemu-system-x86_64 -drive file=/tmp/Fedora-x86_64-20-20131211.1-sda.qcow2,copy-o >+ @end example >+ >+ Example: boot from an image stored on a VMware vSphere server with a self-signed >+-certificate using a local overlay for writes and a readahead of 64k >++certificate using a local overlay for writes, a readahead of 64k and a timeout >++of 10 seconds. >+ @example >+-qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"https",, "file.url":"https://user:password@@vsphere.example.com/folder/test/test-flat.vmdk?dcPath=Datacenter&dsName=datastore1",, "file.sslverify":"off",, "file.readahead":"64k"@}' /tmp/test.qcow2 >++qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"https",, "file.url":"https://user:password@@vsphere.example.com/folder/test/test-flat.vmdk?dcPath=Datacenter&dsName=datastore1",, "file.sslverify":"off",, "file.readahead":"64k",, "file.timeout":10@}' /tmp/test.qcow2 >+ >+ qemu-system-x86_64 -drive file=/tmp/test.qcow2 >+ @end example >+-- >+1.8.3.1 >+ >diff --git a/qemu-kvm.spec b/qemu-kvm.spec >index a7139d4..c56e700 100644 >--- a/qemu-kvm.spec >+++ b/qemu-kvm.spec >@@ -84,7 +84,7 @@ Obsoletes: %1 < %{obsoletes_version} \ > Summary: QEMU is a FAST! processor emulator > Name: %{pkgname}%{?pkgsuffix} > Version: 2.1.0 >-Release: 3%{?dist} >+Release: 3.rwmj2%{?dist} > # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped > Epoch: 10 > License: GPLv2+ and LGPLv2+ and BSD >@@ -422,6 +422,11 @@ Patch137: kvm-virtio-serial-search-for-duplicate-port-names-before.patch > # For bz#1111351 - RHEL-6.6 migration compatibility: CPU models > Patch138: kvm-pc-RHEL-6-CPUID-compat-code-for-Broadwell-CPU-model.patch > >+# RWMJ: For testing virt-v2v. >+Patch1001: 0001-curl-Don-t-deref-NULL-pointer-in-call-to-aio_poll.patch >+Patch1002: 0002-curl-Allow-a-cookie-or-cookies-to-be-sent-with-http-.patch >+Patch1003: 0003-block.curl-adding-timeout-option.patch >+ > BuildRequires: zlib-devel > BuildRequires: SDL-devel > BuildRequires: which >@@ -757,6 +762,11 @@ cp %{SOURCE18} pc-bios # keep "make check" happy > %patch137 -p1 > %patch138 -p1 > >+# RWMJ: >+%patch1001 -p1 >+%patch1002 -p1 >+%patch1003 -p1 >+ > %build > buildarch="%{kvm_target}-softmmu" > >@@ -815,7 +825,6 @@ dobuild() { > --disable-bluez \ > --disable-vde \ > --disable-curses \ >- --disable-curl \ > --enable-vnc-tls \ > --enable-vnc-sasl \ > --enable-linux-aio \ >@@ -848,7 +857,7 @@ dobuild() { > --disable-glusterfs \ > --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd \ > %endif >- --block-drv-ro-whitelist=vmdk,vhdx,vpc \ >+ --block-drv-ro-whitelist=vmdk,vhdx,vpc,https \ > "$@" > > echo "config-host.mak contents:" >@@ -1053,6 +1062,13 @@ find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f > install -c -m 0755 qemu-ga ${RPM_BUILD_ROOT}%{_bindir}/qemu-ga > %endif > >+# RWMJ: No idea why this is necessary ... >+rm $RPM_BUILD_ROOT%{_datadir}/locale/de_DE/LC_MESSAGES/qemu.mo >+rm $RPM_BUILD_ROOT%{_datadir}/locale/fr_FR/LC_MESSAGES/qemu.mo >+rm $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/qemu.mo >+rm $RPM_BUILD_ROOT%{_datadir}/locale/it/LC_MESSAGES/qemu.mo >+rm $RPM_BUILD_ROOT%{_datadir}/locale/tr/LC_MESSAGES/qemu.mo >+ > # Disabled as do not work anymore > # %check > # make check >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1132569
: 932642