Re: [Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots()

2013-05-16 Thread Wenchao Xia
于 2013-5-16 17:32, Stefan Hajnoczi 写道: On Wed, May 15, 2013 at 04:43:38PM +0800, Wenchao Xia wrote: Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qcow2-snapshot.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2

[Qemu-devel] [PATCH 1/2] qcow2: free allocated cluster on fail in qcow2_write_snapshots()

2013-05-15 Thread Wenchao Xia
Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qcow2-snapshot.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 992a5c8..a6065a9 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c

Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-05-15 Thread Wenchao Xia
于 2013-5-15 20:28, Luiz Capitulino 写道: On Wed, 15 May 2013 10:10:37 +0800 Wenchao Xia xiaw...@linux.vnet.ibm.com wrote: 于 2013-5-6 21:22, Luiz Capitulino 写道: On Mon, 06 May 2013 10:09:43 +0800 Wenchao Xia xiaw...@linux.vnet.ibm.com wrote: 于 2013-5-3 10:51, Wenchao Xia 写道: 于 2013-5-2 20:02

Re: [Qemu-devel] [PATCH v3 7/8] blockdev: add Abort transaction

2013-05-15 Thread Wenchao Xia
Nice to have it for injecting error. Reviewed-by: Wenchao Xia xiaw...@linux.vnet.ibm.com -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH v3 5/8] blockdev: rename BlkTransactionStates to singular

2013-05-15 Thread Wenchao Xia
-by: Wenchao Xia xiaw...@linux.vnet.ibm.com -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH v3 1/8] block: add bdrv_add_before_write_cb()

2013-05-15 Thread Wenchao Xia
-growable = 0; QDECREF(bs-options); bs-options = NULL; +assert(QTAILQ_EMPTY(bs-before_write_cbs)); +QTAILQ_INIT(bs-before_write_cbs); INIT not needed if you assert before. Paolo -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH v3 2/8] block: add basic backup support to block driver

2013-05-15 Thread Wenchao Xia
Wenchao Xia

Re: [Qemu-devel] [PATCH V5 0/5] block: make qmp_transaction extendable

2013-05-14 Thread Wenchao Xia
于 2013-5-8 19:21, Kevin Wolf 写道: Am 08.05.2013 um 12:25 hat Wenchao Xia geschrieben: This serial will package backing chain snapshot code as one case, to make it possible adding more operations later. v2: Address Kevin's comments: Use the same prototype prepare, commit, rollback model

Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-05-14 Thread Wenchao Xia
于 2013-5-6 21:22, Luiz Capitulino 写道: On Mon, 06 May 2013 10:09:43 +0800 Wenchao Xia xiaw...@linux.vnet.ibm.com wrote: 于 2013-5-3 10:51, Wenchao Xia 写道: 于 2013-5-2 20:02, Luiz Capitulino 写道: On Thu, 02 May 2013 10:05:08 +0800 Wenchao Xia xiaw...@linux.vnet.ibm.com wrote: 于 2013-4-30 3:05

Re: [Qemu-devel] [PATCH v2 2/3] block: add block-backup QMP command

2013-05-13 Thread Wenchao Xia
will be also needed, which may be a bit complex needing serous plan. -- Best Regards Wenchao Xia

[Qemu-devel] [PATCH V5 0/5] block: make qmp_transaction extendable

2013-05-08 Thread Wenchao Xia
. v5: better commit message and comments, switch callback function name rollback to abort. Wenchao Xia (5): 1 block: package preparation code in qmp_transaction() 2 block: move input parsing code in qmp_transaction() 3 block: package committing code in qmp_transaction() 4 block: package

[Qemu-devel] [PATCH V5 3/5] block: package committing code in qmp_transaction()

2013-05-08 Thread Wenchao Xia
The code is simply moved into a separate function. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com --- blockdev.c | 19 --- 1 files changed

[Qemu-devel] [PATCH V5 5/5] block: make all steps in qmp_transaction() as callback

2013-05-08 Thread Wenchao Xia
Make it easier to add other operations to qmp_transaction() by using callbacks, with external snapshots serving as an example implementation of the callbacks. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com Reviewed-by: Stefan Hajnoczi stefa

[Qemu-devel] [PATCH V5 2/5] block: move input parsing code in qmp_transaction()

2013-05-08 Thread Wenchao Xia
The code is moved into preparation function, and changed a bit to tip more clearly what it is doing. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com

[Qemu-devel] [PATCH V5 4/5] block: package rollback code in qmp_transaction()

2013-05-08 Thread Wenchao Xia
Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com Reviewed-by: Stefan Hajnoczi stefa...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com --- blockdev.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/blockdev.c b

[Qemu-devel] [PATCH V5 1/5] block: package preparation code in qmp_transaction()

2013-05-08 Thread Wenchao Xia
The code before really committing is moved into a function. Most code is simply moved from qmp_transaction(), except that on fail it just returns now. Other code such as input parsing is not touched, to make it easier in review. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed

Re: [Qemu-devel] [PATCH V4 5/5] block: make all steps in qmp_transaction() as callback

2013-05-05 Thread Wenchao Xia
于 2013-5-3 22:46, Eric Blake 写道: On 05/01/2013 08:26 PM, Wenchao Xia wrote: Make it easier to add other operations to qmp_transaction() by using callbacks, with external snapshots serving as an example implementation of the callbacks. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com

Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-05-05 Thread Wenchao Xia
于 2013-5-3 10:51, Wenchao Xia 写道: 于 2013-5-2 20:02, Luiz Capitulino 写道: On Thu, 02 May 2013 10:05:08 +0800 Wenchao Xia xiaw...@linux.vnet.ibm.com wrote: 于 2013-4-30 3:05, Luiz Capitulino 写道: On Fri, 26 Apr 2013 16:46:57 +0200 Stefan Hajnoczi stefa...@gmail.com wrote: On Fri, Apr 26, 2013

Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-05-02 Thread Wenchao Xia
于 2013-5-2 20:02, Luiz Capitulino 写道: On Thu, 02 May 2013 10:05:08 +0800 Wenchao Xia xiaw...@linux.vnet.ibm.com wrote: 于 2013-4-30 3:05, Luiz Capitulino 写道: On Fri, 26 Apr 2013 16:46:57 +0200 Stefan Hajnoczi stefa...@gmail.com wrote: On Fri, Apr 26, 2013 at 05:31:15PM +0800, Wenchao Xia

Re: [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot()

2013-05-01 Thread Wenchao Xia
于 2013-5-1 2:16, Eric Blake 写道: On 04/26/2013 03:31 AM, Wenchao Xia wrote: To make it clear about id and name in searching, the API is changed a bit to distinguish them, and caller can choose to search by id or name. If not found, *errp will be set to tip why. Note that the caller logic

Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-05-01 Thread Wenchao Xia
于 2013-4-30 3:05, Luiz Capitulino 写道: On Fri, 26 Apr 2013 16:46:57 +0200 Stefan Hajnoczi stefa...@gmail.com wrote: On Fri, Apr 26, 2013 at 05:31:15PM +0800, Wenchao Xia wrote: @@ -2586,10 +2585,12 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict) } if (total 0

[Qemu-devel] [PATCH V4 0/5] block: make qmp_transaction extendable

2013-05-01 Thread Wenchao Xia
. Wenchao Xia (5): 1 block: package preparation code in qmp_transaction() 2 block: move input parsing code in qmp_transaction() 3 block: package committing code in qmp_transaction() 4 block: package rollback code in qmp_transaction() 5 block: make all steps in qmp_transaction() as callback

[Qemu-devel] [PATCH V4 3/5] block: package committing code in qmp_transaction()

2013-05-01 Thread Wenchao Xia
The code is simply moved into a separate function. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/blockdev.c b/blockdev.c index 06100d7..26bc78e 100644 --- a/blockdev.c +++ b

[Qemu-devel] [PATCH V4 1/5] block: package preparation code in qmp_transaction()

2013-05-01 Thread Wenchao Xia
The code before really committing is moved into a function. Most code are simply moved from qmp_transaction(), except that on fail it just return now. Other code such as input parsing is not touched, to make it easier in review. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com

[Qemu-devel] [PATCH V4 2/5] block: move input parsing code in qmp_transaction()

2013-05-01 Thread Wenchao Xia
The code is moved into preparation function, and changed a bit to tip more clearly what it is doing. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Eric Blake ebl...@redhat.com --- blockdev.c | 38 +++--- 1 files changed, 19 insertions(+), 19

[Qemu-devel] [PATCH V4 4/5] block: package rollback code in qmp_transaction()

2013-05-01 Thread Wenchao Xia
Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 26bc78e..77adec8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -882,6 +882,13 @@ static void external_snapshot_commit

[Qemu-devel] [PATCH V4 5/5] block: make all steps in qmp_transaction() as callback

2013-05-01 Thread Wenchao Xia
Make it easier to add other operations to qmp_transaction() by using callbacks, with external snapshots serving as an example implementation of the callbacks. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 92

[Qemu-devel] [PATCH 0/7] qapi and snapshot code clean up in block layer

2013-04-26 Thread Wenchao Xia
function to get rid of buffer, avoid string truncation. Note patch 2 and 3, 5 and 6 can be squashed. Sperating them to make review easier, since some code is already reviewed before. Stefan Hajnoczi (1): 1 block: drop bs_snapshots global variable Wenchao Xia (6): 2 block: move

[Qemu-devel] [PATCH 1/7] block: drop bs_snapshots global variable

2013-04-26 Thread Wenchao Xia
are always appended to the bdrv_states list. This means that calling the new find_vmstate_bs() function is idempotent - it returns the same BlockDriverState unless it was hot-unplugged. Signed-off-by: Stefan Hajnoczi stefa...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Wenchao Xia

[Qemu-devel] [PATCH 2/7] block: move bdrv_snapshot_find() to block/snapshot.c

2013-04-26 Thread Wenchao Xia
This patch adds block/snapshot.c and then moves the function there. It also fixes small code style errors reported by check script. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Kevin Wolf kw...@redhat.com --- block/Makefile.objs

[Qemu-devel] [PATCH 3/7] block: move snapshot code in block.c to block/snapshot.c

2013-04-26 Thread Wenchao Xia
All snapshot related code, except bdrv_snapshot_dump(), is moved to block/snapshot.c. bdrv_snapshot_dump() will be moved to another file later. It also fixes small code style errors reported by check script. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block.c

[Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot()

2013-04-26 Thread Wenchao Xia
and name matching. Savevm, loadvm logic may need to be improved later, to avoid mixing of them. Some code is borrowed from Pavel's patch. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Signed-off-by: Pavel Hrdina phrd...@redhat.com --- block/snapshot.c | 72

[Qemu-devel] [PATCH 6/7] block: move qmp and info dump related code to block/qapi.c

2013-04-26 Thread Wenchao Xia
array 'bdrv_states'. 4 code style fix. Now block.h and snapshot.h are at the same level in include path, block_int.h and qapi.h will both include them. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block.c | 185 - block/qapi.c

[Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-04-26 Thread Wenchao Xia
This patch introduce a new print function, which will output message to monitor when it present. With it, bdrv_snapshot_dump() need no more buffer and can avoid string truncation, bdrv_image_info_dump() can also be used by hmp code later, besides qemu-img code. Signed-off-by: Wenchao Xia xiaw

[Qemu-devel] [PATCH 5/7] block: move collect_snapshots() and collect_image_info() to block/qapi.c

2013-04-26 Thread Wenchao Xia
This patch adds block/qapi.c and moves the functions there. To avoid conflict and tip better, macro in header file is BLOCK_QAPI_H instead of QAPI_H. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Kevin Wolf kw...@redhat.com --- block

Re: [Qemu-devel] [PATCH 4/7] block: distinguish id and name in bdrv_find_snapshot()

2013-04-26 Thread Wenchao Xia
于 2013-4-26 22:34, Stefan Hajnoczi 写道: On Fri, Apr 26, 2013 at 05:31:12PM +0800, Wenchao Xia wrote: To make it clear about id and name in searching, the API is changed a bit to distinguish them, and caller can choose to search by id or name. If not found, *errp will be set to tip why. Note

Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-04-26 Thread Wenchao Xia
于 2013-4-26 22:46, Stefan Hajnoczi 写道: On Fri, Apr 26, 2013 at 05:31:15PM +0800, Wenchao Xia wrote: @@ -2586,10 +2585,12 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict) } if (total 0) { -monitor_printf(mon, %s\n, bdrv_snapshot_dump(buf, sizeof(buf), NULL

Re: [Qemu-devel] [PATCH 0/3] block: block-backup live backup command

2013-04-26 Thread Wenchao Xia
block devices. We need qmp_transaction() support for this. Wenchao Xia is currently making qmp_transaction() extensible so new action types, like block-backup, can be added. 2. Sync modes like drive-mirror (top, full, none). This makes it possible to preserve the backing file

Re: [Qemu-devel] [PATCH v2 03/12] savevm: update bdrv_snapshot_find() to find snapshot by id or name and add error parameter

2013-04-25 Thread Wenchao Xia
)) { available = 0; break; } -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH v2 04/12] qapi: Convert delvm

2013-04-25 Thread Wenchao Xia
-schema.json -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V3 5/5] block: make all steps in qmp_transaction() as callback

2013-04-25 Thread Wenchao Xia
于 2013-4-24 17:25, Stefan Hajnoczi 写道: On Fri, Apr 19, 2013 at 08:57:10AM +0800, Wenchao Xia wrote: diff --git a/blockdev.c b/blockdev.c index 051be98..b336794 100644 --- a/blockdev.c +++ b/blockdev.c @@ -779,14 +779,41 @@ void qmp_blockdev_snapshot_sync(const char *device, const char

Re: [Qemu-devel] [PATCH v2 03/12] savevm: update bdrv_snapshot_find() to find snapshot by id or name and add error parameter

2013-04-25 Thread Wenchao Xia
于 2013-4-25 20:16, Eric Blake 写道: On 04/25/2013 12:31 AM, Wenchao Xia wrote: + +if (!found) { +error_setg(errp, Failed to find snapshot '%s', name ? name : id); suggest not to set error, since it is a normal case. The way I understand it, failure to find a snapshot might

Re: [Qemu-devel] [PATCH v2 04/12] qapi: Convert delvm

2013-04-25 Thread Wenchao Xia
于 2013-4-25 20:21, Eric Blake 写道: On 04/25/2013 12:58 AM, Wenchao Xia wrote: +char buf[256]; I know this fixed-size buffer is just a copy-and-paste from other code that displays snapshot information, but I really hate it. On the other hand, I can tolerate if we have

Re: [Qemu-devel] [PATCH v2 01/12] qemu-img: introduce qemu_img_handle_error()

2013-04-24 Thread Wenchao Xia
instead of 0/1 is a bit nicer at expressing why we chose a positive value; but that would be a separate cleanup to all of qemu-img.c. Hence, I have no problems giving: Reviewed-by: Eric Blake ebl...@redhat.com Maybe an incode comments like: +/* Returns 1 on error. */ Reviewed-by: Wenchao Xia xiaw

Re: [Qemu-devel] [PATCH v2 02/12] block: update error reporting for bdrv_snapshot_delete() and related functions

2013-04-24 Thread Wenchao Xia
bdrv_snapshot_delete() do not return error number now, and I checked original caller code, they used it only for error reporting, so it is safe to change. Reviewed-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Signed-off-by: Pavel Hrdina phrd...@redhat.com --- block.c | 21

Re: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find()

2013-04-23 Thread Wenchao Xia
is ready. If you agree, I will use your logic in my bdrv_snapshot_find() to progress. But still, if you can upstream your version quickly, or form a clean patch for this function, I am happy to rebase on it.: -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V12 00/18] qmp/hmp interfaces for internal snapshot info

2013-04-21 Thread Wenchao Xia
value in caller qemu-img. Address Stefan's comments: 10/18: added doc about the meaning of consistent snapshot in qmp-commands.hx. Address Kevin's comments: 12/18: use local_error to detect error in qmp_query_snapshots(), in case caller set errp = NULL. Wenchao Xia (18

Re: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find()

2013-04-18 Thread Wenchao Xia
they are and relationship. From caller, I think and is better, and taking two parameter in one function make caller easier to use, in most case. I'd like a clean serial go for it, hope to know Pavel and Markus's idea. -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find()

2013-04-18 Thread Wenchao Xia
于 2013-4-18 18:22, Pavel Hrdina 写道: On 18.4.2013 06:31, Wenchao Xia wrote: 于 2013-4-18 2:14, Eric Blake 写道: On 04/17/2013 04:51 AM, Pavel Hrdina wrote: On 17.4.2013 12:19, Wenchao Xia wrote: 于 2013-4-17 15:52, Pavel Hrdina 写道: Hi Wenchao, unfortunately no. According to new design of savevm

[Qemu-devel] [PATCH V3 0/5] block: make qmp_transaction extendable

2013-04-18 Thread Wenchao Xia
commit message and comments in code that only one of rollback() or commit() will be called. Wenchao Xia (5): 1 block: package preparation code in qmp_transaction() 2 block: move input parsing code in qmp_transaction() 3 block: package committing code in qmp_transaction() 4 block: package

[Qemu-devel] [PATCH V3 2/5] block: move input parsing code in qmp_transaction()

2013-04-18 Thread Wenchao Xia
The code is moved into preparation function, and changed a bit to tip more clearly what it is doing. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Eric Blake ebl...@redhat.com --- blockdev.c | 38 +++--- 1 files changed, 19 insertions(+), 19

[Qemu-devel] [PATCH V3 1/5] block: package preparation code in qmp_transaction()

2013-04-18 Thread Wenchao Xia
The code before really committing is moved into a function. Most code are simply moved from qmp_transaction(), except that on fail it just return now. Other code such as input parsing is not touched, to make it easier in review. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com

[Qemu-devel] [PATCH V3 3/5] block: package committing code in qmp_transaction()

2013-04-18 Thread Wenchao Xia
The code is simply moved into a separate function. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/blockdev.c b/blockdev.c index 89521bb..275c6f9 100644 --- a/blockdev.c +++ b

[Qemu-devel] [PATCH V3 5/5] block: make all steps in qmp_transaction() as callback

2013-04-18 Thread Wenchao Xia
Make it easier to add other operations to qmp_transaction() by using callbacks, with external snapshots serving as an example implementation of the callbacks. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 84

[Qemu-devel] [PATCH V3 4/5] block: package rollback code in qmp_transaction()

2013-04-18 Thread Wenchao Xia
Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 275c6f9..051be98 100644 --- a/blockdev.c +++ b/blockdev.c @@ -882,6 +882,13 @@ static void external_snapshot_commit

Re: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find()

2013-04-17 Thread Wenchao Xia
On 17.4.2013 04:53, Wenchao Xia wrote: Hi, Pavel I have implemented it at http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg02533.html in patch 1,2. Could u check if it satisfy your requirement, if yes maybe you can directly use them. Signed-off-by: Pavel Hrdina phrd...@redhat.com

Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable

2013-04-17 Thread Wenchao Xia
于 2013-4-17 22:42, Stefan Hajnoczi 写道: On Mon, Apr 01, 2013 at 06:01:30PM +0800, Wenchao Xia wrote: /* New and old BlockDriverState structs for group snapshots */ -typedef struct BlkTransactionStates { +typedef struct BdrvActionOps { +int (*commit)(BlockdevAction *action, void **p_opaque

Re: [Qemu-devel] [PATCH V12 06/18] block: add check for VM snapshot in bdrv_query_snapshot_info_list()

2013-04-17 Thread Wenchao Xia
于 2013-4-18 4:52, Eric Blake 写道: On 04/13/2013 02:56 AM, Wenchao Xia wrote: This patch adds a parameter to tell whether return valid snapshots for whole VM only. Note that the snapshot check logic is copied from do_info_snapshots(), which is different with load_vmstate

Re: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find()

2013-04-17 Thread Wenchao Xia
于 2013-4-18 2:14, Eric Blake 写道: On 04/17/2013 04:51 AM, Pavel Hrdina wrote: On 17.4.2013 12:19, Wenchao Xia wrote: 于 2013-4-17 15:52, Pavel Hrdina 写道: Hi Wenchao, unfortunately no. According to new design of savevm, loadvm and delvm I need also search for snapshots that have the specified

Re: [Qemu-devel] [PATCH v4 00/11] convert savevm to use qapi and introduce qmp command

2013-04-16 Thread Wenchao Xia
. HMP delvm: - args_type = name:s?,id:i? - same rules as loadvm Same comment as for loadvm. -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find()

2013-04-16 Thread Wenchao Xia
)) { +if (!bdrv_snapshot_find(bs1, sn_info, sn-name, sn-id_str)) { available = 0; break; } -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V2 5/5] block: make all steps in qmp_transaction() as callback

2013-04-16 Thread Wenchao Xia
于 2013-4-16 21:52, Kevin Wolf 写道: Am 13.04.2013 um 13:11 hat Wenchao Xia geschrieben: Now qmp_transaction() can be extended with other operation, external snapshot or backing chain creation, is just one case it. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 68

Re: [Qemu-devel] [PATCH V12 14/18] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-04-16 Thread Wenchao Xia
于 2013-4-17 7:42, Eric Blake 写道: On 04/13/2013 02:56 AM, Wenchao Xia wrote: This patch introduce a new print function, which will output message to monitor when it present. With it, bdrv_snapshot_dump() need no more buffer and can avoid string truncation, bdrv_image_info_dump() can also

[Qemu-devel] [PATCH V12 00/18] qmp/hmp interfaces for internal snapshot info

2013-04-13 Thread Wenchao Xia
snapshot in qmp-commands.hx. Address Kevin's comments: 12/18: use local_error to detect error in qmp_query_snapshots(), in case caller set errp = NULL. Wenchao Xia (18): 1 block: move bdrv_snapshot_find() to block/snapshot.c 2 block: distinguish id and name in bdrv_find_snapshot() 3 qemu-img

[Qemu-devel] [PATCH V12 03/18] qemu-img: remove unused parameter in collect_image_info()

2013-04-13 Thread Wenchao Xia
Parameter *fmt was not used, so remove it. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Kevin Wolf kw...@redhat.com --- qemu-img.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu

[Qemu-devel] [PATCH V12 04/18] block: move collect_snapshots() and collect_image_info() to block/qapi.c

2013-04-13 Thread Wenchao Xia
This patch adds block/qapi.c and moves the functions there. To avoid conflict and tip better, macro in header file is BLOCK_QAPI_H instead of QAPI_H. The moving is for making review easier, those functions will be modified and renamed later. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com

[Qemu-devel] [PATCH V12 09/18] block: move qmp_query_block() and bdrv_query_info() to block/qapi.c

2013-04-13 Thread Wenchao Xia
This is a code move patch, except in qmp_query_block bdrv_next(bs) is used instead of direct traverse of global array 'bdrv_states'. This patch also fix code style error reported by check script. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com

[Qemu-devel] [PATCH V12 08/18] block: add image info query function bdrv_query_image_info()

2013-04-13 Thread Wenchao Xia
This patch adds function bdrv_query_image_info(), which will retrieve image info in qmp object format. The implementation is based on the code moved from qemu-img.c, but uses block layer function to get snapshot info. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qapi.c

[Qemu-devel] [PATCH V12 05/18] block: add snapshot info query function bdrv_query_snapshot_info_list()

2013-04-13 Thread Wenchao Xia
This patch adds function bdrv_query_snapshot_info_list(), which will retrieve snapshot info of an image in qmp object format. The implementation is based on the code moved from qemu-img.c with modification to fit more for qmp based block layer API. Signed-off-by: Wenchao Xia xiaw

[Qemu-devel] [PATCH V12 06/18] block: add check for VM snapshot in bdrv_query_snapshot_info_list()

2013-04-13 Thread Wenchao Xia
This patch adds a parameter to tell whether return valid snapshots for whole VM only. Note that the snapshot check logic is copied from do_info_snapshots(), which is different with load_vmstate() and will be changed in next patch. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed

[Qemu-devel] [PATCH V12 13/18] block: move bdrv_snapshot_dump() and dump_human_image_info() to block/qapi.c

2013-04-13 Thread Wenchao Xia
They are needed later in hmp command, dump_human_image_info() is renamed to bdrv_image_info_dump(). Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com --- block.c | 33 block/qapi.c | 100

[Qemu-devel] [PATCH V12 07/18] block: change VM snapshot checking logic

2013-04-13 Thread Wenchao Xia
, and this patch clearly tips it. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qapi.c | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index 97c5cd4..49c0eb0 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -46,7 +46,18

[Qemu-devel] [PATCH V12 12/18] qmp: add ImageInfo in BlockDeviceInfo used by query-block

2013-04-13 Thread Wenchao Xia
Now image info will be retrieved as an embbed json object inside BlockDeviceInfo, backing chain info and all related internal snapshot info can be got in the enhanced recursive structure of ImageInfo. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qapi.c | 40

[Qemu-devel] [PATCH V12 14/18] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-04-13 Thread Wenchao Xia
This patch introduce a new print function, which will output message to monitor when it present. With it, bdrv_snapshot_dump() need no more buffer and can avoid string truncation, bdrv_image_info_dump() can also be used by hmp code later, besides qemu-img code. Signed-off-by: Wenchao Xia xiaw

[Qemu-devel] [PATCH V12 11/18] qmp: add recursive member in ImageInfo

2013-04-13 Thread Wenchao Xia
New member *backing-image is added to reflect the backing chain status. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qapi.c | 18 +- qapi-schema.json |5 - 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/block/qapi.c b/block

[Qemu-devel] [PATCH V12 01/18] block: move bdrv_snapshot_find() to block/snapshot.c

2013-04-13 Thread Wenchao Xia
This patch adds block/snapshot.c and then moves the function there. It also fixes small code style errors reported by check script. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Kevin Wolf kw...@redhat.com --- block/Makefile.objs

[Qemu-devel] [PATCH V12 15/18] hmp: add function hmp_info_snapshots()

2013-04-13 Thread Wenchao Xia
the qmp object got to strings in stdout or monitor console. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- hmp.c | 44 hmp.h |1 + 2 files changed, 45 insertions(+), 0 deletions(-) diff --git a/hmp.c b/hmp.c index dbe9b90..cef5eee

[Qemu-devel] [PATCH V12 17/18] hmp: show ImageInfo in 'info block'

2013-04-13 Thread Wenchao Xia
Now human monitor can show image details, include internal snapshot and backing chain info for every block device. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- hmp.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hmp.c b/hmp.c index cef5eee

[Qemu-devel] [PATCH V12 16/18] hmp: switch snapshot info function to qmp based one

2013-04-13 Thread Wenchao Xia
This patch using new added function in last commit which retrieve info from qmp for snapshot info. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com --- monitor.c |2 +- savevm.c | 65

[Qemu-devel] [PATCH V12 18/18] hmp: add parameters device and -v for info block

2013-04-13 Thread Wenchao Xia
With these parameters, user can choose the information to be showed, to avoid message flood in the monitor. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com --- hmp.c | 23 +++ monitor.c |7 --- 2 files changed, 19

[Qemu-devel] [PATCH V12 10/18] qmp: add interface query-snapshots

2013-04-13 Thread Wenchao Xia
This interface returns info of valid internal snapshots for whole vm. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qapi.c | 17 +++ qapi-schema.json | 14 + qmp-commands.hx | 58 ++ 3

[Qemu-devel] [PATCH V12 02/18] block: distinguish id and name in bdrv_find_snapshot()

2013-04-13 Thread Wenchao Xia
if there are unwisely chosen name mixed with id. In do_info_snapshots(), the caller is changed to search id only, which should be the correct behavior. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/snapshot.c | 46 ++ include

[Qemu-devel] [PATCH V2 0/5] block: make qmp_transaction extendable

2013-04-13 Thread Wenchao Xia
This serial will package backing chain snapshot code as one case, to make it possible adding more operations later. v2: Address Kevin's comments: Use the same prototype prepare, commit, rollback model in original code, commit should never fail. Wenchao Xia (5): block: package preparation

[Qemu-devel] [PATCH V2 5/5] block: make all steps in qmp_transaction() as callback

2013-04-13 Thread Wenchao Xia
Now qmp_transaction() can be extended with other operation, external snapshot or backing chain creation, is just one case it. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 68 +++ 1 files changed, 58 insertions

[Qemu-devel] [PATCH V2 1/5] block: package preparation code in qmp_transaction()

2013-04-13 Thread Wenchao Xia
The code before really committing is moved into a function. Most code are simply moved from qmp_transaction()i, except fail handling label is changed from delete_and_fail to fail. Other code such as input parsing is not touched, to make it easier in review. Signed-off-by: Wenchao Xia xiaw

[Qemu-devel] [PATCH V2 2/5] block: move input parsing code in qmp_transaction()

2013-04-13 Thread Wenchao Xia
The code is moved into preparation function, and is changed a bit to tip more clearly what it is doing. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 38 +++--- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git

[Qemu-devel] [PATCH V2 4/5] block: package rolling back code in qmp_transaction()

2013-04-13 Thread Wenchao Xia
Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 38cb7d5..3e69569 100644 --- a/blockdev.c +++ b/blockdev.c @@ -889,6 +889,14 @@ static void

[Qemu-devel] [PATCH V2 3/5] block: package committing code in qmp_transaction()

2013-04-13 Thread Wenchao Xia
The code is simply moved into a separate function. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- blockdev.c | 20 +--- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/blockdev.c b/blockdev.c index 8d1faf8..38cb7d5 100644 --- a/blockdev.c +++ b

Re: [Qemu-devel] [PATCH V11 09/17] qmp: add interface query-snapshots

2013-04-12 Thread Wenchao Xia
于 2013-4-12 11:22, Eric Blake 写道: On 04/11/2013 09:17 PM, Wenchao Xia wrote: Hmm, as I typed that, I did another search of qemu-schema.json - we have the type 'ImageInfo' defined, but none of the existing 'command's ever call out the use of that type. Is it a type we are only using

Re: [Qemu-devel] [PATCH V11 07/17] block: add image info query function bdrv_query_image_info()

2013-04-11 Thread Wenchao Xia
于 2013-4-10 23:28, Markus Armbruster 写道: Wenchao Xia xiaw...@linux.vnet.ibm.com writes: This patch adds function bdrv_query_image_info(), which will retrieve image info in qmp object format. The implementation is based on the code moved from qemu-img.c, but uses block layer function

Re: [Qemu-devel] [PATCH V11 09/17] qmp: add interface query-snapshots

2013-04-11 Thread Wenchao Xia
-- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V11 10/17] qmp: add recursive member in ImageInfo

2013-04-11 Thread Wenchao Xia
于 2013-4-11 0:06, Markus Armbruster 写道: Wenchao Xia xiaw...@linux.vnet.ibm.com writes: New member *backing-image is added to reflect the backing chain status. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com Reviewed-by: Kevin Wolf kw...@redhat.com Reviewed-by: Eric Blake ebl

Re: [Qemu-devel] [PATCH V11 11/17] qmp: add ImageInfo in BlockDeviceInfo used by query-block

2013-04-11 Thread Wenchao Xia
Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V11 11/17] qmp: add ImageInfo in BlockDeviceInfo used by query-block

2013-04-11 Thread Wenchao Xia
于 2013-4-11 2:57, Luiz Capitulino 写道: On Wed, 10 Apr 2013 18:17:04 +0200 Markus Armbruster arm...@redhat.com wrote: Stefan Hajnoczi stefa...@gmail.com writes: On Tue, Apr 02, 2013 at 07:47:24PM +0800, Wenchao Xia wrote: diff --git a/qmp-commands.hx b/qmp-commands.hx index 6b20684..b856be7

Re: [Qemu-devel] [PATCH V11 12/17] block: move bdrv_snapshot_dump() and dump_human_image_info() to block/qapi.c

2013-04-11 Thread Wenchao Xia
于 2013-4-11 0:49, Markus Armbruster 写道: Wenchao Xia xiaw...@linux.vnet.ibm.com writes: They are needed later in hmp command, dump_human_image_info() is renamed to bdrv_image_info_dump(). Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com I'd be tempted move everything that needs

Re: [Qemu-devel] [PATCH V11 13/17] block: dump to buffer for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-04-11 Thread Wenchao Xia
; int total; int *available_snapshots; -char buf[256]; +GString *buf = NULL; Useless initialization. But if you keep bdrv_snapshot_dump() printing, it all goes away. will remove. -- Best Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V11 09/17] qmp: add interface query-snapshots

2013-04-11 Thread Wenchao Xia
Regards Wenchao Xia

Re: [Qemu-devel] [PATCH V11 11/17] qmp: add ImageInfo in BlockDeviceInfo used by query-block

2013-04-11 Thread Wenchao Xia
于 2013-4-11 17:31, Markus Armbruster 写道: Wenchao Xia xiaw...@linux.vnet.ibm.com writes: 于 2013-4-11 2:57, Luiz Capitulino 写道: On Wed, 10 Apr 2013 18:17:04 +0200 Markus Armbruster arm...@redhat.com wrote: Stefan Hajnoczi stefa...@gmail.com writes: On Tue, Apr 02, 2013 at 07:47:24PM +0800

Re: [Qemu-devel] [PATCH V11 13/17] block: dump to buffer for bdrv_snapshot_dump() and bdrv_image_info_dump()

2013-04-11 Thread Wenchao Xia
于 2013-4-11 20:05, Markus Armbruster 写道: Wenchao Xia xiaw...@linux.vnet.ibm.com writes: -void bdrv_image_info_dump(ImageInfo *info) +void bdrv_image_info_dump(GString *buf, ImageInfo *info) { char size_buf[128], dsize_buf[128]; if (!info-has_actual_size) { @@ -370,43

Re: [Qemu-devel] [PATCH V11 11/17] qmp: add ImageInfo in BlockDeviceInfo used by query-block

2013-04-10 Thread Wenchao Xia
于 2013-4-8 21:33, Stefan Hajnoczi 写道: On Tue, Apr 02, 2013 at 07:47:24PM +0800, Wenchao Xia wrote: diff --git a/qmp-commands.hx b/qmp-commands.hx index 6b20684..b856be7 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1703,6 +1703,47 @@ Each json-object contain the following

<    6   7   8   9   10   11   12   13   14   15   >