These patch added a seperated layer to take internal or external snapshots in a unified way, the granularity is block device, so other functions can just combine the request and submit, such as group snapshot, savevm.
Total goal are: Live back up vm in external or internal image, which need three functions: 1 live snapshot block device internal/external. 2 live save vmstate internal/external. 3 combination of the function unit. This serial provide part one. v2: 1) seperate patches for bdrv_deappend() and bdrv_snapshot_find(). 2) use error set function which will keep first error instead of replacing a existing error. 3) use qemu_timespec for snapshot timestamp, added a lock in localtime_r() on windows and use it for timestamp. 4) remove space in comments and use present tense. 5) remove member async in BlkTransactionStates and async related structure, which is not supported now. 6) remove snapshot delete function. 7) remove snapshot info function. 8) redesign qmp interface, new interface is added instead of using parameter to distinguish internal case in old external interface. 9) renamed parameter in hmp interface, and better tips for it. 10) patches are splitted to more smaller ones. 11) code adjust according to comments. Wenchao Xia (10): block: export function bdrv_find_snapshot() block: add function deappend() error: add function error_set_check() oslib-win32: add lock for time functions snapshot: design of internal common API to take snapshots snapshot: implemention of internal common API to take snapshots snapshot: qmp use new internal API for external snapshot transaction snapshot: qmp add internal snapshot transaction interface snapshot: qmp add blockdev-snapshot-internal-sync interface snapshot: hmp add internal snapshot support for block device block.c | 44 +++ blockdev.c | 753 +++++++++++++++++++++++++++++++++++++-------- error.c | 19 ++ hmp-commands.hx | 28 +- hmp.c | 25 +- include/block/block.h | 3 + include/qapi/error.h | 5 + include/sysemu/blockdev.h | 119 +++++++ oslib-win32.c | 12 +- qapi-schema.json | 50 +++- qmp-commands.hx | 52 +++- savevm.c | 22 -- 12 files changed, 954 insertions(+), 178 deletions(-)