From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRO6A-0001MX-Pq for qemu-devel@nongnu.org; Fri, 27 Feb 2015 11:49:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRO68-00087s-0g for qemu-devel@nongnu.org; Fri, 27 Feb 2015 11:49:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRO67-00087l-Pk for qemu-devel@nongnu.org; Fri, 27 Feb 2015 11:49:07 -0500 Message-ID: <54F09FFB.2070008@redhat.com> Date: Fri, 27 Feb 2015 09:48:59 -0700 From: Eric Blake MIME-Version: 1.0 References: <1425017996-6748-1-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1425017996-6748-1-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RrpvoqUmogq8BqNVXVt1o36THk5ftdfEJ" Subject: Re: [Qemu-devel] [PATCH v2] 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) --RrpvoqUmogq8BqNVXVt1o36THk5ftdfEJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/26/2015 11:19 PM, 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: comppleted -> completed >=20 > Signed-off-by: zhanghailiang > --- > v2: > - Remove '(since xyz)' strings. (Eric Blake) > --- > hmp.c | 7 ++++--- > migration/migration.c | 37 +++++++++++++++---------------------- > qapi-schema.json | 37 ++++++++++++++++++++++++++++++++----- > 3 files changed, 51 insertions(+), 30 deletions(-) > case MIG_STATE_ACTIVE: > case MIG_STATE_CANCELLING: > info->has_status =3D true; > - info->status =3D g_strdup("active"); > + /* Note: when the real state of migration is 'cancelling', > + we still return 'active' status to user, it makes no differen= ce > + for user. */ Rather than pollute the user-exposed enum with a state that we will never report, can we come up with some internal-only method for tracking cancelling separate from the enum? > +++ b/qapi-schema.json > @@ -411,18 +411,45 @@ > 'overflow': 'int' } } > =20 > ## > +# @MigState: Do we have to abbreviate? I guess leaving it like this makes the rest of the existing code base have less churn (since it matches the spelling of the enum that was previous interanl only), but it might look nicer as MigrationState. If you do decide to go with a longer name, it might be nice to split this into a series, one patch that does only renames to migration.c (but no code additions outside of that file), and the other that moves the (now-correctly-named) enum into the public qapi file. > +# > +# An enumeration of migration status. > +# > +# @failed: some error occurred during migration process. > +# > +# @none: no migration has ever happened. > +# > +# @setup: migration process has been initiated. > +# > +# @cancelling: in the process of cancelling migration. > +# If the user can never see this state, I'd rather we think about a solution that avoids advertising the state in the public api... > +# @cancelled: cancelling migration is finished. > +# > +# @active: in the process of doing migration. > +# > +# @completed: migration is finished. > +# > +# Since: 2.3 > +# > +# Notes: @cancelling is only used internally, and return @active to us= er > +# instead of @cancelling, it make no difference for users. =2E..rather than needing this note to air our dirty laundry. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --RrpvoqUmogq8BqNVXVt1o36THk5ftdfEJ 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/ iQEcBAEBCAAGBQJU8J/7AAoJEKeha0olJ0Nq46sH/jHOXrs6i4ZN/TkwT7pAac7Y /x0EZR5TDmC99eXDkEizhG1lThEmLR6iPtm9G058YiTjgxSHyPYarI3zlHr8Kt9M zi4r1tx/49+PHlOhFPGukv4Yyf32zQs4wf0hEF78MsJf830FpHeYybyKO5nObeRC /RjxduPaNrLnvuipkENke3MktWJILK7SMwDwAZGokPkO5TBqkCLWyQr3JtvKCX1T dIokgUmWIe9BoUaN/xJmKKjfD5AAcJOkgbbOHB2I4cvtlMgNEkRBhrwpWxOTHbk0 VRFc0tjgr4LaUcEc+96EMQoBeHp1IRC0gzgYViNh+nvr1fArU+tnk9+V7fqRhmM= =FJVl -----END PGP SIGNATURE----- --RrpvoqUmogq8BqNVXVt1o36THk5ftdfEJ--