From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNV5H-0006Wx-E5 for qemu-devel@nongnu.org; Mon, 16 Feb 2015 18:28:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNV5E-00053h-7J for qemu-devel@nongnu.org; Mon, 16 Feb 2015 18:28:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNV5D-00052j-W0 for qemu-devel@nongnu.org; Mon, 16 Feb 2015 18:28:08 -0500 Message-ID: <54E27CFD.6010206@redhat.com> Date: Mon, 16 Feb 2015 16:27:57 -0700 From: Eric Blake MIME-Version: 1.0 References: <1423711034-5340-1-git-send-email-zhang.zhanghailiang@huawei.com> <1423711034-5340-5-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1423711034-5340-5-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="N8dfdnriQuhoIpt53TNAlSnIE5wkEB97F" Subject: Re: [Qemu-devel] [PATCH RFC v3 04/27] migration: Integrate COLO checkpoint process into migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: Lai Jiangshan , yunhong.jiang@intel.com, eddie.dong@intel.com, dgilbert@redhat.com, peter.huangpeng@huawei.com, Gonglei , stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --N8dfdnriQuhoIpt53TNAlSnIE5wkEB97F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/11/2015 08:16 PM, zhanghailiang wrote: > Add a migrate state: MIG_STATE_COLO, enter this migration state > after the first live migration successfully finished. >=20 > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > Signed-off-by: Lai Jiangshan > --- > include/migration/migration-colo.h | 2 ++ > include/migration/migration.h | 13 +++++++ > migration/Makefile.objs | 1 + > migration/colo.c | 72 ++++++++++++++++++++++++++++++= ++++++++ > migration/migration.c | 38 +++++++++++--------- > stubs/Makefile.objs | 1 + > stubs/migration-colo.c | 17 +++++++++ > 7 files changed, 128 insertions(+), 16 deletions(-) > create mode 100644 migration/colo.c > create mode 100644 stubs/migration-colo.c >=20 > +++ b/include/migration/migration.h > @@ -65,6 +65,19 @@ struct MigrationState > int64_t dirty_sync_count; > }; > =20 > +enum { > + MIG_STATE_ERROR =3D -1, > + MIG_STATE_NONE, > + MIG_STATE_SETUP, > + MIG_STATE_CANCELLING, > + MIG_STATE_CANCELLED, > + MIG_STATE_ACTIVE, > + MIG_STATE_COLO, > + MIG_STATE_COMPLETED, > +}; Is the new state intended to be user-visible? If so, wouldn't it be better to expose this enum via qapi-schema.json? > + > +/* #define DEBUG_COLO */ > + > +#ifdef DEBUG_COLO > +#define DPRINTF(fmt, ...) \ > +do { fprintf(stdout, "colo: " fmt , ## __VA_ARGS__); } while (0) > +#else > +#define DPRINTF(fmt, ...) do {} while (0) > +#endif > + Same comment as in 3/27 about avoiding bit-rotting debug statements. Or even better,... > +static QEMUBH *colo_bh; > + > +static void *colo_thread(void *opaque) > +{ > + MigrationState *s =3D opaque; > + > + qemu_mutex_lock_iothread(); > + vm_start(); > + qemu_mutex_unlock_iothread(); > + DPRINTF("vm resume to run\n"); =2E..why not add tracepoints instead of using DPRINTF? > @@ -227,6 +218,11 @@ MigrationInfo *qmp_query_migrate(Error **errp) > =20 > get_xbzrle_cache_stats(info); > break; > + case MIG_STATE_COLO: > + info->has_status =3D true; > + info->status =3D g_strdup("colo"); > + /* TODO: display COLO specific informations(checkpoint info et= c.),*/ > + break; Uggh. We REALLY need to fix MigrationInfo to convert 'status' to use an enum type, instead of an open-coded 'str' (such a conversion is backwards compatible, and better documented). Then it would be more obvious that you are adding an enum value. Doing the conversion would be a good prerequisite patch. s/informations(checkpoint info etc.),/information (checkpoint info etc.)/= --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --N8dfdnriQuhoIpt53TNAlSnIE5wkEB97F 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/ iQEcBAEBCAAGBQJU4nz9AAoJEKeha0olJ0NqU4cH/i3pv6lK+G5lFJJ0g+58/s71 PnkgB2nSXdb6DLKGFc9MYlhRo5cz95QgiYocDmYZ6/9kCvxNc0cR6W5XzMDMaNGz aeDaEga7BCeoEPhlXL7lryGa0PzZaXU6s1QW8ILMdPditrq8whnORHT4Y7xG8Clm Todg4Hxkg9DPSBOHxPH95PKVoFutMPMaRN5AeCkzK32vrDrpNRmxrTcZwBfBqIEk wteI/9mImZKLNCHmh4t/zj9fceoEUw6O2XaFsWze6MSV+WKYKqhIy1e/tIc62hDa nTB8K0uUnREquxwTARkDhQgcLHE4bW7Z2ouZMa0Pa/W/q+BQIntKzflr4S0mH6E= =nWfg -----END PGP SIGNATURE----- --N8dfdnriQuhoIpt53TNAlSnIE5wkEB97F--