From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW8vL-0005KN-8q for qemu-devel@nongnu.org; Thu, 12 Mar 2015 15:37:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW8vH-00088P-UZ for qemu-devel@nongnu.org; Thu, 12 Mar 2015 15:37:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW8vH-000887-MM for qemu-devel@nongnu.org; Thu, 12 Mar 2015 15:37:35 -0400 Message-ID: <5501EAFA.70103@redhat.com> Date: Thu, 12 Mar 2015 13:37:30 -0600 From: Eric Blake MIME-Version: 1.0 References: <1425883543-8852-1-git-send-email-zhang.zhanghailiang@huawei.com> <1425883543-8852-4-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1425883543-8852-4-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ko2miQUqkrC3KItSHUAxIh64HPmivP14e" Subject: Re: [Qemu-devel] [PATCH v4 3/4] migration: Convert 'status' of MigrationInfo to use an enum type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: quintela@redhat.com, armbru@redhat.com, peter.huangpeng@huawei.com, lcapitulino@redhat.com, amit.shah@redhat.com, dgilbert@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ko2miQUqkrC3KItSHUAxIh64HPmivP14e Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/09/2015 12:45 AM, zhanghailiang wrote: > The original 'status' is an open-coded 'str' type, convert it to use an= > enum type. > This conversion is backwards compatible, better documented and > more convenient for future extensibility. >=20 > In addition, Fix a typo for qapi-schema.json (just remove the typo) : > s/'completed'. 'comppleted' (since 1.2)/'completed' (since 1.2) >=20 > Signed-off-by: zhanghailiang > --- > hmp.c | 7 ++++--- > migration/migration.c | 20 +++++--------------- > qapi-schema.json | 34 +++++++++++++++++++++++++++++----- > 3 files changed, 38 insertions(+), 23 deletions(-) > =20 > -enum { > - MIGRATION_STATUS_FAILED =3D -1, > - MIGRATION_STATUS_NONE, Note that we are changing any 0-initialized struct from having STATUS_NONE... > +## > +{ 'enum': 'MigrationStatus', > + 'data': [ 'failed', 'none', 'setup', 'cancelling', 'cancelled', > + 'active', 'completed' ] } =2E..to now having status _FAILED. Fortunately, in migration/migration.c= (the only caller prior to this conversion), I didn't spot any zero-initialization (migrate_get_current() returns a struct that is explicitly initialized to _NONE). So it looks correct. > + > ## > # @MigrationInfo > # > # Information about current migration process. > # > -# @status: #optional string describing the current migration status. > -# As of 0.14.0 this can be 'setup', 'active', 'completed', 'f= ailed' or > -# 'cancelled'. If this field is not returned, no migration pr= ocess > +# @status: #optional @MigState describing the current migration status= =2E s/MigState/MigrationStatus/ > + 'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats', > '*disk': 'MigrationStats', Hmm. "Status" and "Stats" look awfully close to one another. But I can live with the two names (it's not worth a respin just for the rename). With the typo fix pointed out in the documentation, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ko2miQUqkrC3KItSHUAxIh64HPmivP14e 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVAer6AAoJEKeha0olJ0NqLzUH/3+tUhV+cRNMfnOoz+RJ5cPG 3LGV59qwbXeHxbhPwUIsZNzrlq7Cf5aeAGc/rRpYhrgTH9SjEYw7JgEDYznahiBE NLeDDWgpKM5182Kre3A3c9eCX5yPxc1Gw7al5t9zhORrXwpSjZpqPrENaK6vKy33 0B5Och/k6g0n7skB9GTOfiS8DXqrk1MMUpFScO1uWvpP9rPdrajrqe8wOuBGKXHt Z82uorQriOk6p8nlL4dk4HeO1DMQwX80G9F+tpbs4Q4ezlAeHtDaoNJLZvZaxQqY Bs6FXUFkbE4tQoUBgT+y2ZRDOFATRyU0ITPOFyqPFM2hNha+Nq9UMEhDWK1+RSo= =XQQv -----END PGP SIGNATURE----- --ko2miQUqkrC3KItSHUAxIh64HPmivP14e--