From patchwork Thu Dec 16 17:44:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 75785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4917A1007D3 for ; Fri, 17 Dec 2010 05:10:02 +1100 (EST) Received: from localhost ([127.0.0.1]:46185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTIH8-0005sb-Jg for incoming@patchwork.ozlabs.org; Thu, 16 Dec 2010 13:09:58 -0500 Received: from [140.186.70.92] (port=52969 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTIEq-00057K-CE for qemu-devel@nongnu.org; Thu, 16 Dec 2010 13:07:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTIEp-0005ha-EM for qemu-devel@nongnu.org; Thu, 16 Dec 2010 13:07:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTIEp-0005gy-7m for qemu-devel@nongnu.org; Thu, 16 Dec 2010 13:07:35 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBGI6H7h021093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Dec 2010 13:07:15 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oBGHpD49013499; Thu, 16 Dec 2010 12:51:13 -0500 Received: from amt.cnet (vpn2-9-217.ams2.redhat.com [10.36.9.217]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oBGHpBJu018634; Thu, 16 Dec 2010 12:51:12 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 4959465203B; Thu, 16 Dec 2010 15:50:17 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id oBGHoEaV022140; Thu, 16 Dec 2010 15:50:15 -0200 Message-Id: <20101216174810.650542462@redhat.com> User-Agent: quilt/0.47-1 Date: Thu, 16 Dec 2010 15:44:20 -0200 From: Marcelo Tosatti To: qemu-devel@nongnu.org References: <20101216174419.090204390@redhat.com> Content-Disposition: inline; filename=migration-active X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Kevin Wolf , Anthony Liguori , Marcelo Tosatti Subject: [Qemu-devel] [patch 1/3] add migration_active function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To query whether migration is active. Signed-off-by: Marcelo Tosatti Index: qemu-kvm-block-copy/migration.c =================================================================== --- qemu-kvm-block-copy.orig/migration.c +++ qemu-kvm-block-copy/migration.c @@ -448,3 +448,13 @@ int migrate_fd_close(void *opaque) qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); return s->close(s); } + +bool migration_active(void) +{ + if (current_migration && + current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { + return true; + } + + return false; +} Index: qemu-kvm-block-copy/migration.h =================================================================== --- qemu-kvm-block-copy.orig/migration.h +++ qemu-kvm-block-copy/migration.h @@ -134,4 +134,6 @@ static inline FdMigrationState *migrate_ return container_of(mig_state, FdMigrationState, mig_state); } +bool migration_active(void); + #endif