From patchwork Tue Nov 14 10:22:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amador Pahim X-Patchwork-Id: 837786 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ybkN72RsGz9s7B for ; Tue, 14 Nov 2017 21:32:23 +1100 (AEDT) Received: from localhost ([::1]:58698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYVx-0007kc-Gz for incoming@patchwork.ozlabs.org; Tue, 14 Nov 2017 05:32:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYNn-0000Ez-IB for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEYNm-0003P7-Pr for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:23:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eEYNm-0003Ol-KM for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:23:54 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C92C97EA8A; Tue, 14 Nov 2017 10:23:53 +0000 (UTC) Received: from t460p.pahim.org.com (ovpn-204-191.brq.redhat.com [10.40.204.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id E42A193539; Tue, 14 Nov 2017 10:23:51 +0000 (UTC) From: Amador Pahim To: qemu-devel@nongnu.org Date: Tue, 14 Nov 2017 11:22:45 +0100 Message-Id: <20171114102246.22221-8-apahim@redhat.com> In-Reply-To: <20171114102246.22221-1-apahim@redhat.com> References: <20171114102246.22221-1-apahim@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 14 Nov 2017 10:23:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v11 7/8] qemu.py: launch vm only if it's not running X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: famz@redhat.com, ehabkost@redhat.com, Amador Pahim , armbru@redhat.com, crosa@redhat.com, muriloo@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If we allow launching VM again we will loose track of the first launched VM. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 305d7bd098..0b0b61be39 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -207,6 +207,9 @@ class QEMUMachine(object): Launch the VM and make sure we cleanup and expose the command line/output in case of exception """ + if self.is_running(): + raise QEMUMachineError('VM already running') + self._iolog = None self._qemu_full_args = None try: