• E
    snapshot: add support for qemu transaction command · 64d5e815
    Eric Blake 提交于
    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":
          { "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.
    
    * src/qemu/qemu_monitor_json.c (qemuMonitorJSONMakeCommand): Move
    guts...
    (qemuMonitorJSONMakeCommandRaw): ...into new helper.  Add support
    for array element.
    (qemuMonitorJSONTransaction): New command.
    (qemuMonitorJSONDiskSnapshot): Support use in a transaction.
    * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDiskSnapshot): Add
    argument.
    (qemuMonitorJSONTransaction): New declaration.
    * src/qemu/qemu_monitor.h (qemuMonitorTransaction): Likewise.
    (qemuMonitorDiskSnapshot): Add argument.
    * src/qemu/qemu_monitor.c (qemuMonitorTransaction): New wrapper.
    (qemuMonitorDiskSnapshot): Pass argument on.
    * src/qemu/qemu_driver.c
    (qemuDomainSnapshotCreateSingleDiskActive): Update caller.
    64d5e815
qemu_driver.c 400.9 KB