Features/SnapshotsMultipleDevices/CommandSetProposals

From QEMU

Two different patch series posted on the mailing list sparked a discussion on block device operations (snapshotting, enabling mirroring, switching to a different image) that have to be performed atomically.

This page documents the four approaches that were discussed.

Jeff Cody

{ 'type': 'SnapshotDev',
  'data': {'device': 'str', 'snapshot-file': 'str', '*format': 'str' } }
{ 'command': 'blkdev-group-snapshot-sync',
  'data': { 'devlist':  [ 'SnapshotDev' ] } }

A single command prepares snapshots for many devices and commits the transaction if all snapshots are successfully prepared.

Advantages
Patches are almost ready for inclusion. Simple interface with only one command.
Disadvantages
No support for reopening and mirroring. Introducing them later is possible, but needs to be done before 1.1 in case API changes are needed.
Improved error handling does not extend to the existing blockdev-snapshot-sync command.

Federico Simoncelli

{ 'drive-reopen',
  'data': { 'device': 'str', 'source': 'str', '*format': 'str' } }
{ 'drive-migrate',
  'data': { 'device': 'str', 'dest': 'str', '*dest-format': 'str',
            'new-source': 'str', '*source-format': 'str' } }
Advantages
Patches on the mailing list.
Disavantages
Complicated interface tailored only on the oVirt usecase (Paolo tried to shoehorn other cases in the same drive-migrate command, but with little success). Doesn't extend to mirroring multiple devices.

Paolo Bonzini

{ 'command' : 'blockdev-start-transaction' }
{ 'command' : 'blockdev-commit-transaction' }
{ 'command' : 'blockdev-abort-transaction' }
{ 'command' : 'drive-reopen',
  'data': { 'device': 'str', 'source': 'str', '*format': 'str' } }
{ 'command' : drive-mirror,
  'data': { 'device': 'str', 'dest': 'str', '*format': 'str' } }
Advantages
Uniform handling of all cases. oVirt usecase falls out nicely. Improved error handling extends to the existing blockdev-snapshot-sync command.
Disadvantages
Requires changes to Jeff's patches. Core infrastructure changes needed for transactions (though most of the algorithms are already found in Jeff's patches).

The existing blockdev-snapshot-sync command would need changes to support invocations in a transaction.

Anthony Liguori

{ 'command' : 'blockdev-freeze',
  'data': { 'device': 'str' } }
{ 'command' : 'blockdev-unfreeze',
  'data': { 'device': 'str' } }
{ 'command' : 'drive-reopen',
  'data': { 'device': 'str', 'source': 'str', '*format': 'str' } }
{ 'command' : drive-mirror,
  'data': { 'device': 'str', 'dest': 'str', '*format': 'str' } }
Advantages
Poses fewest problems in adding new kinds of operations. oVirt usecase falls out nicely. Subsumes group snapshots too, but management would have to provide its own error handling.
Disadvantages
Requires changes to Jeff's patches. Management probably cannot provide the improvements in error handling provided by Jeff's patches. Core infrastructure changes needed for freeze/unfreeze.