[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 6/8] blockdev: add DriveBackup transaction
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 6/8] blockdev: add DriveBackup transaction |
Date: |
Wed, 15 May 2013 13:13:26 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 05/15/2013 08:34 AM, Stefan Hajnoczi wrote:
> This patch adds a transactional version of the drive-backup QMP command.
> It allows atomic snapshots of multiple drives along with automatic
> cleanup if there is a failure to start one of the backup jobs.
>
> Note that QMP events are emitted for block job completion/cancellation
> and the block job will be listed by query-block-jobs.
>
> +
> +static void drive_backup_abort(BlkTransactionState *common)
> +{
> + DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);
> + BlockDriverState *bs = state->bs;
> +
> + /* Only cancel if it's the job we started */
> + if (bs && bs->job && bs->job == state->job) {
> + block_job_cancel_sync(bs->job);
> + }
Question - if starting the job created the target file, should aborting
the job unlink() that file so that we aren't polluting the file system?
> +++ b/qapi-schema.json
> @@ -1609,6 +1609,27 @@
> '*mode': 'NewImageMode' } }
>
> ##
> +# @DriveBackup
> +#
> +# @device: the name of the device whose writes should be mirrored.
> +#
> +# @target: the target of the new image. If the file exists, or if it
> +# is a device, the existing file/device will be used as the new
> +# destination. If it does not exist, a new file will be created.
> +#
> +# @format: #optional the format of the new destination, default is to
> +# probe if @mode is 'existing', else the format of the source
> +#
> +# @mode: #optional whether and how QEMU should create a new image, default is
> +# 'absolute-paths'.
> +#
> +# @speed: #optional the maximum speed, in bytes per second
> +##
Mention "Since: 1.6"
> +{ 'type': 'DriveBackup',
> + 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
> + '*mode': 'NewImageMode', '*speed': 'int' } }
> +
> +##
> # @TransactionAction
> #
> # A discriminated record of operations that can be performed with
> @@ -1616,7 +1637,8 @@
> ##
> { 'union': 'TransactionAction',
> 'data': {
> - 'blockdev-snapshot-sync': 'BlockdevSnapshot'
> + 'blockdev-snapshot-sync': 'BlockdevSnapshot',
> + 'drive-backup': 'DriveBackup'
> } }
>
> ##
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 0/8] block: drive-backup live backup command, Stefan Hajnoczi, 2013/05/15
- [Qemu-devel] [PATCH v3 8/8] qemu-iotests: test 'drive-backup' transaction in 055, Stefan Hajnoczi, 2013/05/15
- [Qemu-devel] [PATCH v3 6/8] blockdev: add DriveBackup transaction, Stefan Hajnoczi, 2013/05/15
- Re: [Qemu-devel] [PATCH v3 6/8] blockdev: add DriveBackup transaction,
Eric Blake <=
- [Qemu-devel] [PATCH v3 4/8] qemu-iotests: add 055 drive-backup test case, Stefan Hajnoczi, 2013/05/15
- [Qemu-devel] [PATCH v3 1/8] block: add bdrv_add_before_write_cb(), Stefan Hajnoczi, 2013/05/15
- [Qemu-devel] [PATCH v3 5/8] blockdev: rename BlkTransactionStates to singular, Stefan Hajnoczi, 2013/05/15
- [Qemu-devel] [PATCH v3 3/8] block: add drive-backup QMP command, Stefan Hajnoczi, 2013/05/15