From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YROwP-000536-JQ for qemu-devel@nongnu.org; Fri, 27 Feb 2015 12:43:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YROwM-0004ow-RD for qemu-devel@nongnu.org; Fri, 27 Feb 2015 12:43:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YROwM-0004ol-Ke for qemu-devel@nongnu.org; Fri, 27 Feb 2015 12:43:06 -0500 Message-ID: <54F0ACA3.5080105@redhat.com> Date: Fri, 27 Feb 2015 10:42:59 -0700 From: Eric Blake MIME-Version: 1.0 References: <1425017996-6748-1-git-send-email-zhang.zhanghailiang@huawei.com> <54F09FFB.2070008@redhat.com> <20150227170727.GB2570@work-vm> In-Reply-To: <20150227170727.GB2570@work-vm> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xINFHptChR0EPV7Tot6gdHfKLoVPNc2Ne" 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: "Dr. David Alan Gilbert" Cc: zhanghailiang , quintela@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, lcapitulino@redhat.com, amit.shah@redhat.com, peter.huangpeng@huawei.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xINFHptChR0EPV7Tot6gdHfKLoVPNc2Ne Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/27/2015 10:07 AM, Dr. David Alan Gilbert wrote: >> >> 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 tracki= ng >> cancelling separate from the enum? >=20 > Well I guess we could just report it; but would that break any external= tools? It might - I seem to recall in the past that when we added a new state string, that at least libvirt choked when encountering the unknown string (but I don't recall if it was migration or something else). At least libvirt already has an enum tracking: enum { QEMU_MONITOR_MIGRATION_STATUS_INACTIVE, QEMU_MONITOR_MIGRATION_STATUS_ACTIVE, QEMU_MONITOR_MIGRATION_STATUS_COMPLETED, QEMU_MONITOR_MIGRATION_STATUS_ERROR, QEMU_MONITOR_MIGRATION_STATUS_CANCELLED, QEMU_MONITOR_MIGRATION_STATUS_SETUP, QEMU_MONITOR_MIGRATION_STATUS_LAST }; and a string mapping of just the following states: VIR_ENUM_IMPL(qemuMonitorMigrationStatus, QEMU_MONITOR_MIGRATION_STATUS_LAST, "inactive", "active", "completed", "failed", "cancelled", "setup") Furthermore, the function qemuMigrationUpdateJobStatus() is doing various things depending on the observed state, where the current trick of treating 'cancelling' like 'active' would mean that changing 'cancelling' to be an independent state WOULD have observable behavior change in libvirt. But I don't know if the change would break things, or if it would still end up resolving nicely (after all, cancelling only occurs for a short window before the migration aborts anyway, so it might just sort itself out when it finally gets to cancelled). On the other hand, we can argue that clients that are unprepared to handle new enum states gracefully are broken, and we also have the argument that it is okay for a new qemu to require a new libvirt release (the other direction is not okay - a new libvirt must not require upgrading to a new qemu). So exposing 'cancelling' may make this patch easier. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xINFHptChR0EPV7Tot6gdHfKLoVPNc2Ne 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/ iQEcBAEBCAAGBQJU8KyjAAoJEKeha0olJ0NqX8QIAKbyudKRlZpsqyEG/w3QdlPg WQrRPexUPekCwNdct6SMxUScArL5Dksr3WYGN5OHcjnQYLELnwcr7Z8i0E/A/FF8 ZQ8KVdaOCO+pkaRPzeZSmWnEdBrWs03QOBmWCPbU6OOQUbJq2TZBihVlXBHwkyzM 0ZkIPetDWZ4pPbwXL0B80kl+1gqOwAfw720Pj9/+F9PHJKCIUtpBw10GewMa0bVK mZF0UK12sQ43+1aH3MiNqJKteUY12lma2RyJu5K9/lcwSpKcw1YMm15kRQ+tTrVn WGRb0Js0CzEE+5ZxhVdAuDxy4DHt90dDGayvwQ6IjeEW0yc4ydgMqIk+6djS3SA= =4SOU -----END PGP SIGNATURE----- --xINFHptChR0EPV7Tot6gdHfKLoVPNc2Ne--