From patchwork Mon Jun 6 16:55:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 99049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 37D91B6F73 for ; Tue, 7 Jun 2011 07:44:58 +1000 (EST) Received: from localhost ([::1]:41752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QThbS-0001ya-7f for incoming@patchwork.ozlabs.org; Mon, 06 Jun 2011 17:44:54 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTe2B-0002E0-2U for qemu-devel@nongnu.org; Mon, 06 Jun 2011 13:56:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTe27-0004tm-1X for qemu-devel@nongnu.org; Mon, 06 Jun 2011 13:56:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTe26-0004tH-CE for qemu-devel@nongnu.org; Mon, 06 Jun 2011 13:56:10 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p56Hu26K012088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 6 Jun 2011 13:56:09 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p56GxEg0027271; Mon, 6 Jun 2011 12:59:14 -0400 Received: from amt.cnet (vpn1-5-196.ams2.redhat.com [10.36.5.196]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p56GxCtL017698; Mon, 6 Jun 2011 12:59:13 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 5B16B6520C3; Mon, 6 Jun 2011 13:58:52 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id p56GwpcP030296; Mon, 6 Jun 2011 13:58:51 -0300 Message-Id: <20110606165823.510648909@amt.cnet> User-Agent: quilt/0.48-1 Date: Mon, 06 Jun 2011 13:55:37 -0300 From: Marcelo Tosatti To: qemu-devel@nongnu.org References: <20110606165536.581119615@amt.cnet> Content-Disposition: inline; filename=1-3-add-migration-active.patch X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, Marcelo Tosatti , Jes.Sorensen@redhat.com, dlaor@redhat.com, avi@redhat.com, jdenemar@redhat.com Subject: [Qemu-devel] [patch 1/7] add migration_active function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To query whether migration is active. Signed-off-by: Marcelo Tosatti Index: qemu-block-copy/migration.c =================================================================== --- qemu-block-copy.orig/migration.c +++ qemu-block-copy/migration.c @@ -85,8 +85,8 @@ int do_migrate(Monitor *mon, const QDict int inc = qdict_get_try_bool(qdict, "inc", 0); const char *uri = qdict_get_str(qdict, "uri"); - if (current_migration && - current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { + + if (migration_active()) { monitor_printf(mon, "migration already in progress\n"); return -1; } @@ -480,3 +480,13 @@ int get_migration_state(void) return MIG_STATE_ERROR; } } + +bool migration_active(void) +{ + if (current_migration && + current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { + return true; + } + + return false; +} Index: qemu-block-copy/migration.h =================================================================== --- qemu-block-copy.orig/migration.h +++ qemu-block-copy/migration.h @@ -148,4 +148,6 @@ int ram_load(QEMUFile *f, void *opaque, extern int incoming_expected; +bool migration_active(void); + #endif