qapi: Introduce blockdev-group-snapshot-sync command
This is a QAPI/QMP only command to take a snapshot of a group of devices. This is similar to the blockdev-snapshot-sync command, except blockdev-group-snapshot-sync accepts a list devices, filenames, and formats. It is attempted to keep the snapshot of the group atomic; if the creation or open of any of the new snapshots fails, then all of the new snapshots are abandoned, and the name of the snapshot image that failed is returned. The failure case should not interrupt any operations. Rather than use bdrv_close() along with a subsequent bdrv_open() to perform the pivot, the original image is never closed and the new image is placed 'in front' of the original image via manipulation of the BlockDriverState fields. Thus, once the new snapshot image has been successfully created, there are no more failure points before pivoting to the new snapshot. This allows the group of disks to remain consistent with each other, even across snapshot failures. Signed-off-by: Jeff Cody <jcody@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
64ca6aee4f
commit
8802d1fdd4
5 changed files with 257 additions and 0 deletions
|
|
@ -1117,6 +1117,44 @@
|
|||
##
|
||||
{ 'command': 'block_resize', 'data': { 'device': 'str', 'size': 'int' }}
|
||||
|
||||
##
|
||||
# @SnapshotDev
|
||||
#
|
||||
# @device: the name of the device to generate the snapshot from.
|
||||
#
|
||||
# @snapshot-file: the target of the new image. A new file will be created.
|
||||
#
|
||||
# @format: #optional the format of the snapshot image, default is 'qcow2'.
|
||||
##
|
||||
{ 'type': 'SnapshotDev',
|
||||
'data': {'device': 'str', 'snapshot-file': 'str', '*format': 'str' } }
|
||||
|
||||
##
|
||||
# @blockdev-group-snapshot-sync
|
||||
#
|
||||
# Generates a synchronous snapshot of a group of one or more block devices,
|
||||
# as atomically as possible. If the snapshot of any device in the group
|
||||
# fails, then the entire group snapshot will be abandoned and the
|
||||
# appropriate error returned.
|
||||
#
|
||||
# List of:
|
||||
# @SnapshotDev: information needed for the device snapshot
|
||||
#
|
||||
# Returns: nothing on success
|
||||
# If @device is not a valid block device, DeviceNotFound
|
||||
# If @device is busy, DeviceInUse will be returned
|
||||
# If @snapshot-file can't be created, OpenFileFailed
|
||||
# If @snapshot-file can't be opened, OpenFileFailed
|
||||
# If @format is invalid, InvalidBlockFormat
|
||||
#
|
||||
# Note: The group snapshot attempt returns failure on the first snapshot
|
||||
# device failure. Therefore, there will be only one device or snapshot file
|
||||
# returned in an error condition, and subsequent devices will not have been
|
||||
# attempted.
|
||||
##
|
||||
{ 'command': 'blockdev-group-snapshot-sync',
|
||||
'data': { 'devlist': [ 'SnapshotDev' ] } }
|
||||
|
||||
##
|
||||
# @blockdev-snapshot-sync
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue