From nobody Thu May 15 09:25:38 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 1524003262746256.2776324711939; Tue, 17 Apr 2018 15:14:22 -0700 (PDT) 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 92CC780473; Tue, 17 Apr 2018 22:14:20 +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 667E27ED74; Tue, 17 Apr 2018 22:14:20 +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 26D194CA99; Tue, 17 Apr 2018 22:14:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3HMDpRw012359 for ; Tue, 17 Apr 2018 18:13:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1273A19E31; Tue, 17 Apr 2018 22:13:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CD3319E65 for ; Tue, 17 Apr 2018 22:13:48 +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 8D8D1356E3 for ; Tue, 17 Apr 2018 22:13:45 +0000 (UTC) Received: from clem.lse.epita.fr (unknown [192.168.103.23]) by smtp.lse.epita.fr (Postfix) with ESMTP id E3C8D608F8; Wed, 18 Apr 2018 00:13:43 +0200 (CEST) From: Clementine Hayat To: libvir-list@redhat.com Date: Tue, 17 Apr 2018 22:13:28 +0000 Message-Id: <20180417221334.13845-4-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.30]); Tue, 17 Apr 2018 22:13:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 17 Apr 2018 22:13:47 +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.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Clementine Hayat Subject: [libvirt] [PATCH v2 3/9] test: 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 17 Apr 2018 22:14:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Clementine Hayat Reviewed-by: J=EF=BF=BDn Tomko --- src/test/test_driver.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index eec7a8292..43221e547 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1779,11 +1779,8 @@ static int testDomainDestroyFlags(virDomainPtr domai= n, if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(privdom) < 0) goto cleanup; - } =20 testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_DESTROYED); event =3D virDomainEventLifecycleNewFromObj(privdom, @@ -1921,11 +1918,8 @@ static int testDomainReboot(virDomainPtr domain, if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(privdom) < 0) goto cleanup; - } =20 virDomainObjSetState(privdom, VIR_DOMAIN_SHUTDOWN, VIR_DOMAIN_SHUTDOWN_USER); @@ -2049,11 +2043,8 @@ testDomainSaveFlags(virDomainPtr domain, const char = *path, if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(privdom) < 0) goto cleanup; - } =20 xml =3D virDomainDefFormat(privdom->def, privconn->caps, VIR_DOMAIN_DEF_FORMAT_SECURE); @@ -2255,11 +2246,8 @@ static int testDomainCoreDumpWithFormat(virDomainPtr= domain, if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(privdom) < 0) goto cleanup; - } =20 if ((fd =3D open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { virReportSystemError(errno, @@ -3231,11 +3219,8 @@ static int testDomainBlockStats(virDomainPtr domain, if (!(privdom =3D testDomObjFromDomain(domain))) return ret; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(privdom) < 0) goto error; - } =20 if (virDomainDiskIndexByName(privdom->def, path, false) < 0) { virReportError(VIR_ERR_INVALID_ARG, @@ -3278,11 +3263,8 @@ testDomainInterfaceStats(virDomainPtr domain, if (!(privdom =3D testDomObjFromDomain(domain))) return -1; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(privdom) < 0) goto error; - } =20 if (!(net =3D virDomainNetFind(privdom->def, device))) goto error; @@ -5962,11 +5944,8 @@ testDomainManagedSave(virDomainPtr dom, unsigned int= flags) if (!(vm =3D testDomObjFromDomain(dom))) return -1; =20 - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } =20 if (!vm->persistent) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list