Received: from eggs.gnu.org ([2001:4830:134:3::10]:38644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z50y1-0003GN-6d for qemu-devel@nongnu.org; Tue, 16 Jun 2015 20:12:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z50xx-0001NZ-4p for qemu-devel@nongnu.org; Tue, 16 Jun 2015 20:12:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z50xw-0001Mm-W5 for qemu-devel@nongnu.org; Tue, 16 Jun 2015 20:12:29 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 81185A10A3 for ; Wed, 17 Jun 2015 00:12:27 +0000 (UTC) From: Juan Quintela In-Reply-To: <20150529114527.GA3525@orkuz.home> (Jiri Denemark's message of "Fri, 29 May 2015 13:45:27 +0200") References: <1432136124-24572-1-git-send-email-quintela@redhat.com> <1432136124-24572-3-git-send-email-quintela@redhat.com> <20150529114527.GA3525@orkuz.home> Date: Wed, 17 Jun 2015 02:12:25 +0200 Message-ID: <87616ni45y.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 2/3] migration: create migration event Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jiri Denemark Cc: amit.shah@redhat.com, qemu-devel@nongnu.org Jiri Denemark wrote: > On Wed, May 20, 2015 at 17:35:23 +0200, Juan Quintela wrote: >> We have one argument that tells us what event has happened. >> >> Signed-off-by: Juan Quintela >> --- >> docs/qmp/qmp-events.txt | 16 ++++++++++++++++ >> migration/migration.c | 12 ++++++++++++ >> qapi/event.json | 14 ++++++++++++++ >> 3 files changed, 42 insertions(+) > > Hi Juan, > > I patched libvirt to be able to consume this event and it all seems to > work fine except for events sent after migrate_cancel command: > > {"execute":"migrate_cancel","id":"libvirt-33"} > {"timestamp": {"seconds": 1432899178, "microseconds": 844907}, "event": > "MIGRATION", "data": {"status": "cancelling"}} > {"return": {}, "id": "libvirt-33"} > {"timestamp": {"seconds": 1432899178, "microseconds": 845625}, "event": > "MIGRATION", "data": {"status": "failed"}} > {"timestamp": {"seconds": 1432899178, "microseconds": 846432}, "event": > "MIGRATION", "data": {"status": "cancelled"}} > > In other words, the status first changes to "failed" and then it changes > correctly "cancelled". Can you fix this weird behavior in QEMU or do we > have to work around it in libvirt? > > Jirka Found root cause of this, basically we had the code: migrate_set_state(FOO, MIGRATION_STATUS_FAILED); qapi_send_event(...., MIGRATION_STATUS_FAILED); But the first call only change the state if the current state is FOO. So, changed the event to inside migrate_set_state() and only sent it when we change the state. See new patch series, basically we were using incorrectly atomic_cmpxchg() and that made things ... interesting. Later, Juan.