From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uch95-0006bl-Vt for qemu-devel@nongnu.org; Wed, 15 May 2013 15:13:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uch94-0002EA-II for qemu-devel@nongnu.org; Wed, 15 May 2013 15:13:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uch94-0002Dt-Ap for qemu-devel@nongnu.org; Wed, 15 May 2013 15:13:50 -0400 Message-ID: <5193DE56.9050006@redhat.com> Date: Wed, 15 May 2013 13:13:26 -0600 From: Eric Blake MIME-Version: 1.0 References: <1368628476-19622-1-git-send-email-stefanha@redhat.com> <1368628476-19622-7-git-send-email-stefanha@redhat.com> In-Reply-To: <1368628476-19622-7-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2GEPBFXHQSAFTWPTIDQKF" Subject: Re: [Qemu-devel] [PATCH v3 6/8] blockdev: add DriveBackup transaction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, dietmar@proxmox.com, imain@redhat.com, Paolo Bonzini , xiawenc@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2GEPBFXHQSAFTWPTIDQKF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/15/2013 08:34 AM, Stefan Hajnoczi wrote: > This patch adds a transactional version of the drive-backup QMP command= =2E > It allows atomic snapshots of multiple drives along with automatic > cleanup if there is a failure to start one of the backup jobs. >=20 > Note that QMP events are emitted for block job completion/cancellation > and the block job will be listed by query-block-jobs. >=20 > + > +static void drive_backup_abort(BlkTransactionState *common) > +{ > + DriveBackupState *state =3D DO_UPCAST(DriveBackupState, common, co= mmon); > + BlockDriverState *bs =3D state->bs; > + > + /* Only cancel if it's the job we started */ > + if (bs && bs->job && bs->job =3D=3D 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' } } > =20 > ## > +# @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 n= ew > +# destination. If it does not exist, a new file will be crea= ted. > +# > +# @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, def= ault 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' > } } > =20 > ## >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2GEPBFXHQSAFTWPTIDQKF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRk95WAAoJEKeha0olJ0Nqvq8IAKrobz5MBR3cttoeMufURlLv tc87EFQ6wQD8PHLtd4kIHfVa8sq0xxHus8IR0qCi9gmekoO+Q+UbzIr6HhexvQIP +/K7wU6FpwDdxURqSz4yIuC4H53sm6cvnRFjM4CZhQzAvrRWiRt1tMMlzihCAxbg xuixWy6YaDjeQZmPuguBp/y9SSZMH0fnXTym7InfoFWUjqpxMXcltl7a8waJpSIK jVxa1kYOqhvDz4abRKVAL0WxWTOIZj9RsAHVsTRj3zk9TWYK/pTFddeK7semB+VI LBix36FvLZ8FYv8v4/xzxcCnldgcYDc8HsVGbuDdCeAXTL3cUpJ3+lcn9x/df4U= =QCXU -----END PGP SIGNATURE----- ------enig2GEPBFXHQSAFTWPTIDQKF--