qapi: deprecate drive-backup

Modern way is using blockdev-add + blockdev-backup, which provides a
lot more control on how target is opened.

As example of drive-backup problems consider the following:

User of drive-backup expects that target will be opened in the same
cache and aio mode as source. Corresponding logic is in
drive_backup_prepare(), where we take bs->open_flags of source.

It works rather bad if source was added by blockdev-add. Assume source
is qcow2 image. On blockdev-add we should specify aio and cache options
for file child of qcow2 node. What happens next:

drive_backup_prepare() looks at bs->open_flags of qcow2 source node.
But there no BDRV_O_NOCAHE neither BDRV_O_NATIVE_AIO: BDRV_O_NOCAHE is
places in bs->file->bs->open_flags, and BDRV_O_NATIVE_AIO is nowhere,
as file-posix parse options and simply set s->use_linux_aio.

The documentation is updated in a minimal way, so that drive-backup is
noted only as a deprecated command, and blockdev-backup used in most of
places.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2021-11-04 09:58:11 +01:00
parent 24d6cc1fa1
commit 1084159b31
4 changed files with 51 additions and 18 deletions

View File

@ -239,6 +239,17 @@ single ``bitmap``, the new ``block-export-add`` uses a list of ``bitmaps``.
Member ``values`` in return value elements with meta-type ``enum`` is Member ``values`` in return value elements with meta-type ``enum`` is
deprecated. Use ``members`` instead. deprecated. Use ``members`` instead.
``drive-backup`` (since 6.2)
''''''''''''''''''''''''''''
Use ``blockdev-backup`` in combination with ``blockdev-add`` instead.
This change primarily separates the creation/opening process of the backup
target with explicit, separate steps. ``blockdev-backup`` uses mostly the
same arguments as ``drive-backup``, except the ``format`` and ``mode``
options are removed in favor of using explicit ``blockdev-create`` and
``blockdev-add`` calls. See :doc:`/interop/live-block-operations` for
details.
System accelerators System accelerators
------------------- -------------------

View File

@ -116,8 +116,8 @@ QEMU block layer supports.
(3) ``drive-mirror`` (and ``blockdev-mirror``): Synchronize a running (3) ``drive-mirror`` (and ``blockdev-mirror``): Synchronize a running
disk to another image. disk to another image.
(4) ``drive-backup`` (and ``blockdev-backup``): Point-in-time (live) copy (4) ``blockdev-backup`` (and the deprecated ``drive-backup``):
of a block device to a destination. Point-in-time (live) copy of a block device to a destination.
.. _`Interacting with a QEMU instance`: .. _`Interacting with a QEMU instance`:
@ -555,13 +555,14 @@ Currently, there are four different kinds:
(3) ``none`` -- Synchronize only the new writes from this point on. (3) ``none`` -- Synchronize only the new writes from this point on.
.. note:: In the case of ``drive-backup`` (or ``blockdev-backup``), .. note:: In the case of ``blockdev-backup`` (or deprecated
the behavior of ``none`` synchronization mode is different. ``drive-backup``), the behavior of ``none``
Normally, a ``backup`` job consists of two parts: Anything synchronization mode is different. Normally, a
that is overwritten by the guest is first copied out to ``backup`` job consists of two parts: Anything that is
the backup, and in the background the whole image is overwritten by the guest is first copied out to the
copied from start to end. With ``sync=none``, it's only backup, and in the background the whole image is copied
the first part. from start to end. With ``sync=none``, it's only the
first part.
(4) ``incremental`` -- Synchronize content that is described by the (4) ``incremental`` -- Synchronize content that is described by the
dirty bitmap dirty bitmap
@ -928,19 +929,22 @@ Shutdown the guest, by issuing the ``quit`` QMP command::
} }
Live disk backup --- ``drive-backup`` and ``blockdev-backup`` Live disk backup --- ``blockdev-backup`` and the deprecated``drive-backup``
------------------------------------------------------------- ---------------------------------------------------------------------------
The ``drive-backup`` (and its newer equivalent ``blockdev-backup``) allows The ``blockdev-backup`` (and the deprecated ``drive-backup``) allows
you to create a point-in-time snapshot. you to create a point-in-time snapshot.
In this case, the point-in-time is when you *start* the ``drive-backup`` In this case, the point-in-time is when you *start* the
(or its newer equivalent ``blockdev-backup``) command. ``blockdev-backup`` (or deprecated ``drive-backup``) command.
QMP invocation for ``drive-backup`` QMP invocation for ``drive-backup``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that ``drive-backup`` command is deprecated since QEMU 6.2 and
will be removed in future.
Yet again, starting afresh with our example disk image chain:: Yet again, starting afresh with our example disk image chain::
[A] <-- [B] <-- [C] <-- [D] [A] <-- [B] <-- [C] <-- [D]
@ -965,11 +969,22 @@ will be issued, indicating the live block device job operation has
completed, and no further action is required. completed, and no further action is required.
Moving from the deprecated ``drive-backup`` to newer ``blockdev-backup``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``blockdev-backup`` differs from ``drive-backup`` in how you specify
the backup target. With ``blockdev-backup`` you can't specify filename
as a target. Instead you use ``node-name`` of existing block node,
which you may add by ``blockdev-add`` or ``blockdev-create`` commands.
Correspondingly, ``blockdev-backup`` doesn't have ``mode`` and
``format`` arguments which don't apply to an existing block node. See
following sections for details and examples.
Notes on ``blockdev-backup`` Notes on ``blockdev-backup``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``blockdev-backup`` command is equivalent in functionality to The ``blockdev-backup`` command operates at node-level in a Block Driver
``drive-backup``, except that it operates at node-level in a Block Driver
State (BDS) graph. State (BDS) graph.
E.g. the sequence of actions to create a point-in-time backup E.g. the sequence of actions to create a point-in-time backup

View File

@ -1709,6 +1709,9 @@
# The operation can be stopped before it has completed using the # The operation can be stopped before it has completed using the
# block-job-cancel command. # block-job-cancel command.
# #
# Features:
# @deprecated: This command is deprecated. Use @blockdev-backup instead.
#
# Returns: - nothing on success # Returns: - nothing on success
# - If @device is not a valid block device, GenericError # - If @device is not a valid block device, GenericError
# #
@ -1724,7 +1727,7 @@
# #
## ##
{ 'command': 'drive-backup', 'boxed': true, { 'command': 'drive-backup', 'boxed': true,
'data': 'DriveBackup' } 'data': 'DriveBackup', 'features': ['deprecated'] }
## ##
# @blockdev-backup: # @blockdev-backup:

View File

@ -54,6 +54,10 @@
# @blockdev-snapshot-sync: since 1.1 # @blockdev-snapshot-sync: since 1.1
# @drive-backup: Since 1.6 # @drive-backup: Since 1.6
# #
# Features:
# @deprecated: Member @drive-backup is deprecated. Use member
# @blockdev-backup instead.
#
# Since: 1.1 # Since: 1.1
## ##
{ 'enum': 'TransactionActionKind', { 'enum': 'TransactionActionKind',
@ -62,7 +66,7 @@
'block-dirty-bitmap-disable', 'block-dirty-bitmap-merge', 'block-dirty-bitmap-disable', 'block-dirty-bitmap-merge',
'blockdev-backup', 'blockdev-snapshot', 'blockdev-backup', 'blockdev-snapshot',
'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync', 'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync',
'drive-backup' ] } { 'name': 'drive-backup', 'features': [ 'deprecated' ] } ] }
## ##
# @AbortWrapper: # @AbortWrapper: