From nobody Wed May 14 19:46:25 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 1521814648825840.4490796271112; Fri, 23 Mar 2018 07:17:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C95380C36; Fri, 23 Mar 2018 14:17:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5269917CC2; Fri, 23 Mar 2018 14:17:27 +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 18FF9180BAD3; Fri, 23 Mar 2018 14:17:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2NEHOYl031857 for ; Fri, 23 Mar 2018 10:17:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19B1B2023234; Fri, 23 Mar 2018 14:17:24 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.40.205.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20DD62023233 for ; Fri, 23 Mar 2018 14:17:22 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Fri, 23 Mar 2018 15:17:06 +0100 Message-Id: <20180323141707.6107-10-kkoukiou@redhat.com> In-Reply-To: <20180323141707.6107-1-kkoukiou@redhat.com> References: <20180323141707.6107-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 09/10] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 23 Mar 2018 14:17:28 +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 4b1a650..dcaca5e 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 cc4e692..9e13862 100644 --- a/src/domain.c +++ b/src/domain.c @@ -343,12 +343,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 e3f32ca..409633a 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.ShutdownFlags(0) domain.CreateWithFlags(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.UndefineFlags(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