[libvirt] [PATCH 1/2] snapshot: add support for qemu transaction command
Peter Krempa
pkrempa at redhat.com
Thu Mar 22 14:13:13 UTC 2012
On 03/17/2012 10:27 PM, Eric Blake wrote:
> QEmu 1.1 is adding a 'transaction' command to the JSON monitor.
> Each element of a transaction corresponds to a top-level command,
> with the additional guarantee that the transaction flushes all
> pending I/O, then guarantees that all actions will be successful
> as a group or that failure will roll back the state to what it
> was before the monitor command. The difference between a
> top-level command:
>
> { "execute": "blockdev-snapshot-sync", "arguments":
> { "device": "virtio0", ... } }
>
> and a transaction:
>
> { "execute": "transaction", "arguments":
> { "actions": [
> { "type" "blockdev-snapshot-sync", "data":
Shouldn't there be a colon between "type" and "block...."?
> { "device": "virtio0", ... } } ] } }
>
> is just a couple of changed key names and nesting the shorter
> command inside a JSON array to the longer command. This patch
> just adds the framework; the next patch will actually use a
> transaction.
>
>
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 4dd6924..ba07e84 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -383,7 +384,8 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
> if (!(obj = virJSONValueNewObject()))
> goto no_memory;
>
> - if (virJSONValueObjectAppendString(obj, "execute", cmdname)< 0)
> + if (virJSONValueObjectAppendString(obj, wrap ? "type" : "execute",
> + cmdname)< 0)
> goto no_memory;
Hopefuly QEmu won't add another wrapping type.
>
> while ((key = va_arg(args, char *)) != NULL) {
ACK,
Peter
More information about the libvir-list
mailing list