From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLgGU-0003Xb-Ls for qemu-devel@nongnu.org; Tue, 19 Jan 2016 19:04:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLgGR-00062F-DI for qemu-devel@nongnu.org; Tue, 19 Jan 2016 19:04:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLgGR-00062B-5g for qemu-devel@nongnu.org; Tue, 19 Jan 2016 19:04:43 -0500 References: <1452676712-24239-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1452676712-24239-8-git-send-email-xiecl.fnst@cn.fujitsu.com> From: Eric Blake Message-ID: <569ECF18.4070103@redhat.com> Date: Tue, 19 Jan 2016 17:04:40 -0700 MIME-Version: 1.0 In-Reply-To: <1452676712-24239-8-git-send-email-xiecl.fnst@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="melkPqiHV1qV4cm5bD1wLkfA4rRuBEgx5" Subject: Re: [Qemu-devel] [PATCH v14 7/8] Implement new driver for block replication List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Changlong Xie , qemu devel , Fam Zheng , Max Reitz , Paolo Bonzini , Kevin Wolf , Stefan Hajnoczi Cc: Gonglei , zhanghailiang , fnstml-hwcolo@cn.fujitsu.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --melkPqiHV1qV4cm5bD1wLkfA4rRuBEgx5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/13/2016 02:18 AM, Changlong Xie wrote: > From: Wen Congyang >=20 > Signed-off-by: Wen Congyang > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > Signed-off-by: Changlong Xie > --- > block/Makefile.objs | 1 + > block/replication-comm.c | 66 +++++ > block/replication.c | 590 +++++++++++++++++++++++++++++++= ++++++++ > include/block/replication-comm.h | 50 ++++ > qapi/block-core.json | 13 + > 5 files changed, 720 insertions(+) > create mode 100644 block/replication-comm.c > create mode 100644 block/replication.c > create mode 100644 include/block/replication-comm.h >=20 Just a high-level overview, mainly on the user-visible interface and things that caught my eye. > +++ b/block/replication-comm.c > @@ -0,0 +1,66 @@ > +/* > + * Replication Block filter > + * > + * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO., LTD. > + * Copyright (c) 2015 Intel Corporation > + * Copyright (c) 2015 FUJITSU LIMITED Do you want to claim 2016 in any of this? > + > +enum { > + BLOCK_REPLICATION_NONE, /* block replication is not st= arted */ > + BLOCK_REPLICATION_RUNNING, /* block replication is runnin= g */ > + BLOCK_REPLICATION_FAILOVER, /* failover is running in back= ground */ > + BLOCK_REPLICATION_FAILOVER_FAILED, /* failover failed*/ Space before */ > + BLOCK_REPLICATION_DONE, /* block replication is done(a= fter failover) */ > +}; Should this be an enum type in a .json file? > + > +static int replication_open(BlockDriverState *bs, QDict *options, > + int flags, Error **errp) > +{ > + > +fail: > + qemu_opts_del(opts); > + /* propagate error */ > + if (local_err) { > + error_propagate(errp, local_err); > + } It's safe to call error_propagate() unconditionally (you could drop the 'if (local_err)'). > +static coroutine_fn int replication_co_discard(BlockDriverState *bs, > + int64_t sector_num, > + int nb_sectors) > +{ > + BDRVReplicationState *s =3D bs->opaque; > + int ret; > + > + ret =3D replication_get_io_status(s); > + if (ret < 0) { > + return ret; > + } > + > + if (ret =3D=3D 1) { > + /* It is secondary qemu and failover are running*/ Space before */ > +static void secondary_do_checkpoint(BDRVReplicationState *s, Error **e= rrp) > +{ > + Error *local_err =3D NULL; > + int ret; > + > + if (!s->secondary_disk->job) { > + error_setg(errp, "Backup job is cancelled unexpectedly"); Maybe s/is/was/ > +static void replication_start(BlockReplicationState *brs, ReplicationM= ode mode, > + Error **errp) > +{ > + BlockDriverState *bs =3D brs->bs; > + BDRVReplicationState *s =3D brs->bs->opaque; > + int64_t active_length, hidden_length, disk_length; > + AioContext *aio_context; > + Error *local_err =3D NULL; > + > + if (s->replication_state !=3D BLOCK_REPLICATION_NONE) { > + error_setg(errp, "Block replication is running or done"); > + return; > + } > + > + if (s->mode !=3D mode) { > + error_setg(errp, "The parameter mode's value is invalid, needs= %d," > + " but receives %d", s->mode, mode); s/receives/got/ > +static void replication_do_checkpoint(BlockReplicationState *brs, Erro= r **errp) > +{ > + BDRVReplicationState *s =3D brs->bs->opaque; > + > + if (s->replication_state !=3D BLOCK_REPLICATION_RUNNING) { > + error_setg(errp, "Block replication is not running"); > + return; > + } > + > + if (s->error) { > + error_setg(errp, "I/O error occurs"); s/occurs/occurred/ > +++ b/qapi/block-core.json > @@ -1975,6 +1975,19 @@ > '*read-pattern': 'QuorumReadPattern' } } > =20 > ## > +# @ReplicationMode > +# > +# An enumeration of replication modes. > +# > +# @primary: Primary mode, the vm's state will be sent to secondary QEM= U. > +# > +# @secondary: Secondary mode, receive the vm's state from primary QEMU= =2E > +# > +# Since: 2.6 > +## > +{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] } > + Interface looks okay. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --melkPqiHV1qV4cm5bD1wLkfA4rRuBEgx5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWns8YAAoJEKeha0olJ0Nq7G4IAIJ3hiagC9jD/26PKMHqlWBn N+NG0JUnpkbZgdpm2f6QmNHLdGqMzF8GOCF8nr/mwRso+Uk3loxsYTrDGQhR0mPy yZP5Irp/tIZbbMfdjlWM+8U3vqSZERYpNDKhsdvSREWyN6WNGBFaS5mOg5bTMBU8 HUFWDpQ1YtNCV/+ZiFoNgH8sLGXUB2vY7W+xwWax4qbhdSdW3ZT9C+v18RcRaKCA bWbuoQtnBOVbcYr89TaKm4DlhKQh1ldzHwsXlHBjoHlv17VLYseR3h/dRg1KeoeZ NmjV9v3Up7/A2jvMir0wjj53zEAPDIq3oJTon2Z56q31fuHQsqCqsFH5gc2Q9RQ= =f3HA -----END PGP SIGNATURE----- --melkPqiHV1qV4cm5bD1wLkfA4rRuBEgx5--