From nobody Wed May 14 16:38:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524003372787940.6357503174827; Tue, 17 Apr 2018 15:16:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FD733142292; Tue, 17 Apr 2018 22:16:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F60819E65; Tue, 17 Apr 2018 22:16:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8AB3E4CA9C; Tue, 17 Apr 2018 22:16:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3HMDpFF012370 for ; Tue, 17 Apr 2018 18:13:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9B02B87B22; Tue, 17 Apr 2018 22:13:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D2236B241 for ; Tue, 17 Apr 2018 22:13:49 +0000 (UTC) Received: from smtp.lse.epita.fr (lse.epita.fr [163.5.55.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0192E80F79 for ; Tue, 17 Apr 2018 22:13:49 +0000 (UTC) Received: from clem.lse.epita.fr (unknown [192.168.103.23]) by smtp.lse.epita.fr (Postfix) with ESMTP id 4E910608D9; Wed, 18 Apr 2018 00:13:44 +0200 (CEST) From: Clementine Hayat To: libvir-list@redhat.com Date: Tue, 17 Apr 2018 22:13:30 +0000 Message-Id: <20180417221334.13845-6-clem@lse.epita.fr> In-Reply-To: <20180417221334.13845-1-clem@lse.epita.fr> References: <20180412194915.818-1-clem@lse.fr> <20180417221334.13845-1-clem@lse.epita.fr> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 17 Apr 2018 22:13:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 17 Apr 2018 22:13:49 +0000 (UTC) for IP:'163.5.55.17' DOMAIN:'lse.epita.fr' HELO:'smtp.lse.epita.fr' FROM:'clem@lse.epita.fr' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 163.5.55.17 lse.epita.fr 163.5.55.17 lse.epita.fr X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Clementine Hayat Subject: [libvirt] [PATCH v2 5/9] bhyve: start using virDomainObjCheckActive X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 17 Apr 2018 22:16:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Clementine Hayat --- src/bhyve/bhyve_driver.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 24c4a9c80..8aff0c65c 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -883,11 +883,8 @@ bhyveDomainCreateWithFlags(virDomainPtr dom, if (virDomainCreateWithFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 - if (virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is already running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } =20 ret =3D virBhyveProcessStart(dom->conn, privconn, vm, VIR_DOMAIN_RUNNING_BOOTED, @@ -996,11 +993,8 @@ bhyveDomainDestroy(virDomainPtr dom) if (virDomainDestroyEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } =20 ret =3D virBhyveProcessStop(privconn, vm, VIR_DOMAIN_SHUTOFF_DESTROYED= ); event =3D virDomainEventLifecycleNewFromObj(vm, @@ -1031,11 +1025,8 @@ bhyveDomainShutdown(virDomainPtr dom) if (virDomainShutdownEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } =20 ret =3D virBhyveProcessShutdown(vm); =20 @@ -1062,11 +1053,8 @@ bhyveDomainOpenConsole(virDomainPtr dom, if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } =20 if (!vm->def->nserials) { virReportError(VIR_ERR_INTERNAL_ERROR, --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list