Re: [Qemu-devel] [PATCH v3 00/10] curl: fix curl read

2013-05-21 Thread Fam Zheng
On Tue, 05/21 08:39, Richard W.M. Jones wrote: On Tue, May 21, 2013 at 09:54:15AM +0800, Fam Zheng wrote: On Mon, 05/20 09:49, Richard W.M. Jones wrote: On Mon, May 20, 2013 at 09:41:06AM +0100, Richard W.M. Jones wrote: On Mon, May 20, 2013 at 03:03:34PM +0800, Fam Zheng wrote

[Qemu-devel] [PATCH v4 00/10] curl: fix curl read

2013-05-21 Thread Fam Zheng
pointer type cast. 02: Use sizeof instead of macro for s-range len. 04: Use pstrcpy and strncasecmp. 06: Add commit message for why is there a cache in curl.c. Changes from v1: Split to multiple patches. The final status should be identical to v1. Fam Zheng (10): curl: introduce CURLSockInfo

[Qemu-devel] [PATCH v4 02/10] curl: change magic number to sizeof

2013-05-21 Thread Fam Zheng
String field length is duplicated in two places. Make it a sizeof. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index 2e42cd1..d0bc66f 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v4 04/10] curl: fix curl_open

2013-05-21 Thread Fam Zheng
if the size isn't known. ... And Accept-Ranges is essential for curl to fetch right data from http/https servers, so we check for this in the header and fail the open if it's not supported. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 44 1

[Qemu-devel] [PATCH v4 05/10] curl: add timer to BDRVCURLState

2013-05-21 Thread Fam Zheng
-by: Fam Zheng f...@redhat.com --- block/curl.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/block/curl.c b/block/curl.c index fc464ad..4fd5bb9 100644 --- a/block/curl.c +++ b/block/curl.c @@ -89,6 +89,7 @@ typedef struct BDRVCURLState

[Qemu-devel] [PATCH v4 03/10] curl: change curl_multi_do to curl_fd_handler

2013-05-21 Thread Fam Zheng
, the function is renamed. It takes a pointer to CURLSockInfo now, instead of pointer to BDRVCURLState. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/block/curl.c b/block/curl.c index d0bc66f

[Qemu-devel] [PATCH v4 01/10] curl: introduce CURLSockInfo to BDRVCURLState.

2013-05-21 Thread Fam Zheng
field is action, which is used to keep what actions are needed when this socket's fd handler is called. CURLSockInfo is added here and used in later commits to save the socket actions. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 31 +-- 1 file changed

[Qemu-devel] [PATCH v4 09/10] curl: add cache quota.

2013-05-21 Thread Fam Zheng
Introduce a cache quota: BDRVCURLState.cache_quota. When adding new CURLDataCache to BDRVCURLState, if number of existing CURLDataCache is larger than CURL_CACHE_QUOTA, try to release some first to limit the in memory cache size. A least used entry is selected for releasing. Signed-off-by: Fam

[Qemu-devel] [PATCH v4 06/10] curl: introduce CURLDataCache

2013-05-21 Thread Fam Zheng
/isolinux loading kernel is a typical case and we workaround this by prefetch cache. This is what curl.c has been doing along. This patch just refectors the buffer. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 136 +-- 1 file

[Qemu-devel] [PATCH v4 08/10] curl: use list to store CURLState

2013-05-21 Thread Fam Zheng
Make it consistent to other structures to use QLIST to store CURLState. It also simplifies initialization and releasing of data. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 96 1 file changed, 51 insertions(+), 45

[Qemu-devel] [PATCH v4 10/10] curl: introduce ssl_no_cert runtime option.

2013-05-21 Thread Fam Zheng
Added an option to let curl disable ssl certificate check. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index 5adbc84..b6cc5a0 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v4 07/10] curl: make use of CURLDataCache.

2013-05-21 Thread Fam Zheng
Make subsequecial changes to make use of introduced CURLDataCache. Moved acb struct from CURLState to BDRVCURLState, and changed to list. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 168 --- 1 file changed, 90 insertions

Re: [Qemu-devel] [PATCH v4 00/10] curl: fix curl read

2013-05-22 Thread Fam Zheng
Rich, Please try this version with libguestfs. Thanks. (missing CC due to improper git send-email config) On Wed, 05/22 11:16, Fam Zheng wrote: CURL library API has changed, the current curl driver is not working. This patch rewrites the use of API as well as the structure of internal

Re: [Qemu-devel] [PATCH v4 00/10] curl: fix curl read

2013-05-22 Thread Fam Zheng
On Wed, 05/22 16:39, Stefan Hajnoczi wrote: On Wed, May 22, 2013 at 12:12:24PM +0100, Richard W.M. Jones wrote: On Wed, May 22, 2013 at 01:04:51PM +0200, Paolo Bonzini wrote: Something is trying to write, but there's no write operation defined for CURL. I guess curl (and other

Re: [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes.

2013-05-22 Thread Fam Zheng
On Wed, 05/22 16:01, Richard W.M. Jones wrote: From: Richard W.M. Jones rjo...@redhat.com --- block/curl.c | 4 1 file changed, 4 insertions(+) diff --git a/block/curl.c b/block/curl.c index b8935fd..f1e302b 100644 --- a/block/curl.c +++ b/block/curl.c @@ -406,6 +406,10 @@

[Qemu-devel] [PATCH v5 00/11] curl: fix curl read

2013-05-22 Thread Fam Zheng
. The final status should be identical to v1. Fam Zheng (10): curl: introduce CURLSockInfo to BDRVCURLState. curl: change magic number to sizeof curl: change curl_multi_do to curl_fd_handler curl: fix curl_open curl: add timer to BDRVCURLState curl: introduce CURLDataCache curl: make use

[Qemu-devel] [PATCH v5 02/11] curl: change magic number to sizeof

2013-05-22 Thread Fam Zheng
String field length is duplicated in two places. Make it a sizeof. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index 2e42cd1..d0bc66f 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v5 04/11] curl: fix curl_open

2013-05-22 Thread Fam Zheng
if the size isn't known. ... And Accept-Ranges is essential for curl to fetch right data from http/https servers, so we check for this in the header and fail the open if it's not supported. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 44 1

[Qemu-devel] [PATCH v5 05/11] curl: add timer to BDRVCURLState

2013-05-22 Thread Fam Zheng
-by: Fam Zheng f...@redhat.com --- block/curl.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/block/curl.c b/block/curl.c index fc464ad..4fd5bb9 100644 --- a/block/curl.c +++ b/block/curl.c @@ -89,6 +89,7 @@ typedef struct BDRVCURLState

[Qemu-devel] [PATCH v5 01/11] curl: introduce CURLSockInfo to BDRVCURLState.

2013-05-22 Thread Fam Zheng
field is action, which is used to keep what actions are needed when this socket's fd handler is called. CURLSockInfo is added here and used in later commits to save the socket actions. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 31 +-- 1 file changed

[Qemu-devel] [PATCH v5 07/11] curl: make use of CURLDataCache.

2013-05-22 Thread Fam Zheng
Make subsequecial changes to make use of introduced CURLDataCache. Moved acb struct from CURLState to BDRVCURLState, and changed to list. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 168 --- 1 file changed, 90 insertions

[Qemu-devel] [PATCH v5 06/11] curl: introduce CURLDataCache

2013-05-22 Thread Fam Zheng
/isolinux loading kernel is a typical case and we workaround this by prefetch cache. This is what curl.c has been doing along. This patch just refectors the buffer. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 136 +-- 1 file

[Qemu-devel] [PATCH v5 11/11] block/curl.c: Refuse to open the handle for writes.

2013-05-22 Thread Fam Zheng
From: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 4 1 file changed, 4 insertions(+) diff --git a/block/curl.c b/block/curl.c index b6cc5a0..4499445 100644 --- a/block/curl.c +++ b

[Qemu-devel] [PATCH v5 03/11] curl: change curl_multi_do to curl_fd_handler

2013-05-22 Thread Fam Zheng
, the function is renamed. It takes a pointer to CURLSockInfo now, instead of pointer to BDRVCURLState. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/block/curl.c b/block/curl.c index d0bc66f

[Qemu-devel] [PATCH v5 09/11] curl: add cache quota.

2013-05-22 Thread Fam Zheng
Introduce a cache quota: BDRVCURLState.cache_quota. When adding new CURLDataCache to BDRVCURLState, if number of existing CURLDataCache is larger than CURL_CACHE_QUOTA, try to release some first to limit the in memory cache size. A least used entry is selected for releasing. Signed-off-by: Fam

[Qemu-devel] [PATCH v5 08/11] curl: use list to store CURLState

2013-05-22 Thread Fam Zheng
Make it consistent to other structures to use QLIST to store CURLState. It also simplifies initialization and releasing of data. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 96 1 file changed, 51 insertions(+), 45

[Qemu-devel] [PATCH v5 10/11] curl: introduce ssl_no_cert runtime option.

2013-05-22 Thread Fam Zheng
Added an option to let curl disable ssl certificate check. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index 5adbc84..b6cc5a0 100644 --- a/block/curl.c +++ b/block/curl.c

Re: [Qemu-devel] [PATCH v5 05/11] curl: add timer to BDRVCURLState

2013-05-23 Thread Fam Zheng
On Thu, 05/23 15:55, Stefan Hajnoczi wrote: On Thu, May 23, 2013 at 11:38:03AM +0800, Fam Zheng wrote: diff --git a/block/curl.c b/block/curl.c index fc464ad..4fd5bb9 100644 --- a/block/curl.c +++ b/block/curl.c @@ -89,6 +89,7 @@ typedef struct BDRVCURLState { QLIST_HEAD

Re: [Qemu-devel] [PATCH v5 06/11] curl: introduce CURLDataCache

2013-05-23 Thread Fam Zheng
On Thu, 05/23 16:09, Stefan Hajnoczi wrote: On Thu, May 23, 2013 at 11:38:04AM +0800, Fam Zheng wrote: +typedef struct CURLDataCache { +char *data; +size_t base_pos; Must be int64_t. QEMU compiled on 32-bit hosts would only allow 4 GB images with size_t! OK. +size_t

Re: [Qemu-devel] [PATCH v5 07/11] curl: make use of CURLDataCache.

2013-05-23 Thread Fam Zheng
On Thu, 05/23 16:23, Stefan Hajnoczi wrote: On Thu, May 23, 2013 at 11:38:05AM +0800, Fam Zheng wrote: @@ -221,31 +215,35 @@ static void curl_complete_io(BDRVCURLState *bs, CURLAIOCB *acb, static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque

Re: [Qemu-devel] [PATCH v5 08/11] curl: use list to store CURLState

2013-05-23 Thread Fam Zheng
On Thu, 05/23 16:32, Stefan Hajnoczi wrote: On Thu, May 23, 2013 at 11:38:06AM +0800, Fam Zheng wrote: @@ -660,9 +651,13 @@ static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, static void curl_close(BlockDriverState *bs) { BDRVCURLState *s = bs-opaque; -int i

[Qemu-devel] [PATCH v6 00/12] curl: fix curl read

2013-05-23 Thread Fam Zheng
from v1: Split to multiple patches. The final status should be identical to v1. Fam Zheng (11): curl: introduce CURLSockInfo to BDRVCURLState. curl: change magic number to sizeof curl: change curl_multi_do to curl_fd_handler curl: fix curl_open curl: add timer to BDRVCURLState curl

[Qemu-devel] [PATCH v6 01/12] curl: introduce CURLSockInfo to BDRVCURLState.

2013-05-23 Thread Fam Zheng
field is action, which is used to keep what actions are needed when this socket's fd handler is called. CURLSockInfo is added here and used in later commits to save the socket actions. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 33 ++--- 1 file changed

[Qemu-devel] [PATCH v6 02/12] curl: change magic number to sizeof

2013-05-23 Thread Fam Zheng
String field length is duplicated in two places. Make it a sizeof. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index a829fe7..a11002b 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v6 04/12] curl: fix curl_open

2013-05-23 Thread Fam Zheng
if the size isn't known. ... And Accept-Ranges is essential for curl to fetch right data from http/https servers, so we check for this in the header and fail the open if it's not supported. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 44 1

[Qemu-devel] [PATCH v6 03/12] curl: change curl_multi_do to curl_fd_handler

2013-05-23 Thread Fam Zheng
, the function is renamed. It takes a pointer to CURLSockInfo now, instead of pointer to BDRVCURLState. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/block/curl.c b/block/curl.c index a11002b

[Qemu-devel] [PATCH v6 05/12] curl: add timer to BDRVCURLState

2013-05-23 Thread Fam Zheng
-by: Fam Zheng f...@redhat.com --- block/curl.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/block/curl.c b/block/curl.c index d238489..bb46c8f 100644 --- a/block/curl.c +++ b/block/curl.c @@ -89,6 +89,7 @@ typedef struct BDRVCURLState

[Qemu-devel] [PATCH v6 08/12] curl: use list to store CURLState

2013-05-23 Thread Fam Zheng
Make it consistent to other structures to use QLIST to store CURLState. It also simplifies initialization and releasing of data. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 82 +++- 1 file changed, 37 insertions(+), 45

[Qemu-devel] [PATCH v6 06/12] curl: introduce CURLDataCache

2013-05-23 Thread Fam Zheng
/isolinux loading kernel is a typical case and we workaround this by prefetch cache. This is what curl.c has been doing along. This patch just refectors the buffer. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 137 --- 1 file

[Qemu-devel] [PATCH v6 10/12] curl: introduce ssl_no_cert runtime option.

2013-05-23 Thread Fam Zheng
Added an option to let curl disable ssl certificate check. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index 6e893d0..e067417 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v6 07/12] curl: make use of CURLDataCache.

2013-05-23 Thread Fam Zheng
Make subsequecial changes to make use of introduced CURLDataCache. Moved acb struct from CURLState to BDRVCURLState, and changed to list. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 170 --- 1 file changed, 92 insertions

[Qemu-devel] [PATCH v6 11/12] block/curl.c: Refuse to open the handle for writes.

2013-05-23 Thread Fam Zheng
From: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 4 1 file changed, 4 insertions(+) diff --git a/block/curl.c b/block/curl.c index e067417..bce2e8a 100644 --- a/block/curl.c +++ b

[Qemu-devel] [PATCH v6 09/12] curl: add cache quota.

2013-05-23 Thread Fam Zheng
Introduce a cache quota: BDRVCURLState.cache_quota. When adding new CURLDataCache to BDRVCURLState, if number of existing CURLDataCache is larger than CURL_CACHE_QUOTA, try to release some first to limit the in memory cache size. A least used entry is selected for releasing. Signed-off-by: Fam

[Qemu-devel] [PATCH v6 12/12] curl: set s-url to NULL after free.

2013-05-23 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/curl.c b/block/curl.c index bce2e8a..50c7188 100644 --- a/block/curl.c +++ b/block/curl.c @@ -741,6 +741,7 @@ static void curl_close(BlockDriverState *bs) } g_free(s

Re: [Qemu-devel] [PATCH v6 00/12] curl: fix curl read

2013-05-26 Thread Fam Zheng
On Fri, 05/24 09:07, Richard W.M. Jones wrote: On Fri, May 24, 2013 at 01:36:55PM +0800, Fam Zheng wrote: Changes from v5: 05: Rename bs to s for BDRVCURLState. 06: Use int64_t for offsets. Fix printf format string. Move introducing of use_count to 07. 07: Drop

[Qemu-devel] [PATCH] block: add read only to whitelist

2013-05-28 Thread Fam Zheng
, and returns -ENOTSUP for RW opening. Example: To include vmdk readonly, and others read+write: ./configure --block-drv-whitelist=qcow2,raw,file,qed,^vmdk Signed-off-by: Fam Zheng f...@redhat.com --- block.c | 43 +++ blockdev.c| 4

Re: [Qemu-devel] [PATCH v6 00/12] curl: fix curl read

2013-05-28 Thread Fam Zheng
Sure, I'm using the attached test script. I used your script to test, but I don't see errors as you posted, attached the output. The only difference is that I put libguestfs in different directory with you and I'm using a linux guest image instead of windows xp. Do I need to get a windows

Re: [Qemu-devel] [PATCH] block: add read only to whitelist

2013-05-28 Thread Fam Zheng
On Tue, 05/28 10:10, Paolo Bonzini wrote: Il 28/05/2013 08:44, Fam Zheng ha scritto: diff --git a/scripts/create_config b/scripts/create_config index c471e8c..2dfda3e 100755 --- a/scripts/create_config +++ b/scripts/create_config @@ -35,11 +35,18 @@ case $line in echo

Re: [Qemu-devel] [Bug 1184616] [NEW] undefined reference to`trace_qemu_anon_ram_alloc'

2013-05-28 Thread Fam Zheng
On Tue, 05/28 10:38, Stefan Hajnoczi wrote: On Mon, May 27, 2013 at 09:04:26PM -, Nigel Horne wrote: On Mon, May 27, 2013 at 4:02 PM, Nigel Horne 1184...@bugs.launchpad.net wrote: The latest git version (commit 6a4e17711442849bf2cc731ccddef5a2a2d92d29) fails to compile: ...

Re: [Qemu-devel] [PATCH v6 00/12] curl: fix curl read

2013-05-28 Thread Fam Zheng
On Tue, 05/28 09:46, Richard W.M. Jones wrote: On Tue, May 28, 2013 at 08:47:59AM +0100, Richard W.M. Jones wrote: I'm not sure if a Windows guest is somehow necessary to show the errors. I'll retest with a Linux guest and get back to you about that. Reproducible with Linux guest

Re: [Qemu-devel] [PATCH] qemu-iotests: fix 054 cluster size help output

2013-05-28 Thread Fam Zheng
', fmt=IMGFMT size=1152921504606846976 creating too large image (1 EB) using qcow2.py -- 1.8.1.4 Reviewed-by: Fam Zheng f...@redhat.com

Re: [Qemu-devel] [PATCH v6 00/12] curl: fix curl read

2013-05-28 Thread Fam Zheng
On Tue, 05/28 12:01, Richard W.M. Jones wrote: On Tue, May 28, 2013 at 11:35:20AM +0100, Richard W.M. Jones wrote: I'm continuing to investigate. Some more data points: v6 patch, with my laptop plugged directly into the gigabit ethernet switch which is connected to the web server: -

Re: [Qemu-devel] [PATCH v6 00/12] curl: fix curl read

2013-05-28 Thread Fam Zheng
On Tue, 05/28 12:32, Richard W.M. Jones wrote: This fixes the obvious bug. Thanks for figuring out this. Mainline had this 5s timeout so I kept it, but you don't experience this bug, right? Since master doesn't setup a timer to get curl notified about the timing, the option is just not

Re: [Qemu-devel] [PATCH 0/4] qemu-iotests: reduce iotests.py code duplication

2013-05-28 Thread Fam Zheng
On Tue, 05/28 17:11, Stefan Hajnoczi wrote: Tests 030 and 041 are written in Python and use the iotests.py module. Push common code down into iotests.py. My 'drive-backup' series takes advantage will take advantage of this - kwolf pointed out that earlier revisions were Do you mean s/takes

[Qemu-devel] [PATCH v2] block: add block driver read only whitelist

2013-05-29 Thread Fam Zheng
\ --block-drv-ro-whitelist=vmdk Signed-off-by: Fam Zheng f...@redhat.com --- block.c | 43 +++ blockdev.c| 4 ++-- configure | 20 +++- include/block/block.h | 3 ++- scripts/create_config | 11

Re: [Qemu-devel] [PATCH v2] block: add block driver read only whitelist

2013-05-29 Thread Fam Zheng
On Wed, 05/29 16:41, Fam Zheng wrote: We may want to include a driver in the whitelist for read only tasks such as diagnosing or exporting guest data (with libguestfs as a good example). This patch introduces a readonly whitelist option, and for backward compatibility, the old configure option

[Qemu-devel] [PATCH v3] block: add block driver read only whitelist

2013-05-29 Thread Fam Zheng
\ --block-drv-ro-whitelist=vmdk v3: Fix hw/block/xen_disk.c. v2: Use a separate configure option, no more magic prefix. Signed-off-by: Fam Zheng f...@redhat.com --- block.c | 43 +++ blockdev.c| 4 ++-- configure | 20

Re: [Qemu-devel] [PATCH v3] block: add block driver read only whitelist

2013-05-29 Thread Fam Zheng
On Wed, 05/29 13:56, Kevin Wolf wrote: Am 29.05.2013 um 13:35 hat Fam Zheng geschrieben: We may want to include a driver in the whitelist for read only tasks such as diagnosing or exporting guest data (with libguestfs as a good example). This patch introduces a readonly whitelist option

Re: [Qemu-devel] [PATCH v2 1/3] block: add basic backup support to block driver

2013-05-29 Thread Fam Zheng
On Mon, 04/29 09:42, Stefan Hajnoczi wrote: + +static void coroutine_fn backup_run(void *opaque) +{ +BackupBlockJob *job = opaque; +BlockDriverState *bs = job-common.bs; +assert(bs); + +int64_t start, end; + +start = 0; +end = DIV_ROUND_UP(bdrv_getlength(bs) /

Re: [Qemu-devel] [PATCH V19 0/8] add-cow file format

2013-06-02 Thread Fam Zheng
On Thu, 05/30 18:00, Dongxu Wang wrote: It will introduce a new file format: add-cow. The add-cow file format makes it possible to perform copy-on-write on top of a raw disk image. When we know that no backing file clusters remain visible (e.g. we have streamed the entire image and copied

Re: [Qemu-devel] [PATCH V19 1/8] V18: docs: document for add-cow file format

2013-06-02 Thread Fam Zheng
On Thu, 05/30 18:00, Dongxu Wang wrote: From: Dong Xu Wang wdon...@linux.vnet.ibm.com Document for add-cow format, the usage and spec of add-cow are introduced. v18-v19: 1) backing_fmt and image_fmt NUL-terminated. 2) other fix. V17-V18: 1) remove version field. 2) header size is

Re: [Qemu-devel] [PATCH] blockdev: reset werror/rerror on drive_del

2013-06-05 Thread Fam Zheng
On Mon, 06/03 16:58, Stefan Hajnoczi wrote: Paolo Bonzini pbonz...@redhat.com suggested the following test case: 1. Launch a guest and wait at the GRUB boot menu: qemu-system-x86_64 -enable-kvm -m 1024 \ -drive if=none,cache=none,file=test.img,id=foo,werror=stop,rerror=stop

Re: [Qemu-devel] [PATCH v5 03/11] block: add basic backup support to block driver

2013-06-05 Thread Fam Zheng
On Thu, 05/30 14:34, Stefan Hajnoczi wrote: + +static int coroutine_fn backup_before_write_notify( +NotifierWithReturn *notifier, +void *opaque) +{ +BdrvTrackedRequest *req = opaque; + +return backup_do_cow(req-bs, req-sector_num, req-nb_sectors, NULL); +} I'm

[Qemu-devel] [PATCH v7 04/13] curl: fix curl_open

2013-06-06 Thread Fam Zheng
if the size isn't known. ... And Accept-Ranges is essential for curl to fetch right data from http/https servers, so we check for this in the header and fail the open if it's not supported. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 44 1

[Qemu-devel] [PATCH v7 01/13] curl: introduce CURLSockInfo to BDRVCURLState.

2013-06-06 Thread Fam Zheng
field is action, which is used to keep what actions are needed when this socket's fd handler is called. CURLSockInfo is added here and used in later commits to save the socket actions. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 33 ++--- 1 file changed

[Qemu-devel] [PATCH v7 02/13] curl: change magic number to sizeof

2013-06-06 Thread Fam Zheng
String field length is duplicated in two places. Make it a sizeof. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index a829fe7..a11002b 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v7 00/13] curl: fix curl read

2013-06-06 Thread Fam Zheng
explicit cast. Use int64_t for offsets. Use_count moved here. 08: Remove duplicated. Move s-url = NULL to separate patch. 09: Fix while(0); 12: Added: curl: set s-url to NULL after free. Fam Zheng (12): curl: introduce CURLSockInfo to BDRVCURLState. curl: change magic

[Qemu-devel] [PATCH v7 03/13] curl: change curl_multi_do to curl_fd_handler

2013-06-06 Thread Fam Zheng
, the function is renamed. It takes a pointer to CURLSockInfo now, instead of pointer to BDRVCURLState. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/block/curl.c b/block/curl.c index a11002b

[Qemu-devel] [PATCH v7 05/13] curl: add timer to BDRVCURLState

2013-06-06 Thread Fam Zheng
-by: Fam Zheng f...@redhat.com --- block/curl.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/block/curl.c b/block/curl.c index d238489..bb46c8f 100644 --- a/block/curl.c +++ b/block/curl.c @@ -89,6 +89,7 @@ typedef struct BDRVCURLState

[Qemu-devel] [PATCH v7 09/13] curl: add cache quota.

2013-06-06 Thread Fam Zheng
Introduce a cache quota: BDRVCURLState.cache_quota. When adding new CURLDataCache to BDRVCURLState, if number of existing CURLDataCache is larger than CURL_CACHE_QUOTA, try to release some first to limit the in memory cache size. A least used entry is selected for releasing. Signed-off-by: Fam

[Qemu-devel] [PATCH v7 08/13] curl: use list to store CURLState

2013-06-06 Thread Fam Zheng
Make it consistent to other structures to use QLIST to store CURLState. It also simplifies initialization and releasing of data. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 82 +++- 1 file changed, 37 insertions(+), 45

[Qemu-devel] [PATCH v7 13/13] curl: change timeout to 30 seconds

2013-06-06 Thread Fam Zheng
On curl request timeout, guest gets -EIO. This happens too frequently accessing a slow network resource, with 5 seconds timeout. Change it to 30 seconds to give more time before aborting the request. Reported-by: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-devel] [PATCH v7 06/13] curl: introduce CURLDataCache

2013-06-06 Thread Fam Zheng
/isolinux loading kernel is a typical case and we workaround this by prefetch cache. This is what curl.c has been doing along. This patch just refectors the buffer. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 137 --- 1 file

[Qemu-devel] [PATCH v7 12/13] curl: set s-url to NULL after free.

2013-06-06 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/curl.c b/block/curl.c index bce2e8a..50c7188 100644 --- a/block/curl.c +++ b/block/curl.c @@ -741,6 +741,7 @@ static void curl_close(BlockDriverState *bs) } g_free(s-url

[Qemu-devel] [PATCH v7 10/13] curl: introduce ssl_no_cert runtime option.

2013-06-06 Thread Fam Zheng
Added an option to let curl disable ssl certificate check. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index 6e893d0..e067417 100644 --- a/block/curl.c +++ b/block/curl.c

[Qemu-devel] [PATCH v7 07/13] curl: make use of CURLDataCache.

2013-06-06 Thread Fam Zheng
Make subsequecial changes to make use of introduced CURLDataCache. Moved acb struct from CURLState to BDRVCURLState, and changed to list. Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 170 --- 1 file changed, 92 insertions

[Qemu-devel] [PATCH v7 11/13] block/curl.c: Refuse to open the handle for writes.

2013-06-06 Thread Fam Zheng
From: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 4 1 file changed, 4 insertions(+) diff --git a/block/curl.c b/block/curl.c index e067417..bce2e8a 100644 --- a/block/curl.c +++ b

Re: [Qemu-devel] [PATCH V15 0/5] enhancement for qmp/hmp interfaces of block info

2013-06-06 Thread Fam Zheng
On Thu, 06/06 12:27, Wenchao Xia wrote: This series lets qmp interface show delaied info, including internal snapshot Typo? s/delaied/detailed/ /backing chain on all block device at runtime, which helps management stack and human user, by retrieving exactly the same info of what qemu

Re: [Qemu-devel] [PATCH v5 03/11] block: add basic backup support to block driver

2013-06-06 Thread Fam Zheng
On Thu, 06/06 10:05, Stefan Hajnoczi wrote: On Thu, Jun 06, 2013 at 11:56:18AM +0800, Fam Zheng wrote: On Thu, 05/30 14:34, Stefan Hajnoczi wrote: + +static int coroutine_fn backup_before_write_notify( +NotifierWithReturn *notifier, +void *opaque

Re: [Qemu-devel] [PATCH v7 00/13] curl: fix curl read

2013-06-06 Thread Fam Zheng
On Thu, 06/06 12:01, Richard W.M. Jones wrote: On Thu, Jun 06, 2013 at 02:25:46PM +0800, Fam Zheng wrote: v7: 13: Added: curl: change timeout to 30 seconds I tested this against: (1) HTTP to Apache server over slow but local wifi. (2) HTTP to a remote ISO (on another

Re: [Qemu-devel] [PATCH v7 00/13] curl: fix curl read

2013-06-07 Thread Fam Zheng
On Fri, 06/07 08:27, Richard W.M. Jones wrote: On Fri, Jun 07, 2013 at 09:54:42AM +0800, Fam Zheng wrote: The weird thing is it doesn't work for me, I'm sure something is wrong with current upstream, although not totally broken. $./qemu-io http://localhost/vm/arch.raw -c 'read -v 0 512

Re: [Qemu-devel] [PATCH v7 00/13] curl: fix curl read

2013-06-07 Thread Fam Zheng
On Fri, 06/07 09:46, Stefan Hajnoczi wrote: On Thu, Jun 06, 2013 at 12:01:57PM +0100, Richard W.M. Jones wrote: On Thu, Jun 06, 2013 at 02:25:46PM +0800, Fam Zheng wrote: v7: 13: Added: curl: change timeout to 30 seconds I tested this against: (1) HTTP to Apache

Re: [Qemu-devel] [PATCH 04/11] snapshot: new function bdrv_snapshot_find_by_id_and_name()

2013-06-08 Thread Fam Zheng
On Sat, 06/08 14:58, Wenchao Xia wrote: To make it clear about id and name in searching, add this API to distinguish them. Caller can choose to search by id or name, *errp will be set only for exception. Some code are modified based on Pavel's patch. Signed-off-by: Wenchao Xia

Re: [Qemu-devel] [PATCH 06/11] snapshot: distinguish id and name in snapshot delete

2013-06-08 Thread Fam Zheng
On Sat, 06/08 14:58, Wenchao Xia wrote: -static int find_snapshot_by_id(BlockDriverState *bs, const char *id_str) +static int find_snapshot_by_id_and_name(BlockDriverState *bs, +const char *id, +const char

Re: [Qemu-devel] [PATCH 08/11] qmp: add interface blockdev-snapshot-internal-sync

2013-06-08 Thread Fam Zheng
On Sat, 06/08 14:58, Wenchao Xia wrote: This interface can generate snapshot name automatically if it is not specified, since it is a single opertion. Snapshot ID can't be specified in this interface. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 25

Re: [Qemu-devel] [PATCH 10/11] hmp: add interface hmp_snapshot_internal_blkdev

2013-06-08 Thread Fam Zheng
On Sat, 06/08 14:58, Wenchao Xia wrote: Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- hmp-commands.hx | 24 ++-- hmp.c | 10 ++ hmp.h |1 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx

Re: [Qemu-devel] [PATCH 04/11] snapshot: new function bdrv_snapshot_find_by_id_and_name()

2013-06-08 Thread Fam Zheng
On Sat, 06/08 15:58, Wenchao Xia wrote: 于 2013-6-8 15:31, Fam Zheng 写道: On Sat, 06/08 14:58, Wenchao Xia wrote: To make it clear about id and name in searching, add this API to distinguish them. Caller can choose to search by id or name, *errp will be set only for exception. Some code

[Qemu-devel] [PATCH] vmdk: refuse to open higher version than supported

2013-06-08 Thread Fam Zheng
them blindly. Signed-off-by: Fam Zheng f...@redhat.com --- block/vmdk.c | 4 1 file changed, 4 insertions(+) diff --git a/block/vmdk.c b/block/vmdk.c index 608daaf..d9c2368 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -558,6 +558,10 @@ static int vmdk_open_vmdk4(BlockDriverState *bs

[Qemu-devel] [PATCH] curl: refuse to open URL from HTTP server without range support

2013-06-08 Thread Fam Zheng
this driver, get a better server or use internet URLs. Cc: Richard W.M. Jones rjo...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com --- block/curl.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block/curl.c b/block/curl.c index b8935fd..b46de69

Re: [Qemu-devel] [PATCH 10/11] hmp: add interface hmp_snapshot_internal_blkdev

2013-06-08 Thread Fam Zheng
On Sun, 06/09 10:39, Wenchao Xia wrote: 于 2013-6-8 16:21, Fam Zheng 写道: On Sat, 06/08 14:58, Wenchao Xia wrote: Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- hmp-commands.hx | 24 ++-- hmp.c | 10 ++ hmp.h |1 + 3

Re: [Qemu-devel] [PATCH] curl: refuse to open URL from HTTP server without range support

2013-06-10 Thread Fam Zheng
On Mon, Jun 10, 2013 at 5:21 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Sun, Jun 09, 2013 at 10:34:54AM +0800, Fam Zheng wrote: @@ -110,14 +111,14 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, return 0; } -static size_t curl_size_cb(void *ptr, size_t size

Re: [Qemu-devel] help me with qemu-img theory(snapshot and backing file)

2013-09-30 Thread Fam Zheng
On Mon, 09/30 12:48, yue-kvm wrote: hi,all if there any documents about snapshot and backing file's theory. as we know vmware has composor which can upgrade images(top of backing chain ) by upgrading backing file What does upgrade images mean? Thanks, Fam

[Qemu-devel] [PATCH v4 1/7] block: add bdrv_common_ancestor()

2013-09-30 Thread Fam Zheng
This function finds the common ancestor in backing chain of two BDSes. If there's no common ancestor, NULL is returned. Signed-off-by: Fam Zheng f...@redhat.com --- block.c | 15 +++ include/block/block.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/block.c

[Qemu-devel] [PATCH v4 0/7] block: allow commit active as top

2013-09-30 Thread Fam Zheng
the job completes, the BDSes are swapped, so the base image become active and [top, base) dropped. Fam Zheng (7): block: add bdrv_common_ancestor() qmp: add internal sync mode common to mirror_start mirror: don't close target mirror: Add commit_job_type to perform commit with mirror code

[Qemu-devel] [PATCH v4 5/7] commit: support commit active layer

2013-09-30 Thread Fam Zheng
If active is top, it will be mirrored to base, (with block/mirror.c code), then the image is switched when user completes the block job. Signed-off-by: Fam Zheng f...@redhat.com --- blockdev.c | 42 -- 1 file changed, 40 insertions(+), 2 deletions(-) diff

[Qemu-devel] [PATCH v4 2/7] qmp: add internal sync mode common to mirror_start

2013-09-30 Thread Fam Zheng
to target, like drive-commit, and when they are synced, the source bs replaces target bs. This is specifically useful for block commit of active layer. This mode is not available (-ENOTSUP) from QMP interface, it is only used internally by block commit code. Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-devel] [PATCH v4 6/7] commit: remove unused check

2013-09-30 Thread Fam Zheng
We support top == active for commit now, remove the check which is dead code now. Signed-off-by: Fam Zheng f...@redhat.com --- block/commit.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/block/commit.c b/block/commit.c index ac4b7cc..086f8c9 100644 --- a/block/commit.c +++ b/block

[Qemu-devel] [PATCH v4 7/7] qemu-iotests: update test cases for commit active

2013-09-30 Thread Fam Zheng
Factor out commit test common logic into super class, and update test of committing the active image. Signed-off-by: Fam Zheng f...@redhat.com --- tests/qemu-iotests/040 | 73 +- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/tests

[Qemu-devel] [PATCH v4 3/7] mirror: don't close target

2013-09-30 Thread Fam Zheng
Let reference count manage target and don't call bdrv_close here. Signed-off-by: Fam Zheng f...@redhat.com --- block/mirror.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index fdc7fa8..af6851f 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -479,7

[Qemu-devel] [PATCH v4 4/7] mirror: Add commit_job_type to perform commit with mirror code

2013-09-30 Thread Fam Zheng
Commit active layer will be implemented in block/mirror.c, prepare a new job type to let it have a right type name for the user. Signed-off-by: Fam Zheng f...@redhat.com --- block/mirror.c| 12 +++- blockdev.c| 2 +- include/block/block_int.h | 2 ++ 3 files

  1   2   3   4   5   6   7   8   9   10   >