From nobody Wed May 14 16:17:01 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 1521824305353299.90489386314846; Fri, 23 Mar 2018 09:58:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF9A928231; Fri, 23 Mar 2018 16:58:22 +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 917B49D986; Fri, 23 Mar 2018 16:58:22 +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 5162D4CA9C; Fri, 23 Mar 2018 16:58:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2NGwFdx008113 for ; Fri, 23 Mar 2018 12:58:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19EE0215CDAC; Fri, 23 Mar 2018 16:58:15 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.40.205.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1BC4215CDAA for ; Fri, 23 Mar 2018 16:58:14 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Fri, 23 Mar 2018 17:58:03 +0100 Message-Id: <20180323165804.29264-6-kkoukiou@redhat.com> In-Reply-To: <20180323165804.29264-1-kkoukiou@redhat.com> References: <20180323165804.29264-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 5/6] virtDBusDomainDestroy: Use virDomainDestroyFlags instead of virDomainDestroy 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 23 Mar 2018 16:58:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We need to catch Exceptions when testing this API call, since virDomainDest= royFlags will be supported in test-driver in 4.2.0 libvirt release. Better version checks for unsupported API calls need to be done in all test= s, but it's not relevant to this commit. When virConnectGetVersion will be supported we can move to better implement= ation, and python logging should be used to provide proper warnings for skipped te= sts. Signed-off-by: Katerina Koukiou --- data/org.libvirt.Domain.xml | 4 +++- src/domain.c | 5 ++++- test/test_domain.py | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 187f604..e79fb5e 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -27,7 +27,9 @@ - + + + diff --git a/src/domain.c b/src/domain.c index fd6609c..3c09351 100644 --- a/src/domain.c +++ b/src/domain.c @@ -344,12 +344,15 @@ virtDBusDomainDestroy(GVariant *inArgs G_GNUC_UNUSED, { virtDBusConnect *connect =3D userData; g_autoptr(virDomain) domain =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); =20 domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); if (!domain) return; =20 - if (virDomainDestroy(domain) < 0) + if (virDomainDestroyFlags(domain, flags) < 0) virtDBusUtilSetLastVirtError(error); } =20 diff --git a/test/test_domain.py b/test/test_domain.py index 8cd0d6a..73737d7 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -3,6 +3,7 @@ import dbus import libvirttest =20 +DBUS_EXCEPTION_MISSING_FUNCTION =3D 'this function is not supported by the= connection driver' =20 class TestDomain(libvirttest.BaseTestClass): def domain(self): @@ -34,7 +35,11 @@ class TestDomain(libvirttest.BaseTestClass): domain.Reboot(0) domain.Shutdown(0) domain.Create(0) - domain.Destroy() + try: + domain.Destroy(0) + except dbus.exceptions.DBusException as e: + if not any(DBUS_EXCEPTION_MISSING_FUNCTION in arg for arg in e= .args): + raise e domain.Undefine(0) =20 def test_shutdown(self): --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list