From nobody Wed Feb 11 11:34:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487923631620963.3234973911527; Fri, 24 Feb 2017 00:07:11 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1O84B4Z012208; Fri, 24 Feb 2017 03:04:12 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1O83XmX028221 for ; Fri, 24 Feb 2017 03:03:33 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1O83Xtb020084 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 24 Feb 2017 03:03:33 -0500 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0B218123E for ; Fri, 24 Feb 2017 08:03:32 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id o64so726879pfb.1 for ; Fri, 24 Feb 2017 00:03:31 -0800 (PST) Received: from localhost.net ([2601:647:4501:a0d1::9f97]) by smtp.googlemail.com with ESMTPSA id s5sm13610285pgc.57.2017.02.24.00.03.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 00:03:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Ei+MK+57iUZmECawm8SB42dDKEJUewkXvbzKpi4f02c=; b=dBTWHdtLQ528Dq2l0NiYcv1AQz4CuS95N98k39NQrxviqObh2smhxCsHDAQajvY8RK BXnu4bn9ssXmRJqEm3IdytmUOj8URZ7Htj5d2Y78BF80eV9vzP4bdY3+5zAPj25CDzuQ ncL621uEy7T5mHzZCDzUN9BSrok9tsPAfgBo2oo3V8lqyEal8PdBk3OXO+xlJUROgW1d rNSO3I2iBQnnAgntRSz18tytORGVMGQ+rIsuvD1vCy01hiwJqVO0xKVYtr1MCZY8qrvv UgYNY4qDQbVUaWS8ErwX/YYbf8dmffKZen0ceRp1zuiJd6I1FmnmGi8US7huEMe+G3jJ dPFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Ei+MK+57iUZmECawm8SB42dDKEJUewkXvbzKpi4f02c=; b=RTZKnKHAYNbI3Fnp7KVfC7DDOwuS6w3HrV5jE4XOJ6JpOCaQqfix/WzxcbEfBffYGp FkvML3lZ0tA/ITFMGgn1aWPncaRVMrpadPol+J9vGy91ISib1LQfBEKbNsFTNZtFBobQ Rdid2avMYDsVgWC/ZcqoPGG695NGr6q57aOgdykzAVaoUvHaLLAnV+96H8tn0+wkG9eW 0J7ql/9NMC+IAhKPLoq0A8frIomK9CgV1xz6vDlijiNU8C9C9AbXC/nuIx7D2EdDoFkt kRS0KSUu7xd3bXGTpjRcXXUF4n+9DViJ9ML+4VOyDpOnRByuNDom0HVfMbnqtMKjVno8 XrbQ== X-Gm-Message-State: AMke39lsoaSe9QYH2n1a1nOhRespwQRIBaksfP7V3fP4O8g/WVZ0Xtlos4wZFLLyVquqjA== X-Received: by 10.99.228.69 with SMTP id i5mr1896857pgk.63.1487923411075; Fri, 24 Feb 2017 00:03:31 -0800 (PST) From: Sagar Ghuge To: libvir-list@redhat.com Date: Fri, 24 Feb 2017 00:03:13 -0800 Message-Id: <20170224080314.23074-3-ghugesss@gmail.com> In-Reply-To: <20170224080314.23074-1-ghugesss@gmail.com> References: <20170224080314.23074-1-ghugesss@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 24 Feb 2017 08:03:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 24 Feb 2017 08:03:32 +0000 (UTC) for IP:'209.85.192.193' DOMAIN:'mail-pf0-f193.google.com' HELO:'mail-pf0-f193.google.com' FROM:'ghugesss@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.482 (BAYES_50, DCC_REPUT_13_19, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.192.193 mail-pf0-f193.google.com 209.85.192.193 mail-pf0-f193.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] change virDomainObjIsActive with virDomainObjCheckIsActive 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Sagar Ghuge --- 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 5fef3f1..bbcaa44 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1769,11 +1769,8 @@ static int testDomainDestroy(virDomainPtr domain) if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckIsActive(privdom) < 0) goto cleanup; - } =20 testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_DESTROYED); event =3D virDomainEventLifecycleNewFromObj(privdom, @@ -1902,11 +1899,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 (virDomainObjCheckIsActive(privdom) < 0) goto cleanup; - } =20 virDomainObjSetState(privdom, VIR_DOMAIN_SHUTDOWN, VIR_DOMAIN_SHUTDOWN_USER); @@ -2028,11 +2022,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 (virDomainObjCheckIsActive(privdom) < 0) goto cleanup; - } =20 xml =3D virDomainDefFormat(privdom->def, privconn->caps, VIR_DOMAIN_DEF_FORMAT_SECURE); @@ -2232,11 +2223,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 (virDomainObjCheckIsActive(privdom) < 0) goto cleanup; - } =20 if ((fd =3D open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { virReportSystemError(errno, @@ -3126,11 +3114,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 (virDomainObjCheckIsActive(privdom) < 0) goto error; - } =20 if (virDomainDiskIndexByName(privdom->def, path, false) < 0) { virReportError(VIR_ERR_INVALID_ARG, @@ -3171,11 +3156,8 @@ static int testDomainInterfaceStats(virDomainPtr dom= ain, if (!(privdom =3D testDomObjFromDomain(domain))) return -1; =20 - if (!virDomainObjIsActive(privdom)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckIsActive(privdom) < 0) goto error; - } =20 for (i =3D 0; i < privdom->def->nnets; i++) { if (privdom->def->nets[i]->ifname && @@ -6065,11 +6047,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 (virDomainObjCheckIsActive(vm) < 0) goto cleanup; - } =20 if (!vm->persistent) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list