From nobody Wed Nov 27 18:30:02 2024 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 153753693069610.752828924552773; Fri, 21 Sep 2018 06:35:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9961E30001E1; Fri, 21 Sep 2018 13:35: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 3588F106A78A; Fri, 21 Sep 2018 13:35: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 AEF9F181A12F; Fri, 21 Sep 2018 13:35:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZPeZ022025 for ; Fri, 21 Sep 2018 09:35:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id E79CA82066; Fri, 21 Sep 2018 13:35:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF5DD17CCB for ; Fri, 21 Sep 2018 13:35:22 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8F4BBCD3F for ; Fri, 21 Sep 2018 13:35:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id BFD3B32A7BD5 for ; Fri, 21 Sep 2018 15:35:19 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LYLbbPjWIpyj; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id E293132A7BAB; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 8D13215F545; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:34:56 +0200 Message-Id: <96f310adef218635e585869ea2464cd3471e9df5.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Sep 2018 13:35:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Sep 2018 13:35:21 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 01/22] event-test.py: Handle closed connection 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 21 Sep 2018 13:35:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If libvirtd terminates while event-test.py has an open connection to it, it will crash with the following traceback: > myConnectionCloseCallback: qemu:///session: Error > Exception in thread libvirtEventLoop: > Traceback (most recent call last): > File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner > self.run() > File "/usr/lib/python2.7/threading.py", line 754, in run > self.__target(*self.__args, **self.__kwargs) > File "examples/event-test.py", line 424, in virEventLoopPollRun > eventLoop.run_loop() > File "examples/event-test.py", line 242, in run_loop > self.run_once() > File "examples/event-test.py", line 187, in run_once > libvirt.virEventInvokeFreeCallback(opaque) > AttributeError: 'module' object has no attribute 'virEventInvokeFreeCallb= ack' > > libvirt: XML-RPC error : internal error: client socket is closed > Traceback (most recent call last): > File "examples/event-test.py", line 872, in > main() > File "examples/event-test.py", line 854, in main > vc.secretEventDeregisterAny(id) > File "/usr/lib/python2.7/dist-packages/libvirt.py", line 4987, in secre= tEventDeregisterAny > if ret =3D=3D -1: raise libvirtError ('virConnectSecretEventDeregiste= rAny() failed', conn=3Dself) > libvirt.libvirtError: internal error: client socket is closed > Closing qemu:///session Skip unregistering the event callbacks and closing the connection if the connection is already broken / closed. Signed-off-by: Philipp Hahn --- examples/event-test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index 04310e1..c17d2bb 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -716,7 +716,8 @@ def main(): old_exitfunc =3D getattr(sys, 'exitfunc', None) def exit(): print("Closing " + vc.getURI()) - vc.close() + if run: + vc.close() if (old_exitfunc): old_exitfunc() sys.exitfunc =3D exit =20 @@ -777,6 +778,11 @@ def main(): count =3D count + 1 time.sleep(1) =20 + # If the connection was closed, we cannot unregister anything. + # Just abort now. + if not run: + return + vc.domainEventDeregister(myDomainEventCallback1) =20 for id in seccallbacks: --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 153753694067048.07842092864303; Fri, 21 Sep 2018 06:35:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 636A5723D9; Fri, 21 Sep 2018 13:35:38 +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 2C60360CD8; Fri, 21 Sep 2018 13:35:38 +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 CE04C4A469; Fri, 21 Sep 2018 13:35:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZPEe022024 for ; Fri, 21 Sep 2018 09:35:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id E23CB3091390; Fri, 21 Sep 2018 13:35:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA1BF309137F for ; Fri, 21 Sep 2018 13:35:22 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 709B63073A1F for ; Fri, 21 Sep 2018 13:35:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 32F9432A7BE0 for ; Fri, 21 Sep 2018 15:35:20 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AwgafK21nlzw; Fri, 21 Sep 2018 15:35:19 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id E5F0332A7BAC; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 8F01515F592; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:34:57 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 21 Sep 2018 13:35:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 21 Sep 2018 13:35:21 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 02/22] event-test.py: Remove extra parenthesis 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Sep 2018 13:35:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Philipp Hahn --- examples/event-test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index c17d2bb..a7c7054 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -224,7 +224,7 @@ class virEventLoopPoll: want =3D t.get_last_fired() + interval # Deduct 20ms, since scheduler timeslice # means we could be ever so slightly early - if now >=3D (want-20): + if now >=3D want - 20: debug("Dispatch timer %d now %s want %s" % (t.get_id()= , str(now), str(want))) t.set_last_fired(now) t.dispatch() --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536944827449.47431719535405; Fri, 21 Sep 2018 06:35:44 -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 C0F5488E73; Fri, 21 Sep 2018 13:35:42 +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 8543F8207D; Fri, 21 Sep 2018 13:35:42 +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 2575F4A46C; Fri, 21 Sep 2018 13:35:42 +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 w8LDZQsF022044 for ; Fri, 21 Sep 2018 09:35:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 657DA17D99; Fri, 21 Sep 2018 13:35:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5AA155DE01 for ; Fri, 21 Sep 2018 13:35:23 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5EF6B308212A for ; Fri, 21 Sep 2018 13:35:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 3351832A7BF4 for ; Fri, 21 Sep 2018 15:35:21 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EWutB9cKYAYU; Fri, 21 Sep 2018 15:35:20 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id EC62232A7BAD; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 9060415F5A8; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:34:58 +0200 Message-Id: <5700e76510a2a2845d2f1d17e4195486d6a5d390.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 21 Sep 2018 13:35:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 21 Sep 2018 13:35:22 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 03/22] event-test.py: Remove dead assignment 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.25]); Fri, 21 Sep 2018 13:35:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" variable is unused Signed-off-by: Philipp Hahn --- examples/event-test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index a7c7054..1f34930 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -207,7 +207,7 @@ class virEventLoopPoll: # the data just continue if fd =3D=3D self.pipetrick[0]: self.pendingWakeup =3D False - data =3D os.read(fd, 1) + os.read(fd, 1) continue =20 h =3D self.get_handle_by_fd(fd) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536944952448.93258135730684; Fri, 21 Sep 2018 06:35:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF0A42C977C; Fri, 21 Sep 2018 13:35:42 +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 7ED872010DAC; Fri, 21 Sep 2018 13:35:42 +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 296BC181A13C; Fri, 21 Sep 2018 13:35:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZQ0o022039 for ; Fri, 21 Sep 2018 09:35:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50B0A2010D99; Fri, 21 Sep 2018 13:35:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4820E2010D0A for ; Fri, 21 Sep 2018 13:35:23 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E14BE308ED54 for ; Fri, 21 Sep 2018 13:35:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id B347E32A7BEA for ; Fri, 21 Sep 2018 15:35:20 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RPRrS7gqewjt; Fri, 21 Sep 2018 15:35:19 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id F0DB132A7BAE; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 93D9215F631; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:34:59 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 21 Sep 2018 13:35:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 21 Sep 2018 13:35:22 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 04/22] event-test.py: Add missing globale statement 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 21 Sep 2018 13:35:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to fix loop termination on exit. Signed-off-by: Philipp Hahn --- examples/event-test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/event-test.py b/examples/event-test.py index 1f34930..646ce50 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -663,6 +663,7 @@ def myConnectionCloseCallback(conn, reason, opaque): "Error", "End-of-file", "Keepalive", "Client", ) print("myConnectionCloseCallback: %s: %s" % (conn.getURI(), reasonStri= ngs[reason])) + global run run =3D False =20 def usage(): --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536949013999.8291948971859; Fri, 21 Sep 2018 06:35:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0AED6C025D0C; Fri, 21 Sep 2018 13:35:47 +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 C752087E22; Fri, 21 Sep 2018 13:35:46 +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 71CF84A46C; Fri, 21 Sep 2018 13:35:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZRXi022058 for ; Fri, 21 Sep 2018 09:35:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E35A7DFDB; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64BF47DFD9 for ; Fri, 21 Sep 2018 13:35:24 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93B433003D34 for ; Fri, 21 Sep 2018 13:35:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id AB68832A7BFE for ; Fri, 21 Sep 2018 15:35:21 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hpikmCY1od0q; Fri, 21 Sep 2018 15:35:20 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 2F33D32A7BB3; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 97A5615F657; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:00 +0200 Message-Id: <7f800449d5194a167e39fd75971340640c7b3f59.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:23 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 05/22] event-test.py: Use __file__ 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 21 Sep 2018 13:35:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" instead of sys.argv[0] Signed-off-by: Philipp Hahn --- examples/event-test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index 646ce50..ab1da4a 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -667,7 +667,7 @@ def myConnectionCloseCallback(conn, reason, opaque): run =3D False =20 def usage(): - print("usage: "+os.path.basename(sys.argv[0])+" [-hdl] [uri]") + print("usage: %s [-hdl] [uri]" % (os.path.basename(__file__),)) print(" uri will default to qemu:///system") print(" --help, -h Print this help message") print(" --debug, -d Print debug output") --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 153753694917297.77848144579877; Fri, 21 Sep 2018 06:35:49 -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 1A96E40F2B; Fri, 21 Sep 2018 13:35:47 +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 D658E7DFDA; Fri, 21 Sep 2018 13:35:46 +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 86587181A531; Fri, 21 Sep 2018 13:35:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZSgY022079 for ; Fri, 21 Sep 2018 09:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6788E308BDB0; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D352308BDB3 for ; Fri, 21 Sep 2018 13:35:24 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93ED980467 for ; Fri, 21 Sep 2018 13:35:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 4728D32A7C0B for ; Fri, 21 Sep 2018 15:35:22 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jfDaXM0JvT81; Fri, 21 Sep 2018 15:35:21 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 3839D32A7BB4; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 9B3F615F8EA; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:01 +0200 Message-Id: <17d5f6a465a91d70c60f5339f5a7be187473d33c.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Sep 2018 13:35:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Sep 2018 13:35:23 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 06/22] event-test.py: Merge livecycle callbacks 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.30]); Fri, 21 Sep 2018 13:35:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Registering the same function twice using the old domainEventRegister() interface would not work, as the function reference is used for un-registering. But it is not a problem with the new interface domainEventRegisterAn(), as that returns a unique ID. While at it also demonstrate the 'opaque' mechanism. Signed-off-by: Philipp Hahn --- examples/event-test.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index ab1da4a..2dcdee3 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -499,15 +499,11 @@ def agentLifecycleReasonToString(reason): agentReasons =3D ( "unknown", "domain started", "channel event", ) return agentReasons[reason] =20 -def myDomainEventCallback1 (conn, dom, event, detail, opaque): - print("myDomainEventCallback1 EVENT: Domain %s(%s) %s %s" % (dom.name(= ), dom.ID(), - domEventT= oString(event), - domDetail= ToString(event, detail))) =20 -def myDomainEventCallback2 (conn, dom, event, detail, opaque): - print("myDomainEventCallback2 EVENT: Domain %s(%s) %s %s" % (dom.name(= ), dom.ID(), - domEventT= oString(event), - domDetail= ToString(event, detail))) +def myDomainEventCallback(conn, dom, event, detail, opaque): + print("myDomainEventCallback%d EVENT: Domain %s(%s) %s %s" % ( + opaque, dom.name(), dom.ID(), domEventToString(event), domDetailTo= String(event, detail))) + =20 def myDomainEventRebootCallback(conn, dom, opaque): print("myDomainEventRebootCallback: Domain %s(%s)" % (dom.name(), dom.= ID())) @@ -725,9 +721,9 @@ def main(): vc.registerCloseCallback(myConnectionCloseCallback, None) =20 #Add 2 lifecycle callbacks to prove this works with more than just one - vc.domainEventRegister(myDomainEventCallback1,None) + vc.domainEventRegister(myDomainEventCallback, 1) domcallbacks =3D [] - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_LIFECYCLE, myDomainEventCallback2, None)) + domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_LIFECYCLE, myDomainEventCallback, 2)) domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_REBOOT, myDomainEventRebootCallback, None)) domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_RTC_CHANGE, myDomainEventRTCChangeCallback, None)) domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_WATCHDOG, myDomainEventWatchdogCallback, None)) @@ -784,7 +780,7 @@ def main(): if not run: return =20 - vc.domainEventDeregister(myDomainEventCallback1) + vc.domainEventDeregister(myDomainEventCallback) =20 for id in seccallbacks: vc.secretEventDeregisterAny(id) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 153753696783241.51415220820434; Fri, 21 Sep 2018 06:36:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7657831676BC; Fri, 21 Sep 2018 13:36:05 +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 2EF47106A7BC; Fri, 21 Sep 2018 13:36:05 +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 CD4CB4A47B; Fri, 21 Sep 2018 13:36:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZeg6022217 for ; Fri, 21 Sep 2018 09:35:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id C035062666; Fri, 21 Sep 2018 13:35:40 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7A1A62660 for ; Fri, 21 Sep 2018 13:35:40 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FB8E30944B3 for ; Fri, 21 Sep 2018 13:35:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 27EC332A7CDD for ; Fri, 21 Sep 2018 15:35:38 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4rPdwKMeoPFF; Fri, 21 Sep 2018 15:35:37 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 407A332A7BB5; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 9F40515F926; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:02 +0200 Message-Id: <6f30403cafa776965b8240970e105497c1a957a0.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 21 Sep 2018 13:35:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 21 Sep 2018 13:35:39 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 07/22] event-test.py: Simplify event ID lists 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Sep 2018 13:36:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" by directly building the list with the IDs instead of appending them explicitly. Signed-off-by: Philipp Hahn --- examples/event-test.py | 87 ++++++++++++++++++++++++++--------------------= ---- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 2dcdee3..91a7cb7 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -722,47 +722,52 @@ def main(): =20 #Add 2 lifecycle callbacks to prove this works with more than just one vc.domainEventRegister(myDomainEventCallback, 1) - domcallbacks =3D [] - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_LIFECYCLE, myDomainEventCallback, 2)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_REBOOT, myDomainEventRebootCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_RTC_CHANGE, myDomainEventRTCChangeCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_WATCHDOG, myDomainEventWatchdogCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_IO_ERROR, myDomainEventIOErrorCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_GRAPHICS, myDomainEventGraphicsCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_IO_ERROR_REASON, myDomainEventIOErrorReasonCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_CONTROL_ERROR, myDomainEventControlErrorCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_BLOCK_JOB, myDomainEventBlockJobCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_DISK_CHANGE, myDomainEventDiskChangeCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_TRAY_CHANGE, myDomainEventTrayChangeCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_PMWAKEUP, myDomainEventPMWakeupCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_PMSUSPEND, myDomainEventPMSuspendCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_BALLOON_CHANGE, myDomainEventBalloonChangeCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_PMSUSPEND_DISK, myDomainEventPMSuspendDiskCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_DEVICE_REMOVED, myDomainEventDeviceRemovedCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_BLOCK_JOB_2, myDomainEventBlockJob2Callback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_TUNABLE, myDomainEventTunableCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_AGENT_LIFECYCLE, myDomainEventAgentLifecycleCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_DEVICE_ADDED, myDomainEventDeviceAddedCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_MIGRATION_ITERATION, myDomainEventMigrationIteration, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_JOB_COMPLETED, myDomainEventJobCompletedCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback, = None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_METADATA_CHANGE, myDomainEventMetadataChangeCallback, None)) - domcallbacks.append(vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN= _EVENT_ID_BLOCK_THRESHOLD, myDomainEventBlockThresholdCallback, None)) - - netcallbacks =3D [] - netcallbacks.append(vc.networkEventRegisterAny(None, libvirt.VIR_NETWO= RK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None)) - - poolcallbacks =3D [] - poolcallbacks.append(vc.storagePoolEventRegisterAny(None, libvirt.VIR_= STORAGE_POOL_EVENT_ID_LIFECYCLE, myStoragePoolEventLifecycleCallback, None)) - poolcallbacks.append(vc.storagePoolEventRegisterAny(None, libvirt.VIR_= STORAGE_POOL_EVENT_ID_REFRESH, myStoragePoolEventRefreshCallback, None)) - - devcallbacks =3D [] - devcallbacks.append(vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NO= DE_DEVICE_EVENT_ID_LIFECYCLE, myNodeDeviceEventLifecycleCallback, None)) - devcallbacks.append(vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NO= DE_DEVICE_EVENT_ID_UPDATE, myNodeDeviceEventUpdateCallback, None)) - - seccallbacks =3D [] - seccallbacks.append(vc.secretEventRegisterAny(None, libvirt.VIR_SECRET= _EVENT_ID_LIFECYCLE, mySecretEventLifecycleCallback, None)) - seccallbacks.append(vc.secretEventRegisterAny(None, libvirt.VIR_SECRET= _EVENT_ID_VALUE_CHANGED, mySecretEventValueChanged, None)) + domcallbacks =3D [ + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_LIFECY= CLE, myDomainEventCallback, 2), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_REBOOT= , myDomainEventRebootCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_RTC_CH= ANGE, myDomainEventRTCChangeCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_WATCHD= OG, myDomainEventWatchdogCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_IO_ERR= OR, myDomainEventIOErrorCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_GRAPHI= CS, myDomainEventGraphicsCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_IO_ERR= OR_REASON, myDomainEventIOErrorReasonCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_CONTRO= L_ERROR, myDomainEventControlErrorCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_= JOB, myDomainEventBlockJobCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DISK_C= HANGE, myDomainEventDiskChangeCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TRAY_C= HANGE, myDomainEventTrayChangeCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMWAKE= UP, myDomainEventPMWakeupCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMSUSP= END, myDomainEventPMSuspendCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BALLOO= N_CHANGE, myDomainEventBalloonChangeCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMSUSP= END_DISK, myDomainEventPMSuspendDiskCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE= _REMOVED, myDomainEventDeviceRemovedCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_= JOB_2, myDomainEventBlockJob2Callback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TUNABL= E, myDomainEventTunableCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_AGENT_= LIFECYCLE, myDomainEventAgentLifecycleCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE= _ADDED, myDomainEventDeviceAddedCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_MIGRAT= ION_ITERATION, myDomainEventMigrationIteration, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_JOB_CO= MPLETED, myDomainEventJobCompletedCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE= _REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_METADA= TA_CHANGE, myDomainEventMetadataChangeCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_= THRESHOLD, myDomainEventBlockThresholdCallback, None), + ] + + netcallbacks =3D [ + vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFE= CYCLE, myNetworkEventLifecycleCallback, None), + ] + + poolcallbacks =3D [ + vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVEN= T_ID_LIFECYCLE, myStoragePoolEventLifecycleCallback, None), + vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVEN= T_ID_REFRESH, myStoragePoolEventRefreshCallback, None), + ] + + devcallbacks =3D [ + vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NODE_DEVICE_EVENT_= ID_LIFECYCLE, myNodeDeviceEventLifecycleCallback, None), + vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NODE_DEVICE_EVENT_= ID_UPDATE, myNodeDeviceEventUpdateCallback, None), + ] + + seccallbacks =3D [ + vc.secretEventRegisterAny(None, libvirt.VIR_SECRET_EVENT_ID_LIFECY= CLE, mySecretEventLifecycleCallback, None), + vc.secretEventRegisterAny(None, libvirt.VIR_SECRET_EVENT_ID_VALUE_= CHANGED, mySecretEventValueChanged, None), + ] =20 vc.setKeepAlive(5, 3) =20 --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536978472128.95014650274084; Fri, 21 Sep 2018 06:36:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 88238300125B; Fri, 21 Sep 2018 13:36:16 +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 5A6218923F; Fri, 21 Sep 2018 13:36:16 +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 EBC974A46D; Fri, 21 Sep 2018 13:36:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZc0Q022197 for ; Fri, 21 Sep 2018 09:35:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 40AD480F75; Fri, 21 Sep 2018 13:35:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33DBC80F64 for ; Fri, 21 Sep 2018 13:35:38 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22A2A30A7B8E for ; Fri, 21 Sep 2018 13:35:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id E733032A7CD3 for ; Fri, 21 Sep 2018 15:35:35 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GwPf8MYB4_C0; Fri, 21 Sep 2018 15:35:34 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 4A75A32A7BB6; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id A307E15F9AC; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:03 +0200 Message-Id: <0b15786962f21f0cabd1bd0a9138b2a830055a1d.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:37 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 08/22] event-test.py: Add class for event descriptions 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 21 Sep 2018 13:36:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Philipp Hahn --- examples/event-test.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/event-test.py b/examples/event-test.py index 91a7cb7..d2d2c60 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -456,6 +456,31 @@ def virEventLoopNativeStart(): ########################################################################## # Everything that now follows is a simple demo of domain lifecycle events ########################################################################## +class Description(object): + __slots__ =3D ('desc', 'args') + + def __init__(self, *args, **kwargs): + self.desc =3D kwargs.get('desc') + self.args =3D args + + def __str__(self): # type: () -> str + return self.desc + + def __getitem__(self, item): # type: (int) -> str + try: + data =3D self.args[item] + except IndexError: + return self.__class__(desc=3Dstr(item)) + + if isinstance(data, str): + return self.__class__(desc=3Ddata) + elif isinstance(data, (list, tuple)): + desc, args =3D data + return self.__class__(*args, desc=3Ddesc) + + raise TypeError(args) + + def domEventToString(event): domEventStrings =3D ( "Defined", "Undefined", --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 153753694995895.43955971990852; Fri, 21 Sep 2018 06:35:49 -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 2EE22CA1E7; Fri, 21 Sep 2018 13:35:48 +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 EAD6417119; Fri, 21 Sep 2018 13:35:47 +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 A13D8181A71E; Fri, 21 Sep 2018 13:35:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZSmX022104 for ; Fri, 21 Sep 2018 09:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id C36CE2010D0A; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA7D22010D99 for ; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8669830034AB for ; Fri, 21 Sep 2018 13:35:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 55EC032A7C36 for ; Fri, 21 Sep 2018 15:35:24 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ocnnYnZNU5Di; Fri, 21 Sep 2018 15:35:23 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 673FD32A7BBB; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id A7A0A160F1F; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:04 +0200 Message-Id: <8a66389c68460d0dc44dc83e5f72cc513f69de92.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:25 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 09/22] event-test.py: Convert LIVECYCLE events 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.38]); Fri, 21 Sep 2018 13:35:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index d2d2c60..493828f 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -481,32 +481,18 @@ class Description(object): raise TypeError(args) =20 =20 -def domEventToString(event): - domEventStrings =3D ( "Defined", - "Undefined", - "Started", - "Suspended", - "Resumed", - "Stopped", - "Shutdown", - "PMSuspended", - "Crashed", - ) - return domEventStrings[event] - -def domDetailToString(event, detail): - domEventStrings =3D ( - ( "Added", "Updated", "Renamed", "Snapshot" ), - ( "Removed", "Renamed", ), - ( "Booted", "Migrated", "Restored", "Snapshot", "Wakeup" ), - ( "Paused", "Migrated", "IOError", "Watchdog", "Restored", "Snapsh= ot", "API error", "Postcopy", "Postcopy failed" ), - ( "Unpaused", "Migrated", "Snapshot", "Postcopy" ), - ( "Shutdown", "Destroyed", "Crashed", "Migrated", "Saved", "Failed= ", "Snapshot"), - ( "Finished", "On guest request", "On host request"), - ( "Memory", "Disk" ), - ( "Panicked", ), - ) - return domEventStrings[event][detail] +DOM_EVENTS =3D Description( + ("Defined", ("Added", "Updated", "Renamed", "Snapshot")), + ("Undefined", ("Removed", "Renamed")), + ("Started", ("Booted", "Migrated", "Restored", "Snapshot", "Wakeup")), + ("Suspended", ("Paused", "Migrated", "IOError", "Watchdog", "Restored"= , "Snapshot", "API error", "Postcopy", "Postcopy failed")), + ("Resumed", ("Unpaused", "Migrated", "Snapshot", "Postcopy")), + ("Stopped", ("Shutdown", "Destroyed", "Crashed", "Migrated", "Saved", = "Failed", "Snapshot")), + ("Shutdown", ("Finished", "On guest request", "On host request")), + ("PMSuspended", ("Memory", "Disk")), + ("Crashed", ("Panicked",)), +) + =20 def blockJobTypeToString(type): blockJobTypes =3D ( "unknown", "Pull", "Copy", "Commit", "ActiveCommit= ", ) @@ -526,8 +512,8 @@ def agentLifecycleReasonToString(reason): =20 =20 def myDomainEventCallback(conn, dom, event, detail, opaque): - print("myDomainEventCallback%d EVENT: Domain %s(%s) %s %s" % ( - opaque, dom.name(), dom.ID(), domEventToString(event), domDetailTo= String(event, detail))) + print("myDomainEventCallback%s EVENT: Domain %s(%s) %s %s" % ( + opaque, dom.name(), dom.ID(), DOM_EVENTS[event], DOM_EVENTS[event]= [detail])) =20 =20 def myDomainEventRebootCallback(conn, dom, opaque): --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536940876320.7124386699893; Fri, 21 Sep 2018 06:35:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AA2C30A7BB6; Fri, 21 Sep 2018 13:35:39 +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 E8DFC2010D0A; Fri, 21 Sep 2018 13:35:38 +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 9581B181A369; Fri, 21 Sep 2018 13:35:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZRab022059 for ; Fri, 21 Sep 2018 09:35:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6F19D7DFDC; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68D677DFDA for ; Fri, 21 Sep 2018 13:35:26 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A518A0C4E for ; Fri, 21 Sep 2018 13:35:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id EA18232A7C2C for ; Fri, 21 Sep 2018 15:35:23 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a5I2rY8BrRhS; Fri, 21 Sep 2018 15:35:22 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 5F03332A7BBA; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id AAA2F160F21; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:05 +0200 Message-Id: <6e4fa233f39d23c13351419a70f24e78f1f0f617.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Sep 2018 13:35:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Sep 2018 13:35:25 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 10/22] event-test.py: Convert BLOCKJOB events 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 13:35:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 493828f..46a8db8 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -492,15 +492,8 @@ DOM_EVENTS =3D Description( ("PMSuspended", ("Memory", "Disk")), ("Crashed", ("Panicked",)), ) - - -def blockJobTypeToString(type): - blockJobTypes =3D ( "unknown", "Pull", "Copy", "Commit", "ActiveCommit= ", ) - return blockJobTypes[type] - -def blockJobStatusToString(status): - blockJobStatus =3D ( "Completed", "Failed", "Canceled", "Ready", ) - return blockJobStatus[status] +BLOCK_JOB_TYPES =3D Description("unknown", "Pull", "Copy", "Commit", "Acti= veCommit") +BLOCK_JOB_STATUS =3D Description("Completed", "Failed", "Canceled", "Ready= ") =20 def agentLifecycleStateToString(state): agentStates =3D ( "unknown", "connected", "disconnected", ) @@ -533,8 +526,13 @@ def myDomainEventGraphicsCallback(conn, dom, phase, lo= calAddr, remoteAddr, authS print("myDomainEventGraphicsCallback: Domain %s(%s) %d %s" % (dom.name= (), dom.ID(), phase, authScheme)) def myDomainEventControlErrorCallback(conn, dom, opaque): print("myDomainEventControlErrorCallback: Domain %s(%s)" % (dom.name()= , dom.ID())) + + def myDomainEventBlockJobCallback(conn, dom, disk, type, status, opaque): - print("myDomainEventBlockJobCallback: Domain %s(%s) %s on disk %s %s" = % (dom.name(), dom.ID(), blockJobTypeToString(type), disk, blockJobStatusTo= String(status))) + print("myDomainEventBlockJobCallback: Domain %s(%s) %s on disk %s %s" = % ( + dom.name(), dom.ID(), BLOCK_JOB_TYPES[type], disk, BLOCK_JOB_STATU= S[status])) + + def myDomainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, dev= Alias, reason, opaque): print("myDomainEventDiskChangeCallback: Domain %s(%s) disk change oldS= rcPath: %s newSrcPath: %s devAlias: %s reason: %s" % ( dom.name(), dom.ID(), oldSrcPath, newSrcPath, devAlias, reason= )) @@ -555,8 +553,13 @@ def myDomainEventPMSuspendDiskCallback(conn, dom, reas= on, opaque): def myDomainEventDeviceRemovedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceRemovedCallback: Domain %s(%s) device remove= d: %s" % ( dom.name(), dom.ID(), dev)) + + def myDomainEventBlockJob2Callback(conn, dom, disk, type, status, opaque): - print("myDomainEventBlockJob2Callback: Domain %s(%s) %s on disk %s %s"= % (dom.name(), dom.ID(), blockJobTypeToString(type), disk, blockJobStatusT= oString(status))) + print("myDomainEventBlockJob2Callback: Domain %s(%s) %s on disk %s %s"= % ( + dom.name(), dom.ID(), BLOCK_JOB_TYPES[type], disk, BLOCK_JOB_STATU= S[status])) + + def myDomainEventTunableCallback(conn, dom, params, opaque): print("myDomainEventTunableCallback: Domain %s(%s) %s" % (dom.name(), = dom.ID(), params)) def myDomainEventAgentLifecycleCallback(conn, dom, state, reason, opaque): --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536933524432.86080543058597; Fri, 21 Sep 2018 06:35:33 -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 B38F38046B; Fri, 21 Sep 2018 13:35:31 +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 72F777EA33; Fri, 21 Sep 2018 13:35:31 +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 242B3181A139; Fri, 21 Sep 2018 13:35:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZRIf022052 for ; Fri, 21 Sep 2018 09:35:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C1433091391; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13EBB309137F for ; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EF71C074F09 for ; Fri, 21 Sep 2018 13:35:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id E90A132A7C40 for ; Fri, 21 Sep 2018 15:35:24 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CTm7ExtoLVdd; Fri, 21 Sep 2018 15:35:24 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 6C30332A7BBC; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id ADEB2160F2D; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:06 +0200 Message-Id: <4196d5870d34f3b6c1335c847a0326ecc4b054b0.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 21 Sep 2018 13:35:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 21 Sep 2018 13:35:26 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 11/22] event-test.py: Convert WATCHDOG events 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.28]); Fri, 21 Sep 2018 13:35:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index 46a8db8..004a263 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -494,6 +494,7 @@ DOM_EVENTS =3D Description( ) BLOCK_JOB_TYPES =3D Description("unknown", "Pull", "Copy", "Commit", "Acti= veCommit") BLOCK_JOB_STATUS =3D Description("Completed", "Failed", "Canceled", "Ready= ") +WATCHDOG_ACTIONS =3D Description("none", "Pause", "Reset", "Poweroff", "Sh= utdown", "Debug", "Inject NMI") =20 def agentLifecycleStateToString(state): agentStates =3D ( "unknown", "connected", "disconnected", ) @@ -515,8 +516,11 @@ def myDomainEventRebootCallback(conn, dom, opaque): def myDomainEventRTCChangeCallback(conn, dom, utcoffset, opaque): print("myDomainEventRTCChangeCallback: Domain %s(%s) %d" % (dom.name()= , dom.ID(), utcoffset)) =20 + def myDomainEventWatchdogCallback(conn, dom, action, opaque): - print("myDomainEventWatchdogCallback: Domain %s(%s) %d" % (dom.name(),= dom.ID(), action)) + print("myDomainEventWatchdogCallback: Domain %s(%s) %s" % ( + dom.name(), dom.ID(), WATCHDOG_ACTIONS[action])) + =20 def myDomainEventIOErrorCallback(conn, dom, srcpath, devalias, action, opa= que): print("myDomainEventIOErrorCallback: Domain %s(%s) %s %s %d" % (dom.na= me(), dom.ID(), srcpath, devalias, action)) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 153753696168075.12940707845303; Fri, 21 Sep 2018 06:36:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA8199B45A; Fri, 21 Sep 2018 13:35:58 +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 88874309137F; Fri, 21 Sep 2018 13:35:58 +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 3921F181A8C4; Fri, 21 Sep 2018 13:35:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZYvX022154 for ; Fri, 21 Sep 2018 09:35:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B9B317119; Fri, 21 Sep 2018 13:35:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03B437EE2F for ; Fri, 21 Sep 2018 13:35:30 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC3AA30832C5 for ; Fri, 21 Sep 2018 13:35:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 73D3632A7C8B for ; Fri, 21 Sep 2018 15:35:28 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zMtzhg4mjeFX; Fri, 21 Sep 2018 15:35:27 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 812AC32A7BC3; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id B105A160F2E; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:07 +0200 Message-Id: <6854fba9919a643e4ad765f4e899b48464559e67.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 21 Sep 2018 13:35:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 21 Sep 2018 13:35:29 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 12/22] event-test.py: Convert ERROR events 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Sep 2018 13:36:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index 004a263..4a801b7 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -495,6 +495,7 @@ DOM_EVENTS =3D Description( BLOCK_JOB_TYPES =3D Description("unknown", "Pull", "Copy", "Commit", "Acti= veCommit") BLOCK_JOB_STATUS =3D Description("Completed", "Failed", "Canceled", "Ready= ") WATCHDOG_ACTIONS =3D Description("none", "Pause", "Reset", "Poweroff", "Sh= utdown", "Debug", "Inject NMI") +ERROR_EVENTS =3D Description("None", "Pause", "Report") =20 def agentLifecycleStateToString(state): agentStates =3D ( "unknown", "connected", "disconnected", ) @@ -524,8 +525,13 @@ def myDomainEventWatchdogCallback(conn, dom, action, o= paque): =20 def myDomainEventIOErrorCallback(conn, dom, srcpath, devalias, action, opa= que): print("myDomainEventIOErrorCallback: Domain %s(%s) %s %s %d" % (dom.na= me(), dom.ID(), srcpath, devalias, action)) + + def myDomainEventIOErrorReasonCallback(conn, dom, srcpath, devalias, actio= n, reason, opaque): - print("myDomainEventIOErrorReasonCallback: Domain %s(%s) %s %s %d %s" = % (dom.name(), dom.ID(), srcpath, devalias, action, reason)) + print("myDomainEventIOErrorReasonCallback: Domain %s(%s) %s %s %d %s" = % ( + dom.name(), dom.ID(), srcpath, devalias, action, ERROR_EVENTS[reas= on])) + + def myDomainEventGraphicsCallback(conn, dom, phase, localAddr, remoteAddr,= authScheme, subject, opaque): print("myDomainEventGraphicsCallback: Domain %s(%s) %d %s" % (dom.name= (), dom.ID(), phase, authScheme)) def myDomainEventControlErrorCallback(conn, dom, opaque): --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536963743579.171653858871; Fri, 21 Sep 2018 06:36:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 750782DE42B; Fri, 21 Sep 2018 13:36:01 +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 39067309137F; Fri, 21 Sep 2018 13:36:01 +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 DAAE3181AC87; Fri, 21 Sep 2018 13:36:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZSpL022088 for ; Fri, 21 Sep 2018 09:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 88DC97FFF0; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E7BB7FFEE for ; Fri, 21 Sep 2018 13:35:25 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15668308A967 for ; Fri, 21 Sep 2018 13:35:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id D719832A7C15 for ; Fri, 21 Sep 2018 15:35:22 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 74WoQixtKhWC; Fri, 21 Sep 2018 15:35:21 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 5393332A7BB8; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id B4429160F30; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:08 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Sep 2018 13:35:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Sep 2018 13:35:24 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 13/22] event-test.py: Convert AGENT events 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 21 Sep 2018 13:36:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 4a801b7..b559ede 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -496,14 +496,8 @@ BLOCK_JOB_TYPES =3D Description("unknown", "Pull", "Co= py", "Commit", "ActiveCommit BLOCK_JOB_STATUS =3D Description("Completed", "Failed", "Canceled", "Ready= ") WATCHDOG_ACTIONS =3D Description("none", "Pause", "Reset", "Poweroff", "Sh= utdown", "Debug", "Inject NMI") ERROR_EVENTS =3D Description("None", "Pause", "Report") - -def agentLifecycleStateToString(state): - agentStates =3D ( "unknown", "connected", "disconnected", ) - return agentStates[state] - -def agentLifecycleReasonToString(reason): - agentReasons =3D ( "unknown", "domain started", "channel event", ) - return agentReasons[reason] +AGENT_STATES =3D Description("unknown", "connected", "disconnected") +AGENT_REASONS =3D Description("unknown", "domain started", "channel event") =20 =20 def myDomainEventCallback(conn, dom, event, detail, opaque): @@ -572,8 +566,13 @@ def myDomainEventBlockJob2Callback(conn, dom, disk, ty= pe, status, opaque): =20 def myDomainEventTunableCallback(conn, dom, params, opaque): print("myDomainEventTunableCallback: Domain %s(%s) %s" % (dom.name(), = dom.ID(), params)) + + def myDomainEventAgentLifecycleCallback(conn, dom, state, reason, opaque): - print("myDomainEventAgentLifecycleCallback: Domain %s(%s) %s %s" % (do= m.name(), dom.ID(), agentLifecycleStateToString(state), agentLifecycleReaso= nToString(reason))) + print("myDomainEventAgentLifecycleCallback: Domain %s(%s) %s %s" % ( + dom.name(), dom.ID(), AGENT_STATES[state], AGENT_REASONS[reason])) + + def myDomainEventDeviceAddedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceAddedCallback: Domain %s(%s) device added: %= s" % ( dom.name(), dom.ID(), dev)) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536963611539.0680858481353; Fri, 21 Sep 2018 06:36:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E04233004407; Fri, 21 Sep 2018 13:35:59 +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 AB3B36C014; Fri, 21 Sep 2018 13:35:59 +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 61413181AC2B; Fri, 21 Sep 2018 13:35:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZbxo022187 for ; Fri, 21 Sep 2018 09:35:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9779F62660; Fri, 21 Sep 2018 13:35:37 +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 8B0947E301 for ; Fri, 21 Sep 2018 13:35:37 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85DB0804E0 for ; Fri, 21 Sep 2018 13:35:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 5BC3832A7CCD for ; Fri, 21 Sep 2018 15:35:35 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mqhwEWabaizE; Fri, 21 Sep 2018 15:35:34 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 4DDAD32A7BB7; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id B75D4160F4D; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:09 +0200 Message-Id: <7e467ccb0252aa923e694138213d8ee30b74a737.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Sep 2018 13:35:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Sep 2018 13:35:36 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 14/22] event-test.py: Convert GRAPHICS events 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 21 Sep 2018 13:36:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index b559ede..d8ba8c9 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -498,6 +498,7 @@ WATCHDOG_ACTIONS =3D Description("none", "Pause", "Rese= t", "Poweroff", "Shutdown", ERROR_EVENTS =3D Description("None", "Pause", "Report") AGENT_STATES =3D Description("unknown", "connected", "disconnected") AGENT_REASONS =3D Description("unknown", "domain started", "channel event") +GRAPHICS_PHASES =3D Description("Connect", "Initialize", "Disconnect") =20 =20 def myDomainEventCallback(conn, dom, event, detail, opaque): @@ -527,7 +528,10 @@ def myDomainEventIOErrorReasonCallback(conn, dom, srcp= ath, devalias, action, rea =20 =20 def myDomainEventGraphicsCallback(conn, dom, phase, localAddr, remoteAddr,= authScheme, subject, opaque): - print("myDomainEventGraphicsCallback: Domain %s(%s) %d %s" % (dom.name= (), dom.ID(), phase, authScheme)) + print("myDomainEventGraphicsCallback: Domain %s(%s) %s %s" % ( + dom.name(), dom.ID(), GRAPHICS_PHASES[phase], authScheme)) + + def myDomainEventControlErrorCallback(conn, dom, opaque): print("myDomainEventControlErrorCallback: Domain %s(%s)" % (dom.name()= , dom.ID())) =20 --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536946151234.8741982235714; Fri, 21 Sep 2018 06:35:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7C0730001D8; Fri, 21 Sep 2018 13:35:43 +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 ACFEA309138F; Fri, 21 Sep 2018 13:35:43 +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 60E254A46D; Fri, 21 Sep 2018 13:35:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.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 w8LDZSox022086 for ; Fri, 21 Sep 2018 09:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 84C436C014; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CEFF89AF1 for ; Fri, 21 Sep 2018 13:35:25 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A0ADC05D3E6 for ; Fri, 21 Sep 2018 13:35:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 4C1B532A7C22 for ; Fri, 21 Sep 2018 15:35:23 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IDUr9E0Adr3E; Fri, 21 Sep 2018 15:35:22 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 593AC32A7BB9; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id BA7D4160F4F; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:10 +0200 Message-Id: <00303e7639a138428ed9f71c79943ce71ad33b8e.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 21 Sep 2018 13:35:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 21 Sep 2018 13:35:24 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 15/22] event-test.py: Convert DISK events 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Sep 2018 13:35:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index d8ba8c9..218103d 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -499,6 +499,7 @@ ERROR_EVENTS =3D Description("None", "Pause", "Report") AGENT_STATES =3D Description("unknown", "connected", "disconnected") AGENT_REASONS =3D Description("unknown", "domain started", "channel event") GRAPHICS_PHASES =3D Description("Connect", "Initialize", "Disconnect") +DISK_EVENTS =3D Description("Change missing on start", "Drop missing on st= art") =20 =20 def myDomainEventCallback(conn, dom, event, detail, opaque): @@ -543,7 +544,9 @@ def myDomainEventBlockJobCallback(conn, dom, disk, type= , status, opaque): =20 def myDomainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, dev= Alias, reason, opaque): print("myDomainEventDiskChangeCallback: Domain %s(%s) disk change oldS= rcPath: %s newSrcPath: %s devAlias: %s reason: %s" % ( - dom.name(), dom.ID(), oldSrcPath, newSrcPath, devAlias, reason= )) + dom.name(), dom.ID(), oldSrcPath, newSrcPath, devAlias, DISK_EVENT= S[reason])) + + def myDomainEventTrayChangeCallback(conn, dom, devAlias, reason, opaque): print("myDomainEventTrayChangeCallback: Domain %s(%s) tray change devA= lias: %s reason: %s" % ( dom.name(), dom.ID(), devAlias, reason)) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536974002290.7174487186718; Fri, 21 Sep 2018 06:36:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 200EC311C3DE; Fri, 21 Sep 2018 13:36:12 +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 D6CE57FFFE; Fri, 21 Sep 2018 13:36: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 70692181D0A4; Fri, 21 Sep 2018 13:36:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZTha022124 for ; Fri, 21 Sep 2018 09:35:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id AFAC617CCB; Fri, 21 Sep 2018 13:35:29 +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 A441417992 for ; Fri, 21 Sep 2018 13:35:29 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98F3E804EB for ; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 5DACA32A7C77 for ; Fri, 21 Sep 2018 15:35:27 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pc7z4HEU7Zx1; Fri, 21 Sep 2018 15:35:26 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 797C132A7BC1; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id BD9D3161197; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:11 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Sep 2018 13:35:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 21 Sep 2018 13:35:28 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 16/22] event-test.py: Convert TRAY events 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 21 Sep 2018 13:36:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/event-test.py b/examples/event-test.py index 218103d..5426ecd 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -500,6 +500,7 @@ AGENT_STATES =3D Description("unknown", "connected", "d= isconnected") AGENT_REASONS =3D Description("unknown", "domain started", "channel event") GRAPHICS_PHASES =3D Description("Connect", "Initialize", "Disconnect") DISK_EVENTS =3D Description("Change missing on start", "Drop missing on st= art") +TRAY_EVENTS =3D Description("Opened", "Closed") =20 =20 def myDomainEventCallback(conn, dom, event, detail, opaque): @@ -549,7 +550,9 @@ def myDomainEventDiskChangeCallback(conn, dom, oldSrcPa= th, newSrcPath, devAlias, =20 def myDomainEventTrayChangeCallback(conn, dom, devAlias, reason, opaque): print("myDomainEventTrayChangeCallback: Domain %s(%s) tray change devA= lias: %s reason: %s" % ( - dom.name(), dom.ID(), devAlias, reason)) + dom.name(), dom.ID(), devAlias, TRAY_EVENTS[reason])) + + def myDomainEventPMWakeupCallback(conn, dom, reason, opaque): print("myDomainEventPMWakeupCallback: Domain %s(%s) system pmwakeup" %= ( dom.name(), dom.ID())) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536953928959.0644149591991; Fri, 21 Sep 2018 06:35:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C69C307D985; Fri, 21 Sep 2018 13:35:51 +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 CFD2A308BDB8; Fri, 21 Sep 2018 13:35:50 +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 86D9B181A369; Fri, 21 Sep 2018 13:35:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZS1Z022074 for ; Fri, 21 Sep 2018 09:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 36F4E17992; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BCC582066 for ; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B01230027D2 for ; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id ED79C32A7C58 for ; Fri, 21 Sep 2018 15:35:25 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Om1YOQ64ddMm; Fri, 21 Sep 2018 15:35:24 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 6D14132A7BBE; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id C0D61161980; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:12 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 21 Sep 2018 13:35:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 21 Sep 2018 13:35:27 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 17/22] event-test.py: Convert NETWORK events 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 21 Sep 2018 13:35:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 5426ecd..2436827 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -604,27 +604,18 @@ def myDomainEventBlockThresholdCallback(conn, dom, de= v, path, threshold, excess, ########################################################################## # Network events ########################################################################## -def netEventToString(event): - netEventStrings =3D ( "Defined", - "Undefined", - "Started", - "Stopped", - ) - return netEventStrings[event] - -def netDetailToString(event, detail): - netEventStrings =3D ( - ( "Added", ), - ( "Removed", ), - ( "Started", ), - ( "Stopped", ), - ) - return netEventStrings[event][detail] +NET_EVENTS =3D Description( + ("Defined", ("Added",)), + ("Undefined", ("Removed",)), + ("Started", ("Started",)), + ("Stopped", ("Stopped",)), +) + =20 def myNetworkEventLifecycleCallback(conn, net, event, detail, opaque): - print("myNetworkEventLifecycleCallback: Network %s %s %s" % (net.name(= ), - netEventT= oString(event), - netDetail= ToString(event, detail))) + print("myNetworkEventLifecycleCallback: Network %s %s %s" % ( + net.name(), NET_EVENTS[event], NET_EVENTS[event][detail])) + =20 ########################################################################## # Storage pool events --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536954794985.7227120482173; Fri, 21 Sep 2018 06:35:54 -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 8DDAC88E6D; Fri, 21 Sep 2018 13:35:52 +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 55BA97DFD3; Fri, 21 Sep 2018 13:35:52 +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 07D69181A860; Fri, 21 Sep 2018 13:35:52 +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 w8LDZTlY022113 for ; Fri, 21 Sep 2018 09:35:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59BC7825E5; Fri, 21 Sep 2018 13:35:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50231825E3 for ; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B15D87645 for ; Fri, 21 Sep 2018 13:35:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 57A8B32A7C4A for ; Fri, 21 Sep 2018 15:35:25 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cWZSY2rk-v0v; Fri, 21 Sep 2018 15:35:24 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 6C91432A7BBD; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id C434B161E4A; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:13 +0200 Message-Id: <79e092755588f77503589056968b75d28f789665.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 21 Sep 2018 13:35:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 21 Sep 2018 13:35:26 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 18/22] event-test.py: Convert STORAGE events 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.25]); Fri, 21 Sep 2018 13:35:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 2436827..499f434 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -620,20 +620,20 @@ def myNetworkEventLifecycleCallback(conn, net, event,= detail, opaque): ########################################################################## # Storage pool events ########################################################################## -def storageEventToString(event): - storageEventStrings =3D ( "Defined", - "Undefined", - "Started", - "Stopped", - "Created", - "Deleted", - ) - return storageEventStrings[event] +STORAGE_EVENTS =3D Description( + ("Defined", ()), + ("Undefined", ()), + ("Started", ()), + ("Stopped", ()), + ("Created", ()), + ("Deleted", ()), +) + =20 def myStoragePoolEventLifecycleCallback(conn, pool, event, detail, opaque): - print("myStoragePoolEventLifecycleCallback: Storage pool %s %s %d" % (= pool.name(), - = storageEventToString(event), - = detail)) + print("myStoragePoolEventLifecycleCallback: Storage pool %s %s %s" % ( + pool.name(), STORAGE_EVENTS[event], STORAGE_EVENTS[event][detail])) + =20 def myStoragePoolEventRefreshCallback(conn, pool, opaque): print("myStoragePoolEventRefreshCallback: Storage pool %s" % pool.name= ()) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536956651415.69014294533144; Fri, 21 Sep 2018 06:35:56 -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 5065930B8FB0; Fri, 21 Sep 2018 13:35:54 +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 174C1825ED; Fri, 21 Sep 2018 13:35:54 +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 BCFC54A46D; Fri, 21 Sep 2018 13:35:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZVQS022136 for ; Fri, 21 Sep 2018 09:35:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85D07308BDB0; Fri, 21 Sep 2018 13:35:31 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DDD1308BDAF for ; Fri, 21 Sep 2018 13:35:31 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8824A307D973 for ; Fri, 21 Sep 2018 13:35:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 5E67832A7C95 for ; Fri, 21 Sep 2018 15:35:29 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NqtNI2h19CQK; Fri, 21 Sep 2018 15:35:28 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 842F732A7BC4; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id C7D1A161E4B; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:14 +0200 Message-Id: <72b962eaa3c91efa8a7ca1df39ea8fb5d73b0f90.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 21 Sep 2018 13:35:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 21 Sep 2018 13:35:30 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 19/22] event-test.py: Convert DEVICE events 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.49]); Fri, 21 Sep 2018 13:35:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 499f434..0a1d06d 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -641,16 +641,16 @@ def myStoragePoolEventRefreshCallback(conn, pool, opa= que): ########################################################################## # Node device events ########################################################################## -def nodeDeviceEventToString(event): - nodeDeviceEventStrings =3D ( "Created", - "Deleted", - ) - return nodeDeviceEventStrings[event] +DEVICE_EVENTS =3D Description( + ("Created", ()), + ("Deleted", ()), +) + =20 def myNodeDeviceEventLifecycleCallback(conn, dev, event, detail, opaque): - print("myNodeDeviceEventLifecycleCallback: Node device %s %s %d" % (d= ev.name(), - = nodeDeviceEventToString(event), - = detail)) + print("myNodeDeviceEventLifecycleCallback: Node device %s %s %s" % ( + dev.name(), DEVICE_EVENTS[event], DEVICE_EVENTS[event][detail])) + =20 def myNodeDeviceEventUpdateCallback(conn, dev, opaque): print("myNodeDeviceEventUpdateCallback: Node device %s" % dev.name()) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536958357458.99086985278404; Fri, 21 Sep 2018 06:35:58 -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 3546C30001DB; Fri, 21 Sep 2018 13:35:56 +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 48DD77EE2F; Fri, 21 Sep 2018 13:35:55 +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 D6E684A472; Fri, 21 Sep 2018 13:35:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZSdu022089 for ; Fri, 21 Sep 2018 09:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 89FCC3091390; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82D1E309137F for ; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 816993081258 for ; Fri, 21 Sep 2018 13:35:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 5964D32A7C63 for ; Fri, 21 Sep 2018 15:35:26 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lw5XRLF3vlKz; Fri, 21 Sep 2018 15:35:25 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 723A532A7BBF; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id CB295161E70; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:15 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 21 Sep 2018 13:35:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 21 Sep 2018 13:35:27 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 20/22] event-test.py: Convert SECRET events 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.44]); Fri, 21 Sep 2018 13:35:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 0a1d06d..5e3b884 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -658,16 +658,16 @@ def myNodeDeviceEventUpdateCallback(conn, dev, opaque= ): ########################################################################## # Secret events ########################################################################## -def secretEventToString(event): - secretEventStrings =3D ( "Defined", - "Undefined", - ) - return secretEventStrings[event] +SECRET_EVENTS =3D Description( + ("Defined", ()), + ("Undefined", ()), +) + =20 def mySecretEventLifecycleCallback(conn, secret, event, detail, opaque): - print("mySecretEventLifecycleCallback: Secret %s %s %d" % (secret.UUID= String(), - secretEvent= ToString(event), - detail)) + print("mySecretEventLifecycleCallback: Secret %s %s %s" % ( + secret.UUIDString(), SECRET_EVENTS[event], SECRET_EVENTS[event][de= tail])) + =20 def mySecretEventValueChanged(conn, secret, opaque): print("mySecretEventValueChanged: Secret %s" % secret.UUIDString()) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536968356136.9734446970051; Fri, 21 Sep 2018 06:36:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE842C04BD37; Fri, 21 Sep 2018 13:36:05 +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 A2EBD80F7A; Fri, 21 Sep 2018 13:36:05 +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 4AD3B4A48C; Fri, 21 Sep 2018 13:36:05 +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 w8LDZTdr022112 for ; Fri, 21 Sep 2018 09:35:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59348825E4; Fri, 21 Sep 2018 13:35:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F607825E1 for ; Fri, 21 Sep 2018 13:35:29 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 280E830001E1 for ; Fri, 21 Sep 2018 13:35:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id F3CE032A7C6D for ; Fri, 21 Sep 2018 15:35:26 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W3t4BtwYP_EP; Fri, 21 Sep 2018 15:35:26 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 756A732A7BC0; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id CE7D1161E7B; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:16 +0200 Message-Id: <818020d4adb26f0d7f279718e774f104eb98d75a.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Sep 2018 13:35:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 21 Sep 2018 13:35:28 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 21/22] event-test.py: Convert CONNECTION events 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 21 Sep 2018 13:36:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" to use new Description class Signed-off-by: Philipp Hahn --- examples/event-test.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 5e3b884..1e94838 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -677,15 +677,16 @@ def mySecretEventValueChanged(conn, secret, opaque): ########################################################################## =20 run =3D True +CONNECTION_EVENTS =3D Description("Error", "End-of-file", "Keepalive", "Cl= ient") + =20 def myConnectionCloseCallback(conn, reason, opaque): - reasonStrings =3D ( - "Error", "End-of-file", "Keepalive", "Client", - ) - print("myConnectionCloseCallback: %s: %s" % (conn.getURI(), reasonStri= ngs[reason])) + print("myConnectionCloseCallback: %s: %s" % ( + conn.getURI(), CONNECTION_EVENTS[reason])) global run run =3D False =20 + def usage(): print("usage: %s [-hdl] [uri]" % (os.path.basename(__file__),)) print(" uri will default to qemu:///system") --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 18:30:02 2024 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 1537536967160839.6072623438494; Fri, 21 Sep 2018 06:36:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 532EE80479; Fri, 21 Sep 2018 13:36:04 +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 1053B3091391; Fri, 21 Sep 2018 13:36:04 +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 9A1ED4A479; Fri, 21 Sep 2018 13:36:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LDZY8k022159 for ; Fri, 21 Sep 2018 09:35:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6273280F7B; Fri, 21 Sep 2018 13:35:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59A0E80F7A for ; Fri, 21 Sep 2018 13:35:31 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F1D4307D982 for ; Fri, 21 Sep 2018 13:35:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 5689732A7C83 for ; Fri, 21 Sep 2018 15:35:28 +0200 (CEST) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s_7OCPIfU-9R; Fri, 21 Sep 2018 15:35:27 +0200 (CEST) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 7D1A732A7BC2; Fri, 21 Sep 2018 15:35:18 +0200 (CEST) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id D1B07161E7D; Fri, 21 Sep 2018 15:35:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Philipp Hahn To: libvir-list@redhat.com Date: Fri, 21 Sep 2018 15:35:17 +0200 Message-Id: <4bcd6734fa9a6ad3cc50af33236d4415cdcdf7f1.1537536402.git.hahn@univention.de> In-Reply-To: References: In-Reply-To: References: <1ce5060e-4249-0246-89d0-b7e01f8dd30a@redhat.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 21 Sep 2018 13:35:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 21 Sep 2018 13:35:30 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt-python v2 22/22] event-test.py: Fix blanks 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Sep 2018 13:36:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Closer to pep8 Signed-off-by: Philipp Hahn --- examples/event-test.py | 97 ++++++++++++++++++++++++++++++++++++----------= ---- 1 file changed, 71 insertions(+), 26 deletions(-) diff --git a/examples/event-test.py b/examples/event-test.py index 1e94838..540bf9b 100755 --- a/examples/event-test.py +++ b/examples/event-test.py @@ -30,11 +30,14 @@ import threading event_impl =3D "poll" =20 do_debug =3D False + + def debug(msg): global do_debug if do_debug: print(msg) =20 + # # This general purpose event loop will support waiting for file handle # I/O and errors events, as well as scheduling repeatable timers with @@ -100,7 +103,6 @@ class virEventLoopPoll: self.cb(self.timer, self.opaque) =20 - def __init__(self): self.poll =3D select.poll() self.pipetrick =3D os.pipe() @@ -126,10 +128,9 @@ class virEventLoopPoll: # with the event loop for input events. When we need to force # the main thread out of a poll() sleep, we simple write a # single byte of data to the other end of the pipe. - debug("Self pipe watch %d write %d" %(self.pipetrick[0], self.pipe= trick[1])) + debug("Self pipe watch %d write %d" % (self.pipetrick[0], self.pip= etrick[1])) self.poll.register(self.pipetrick[0], select.POLLIN) =20 - # Calculate when the next timeout is due to occur, returning # the absolute timestamp for the next timeout, or 0 if there is # no timeout due @@ -159,7 +160,6 @@ class virEventLoopPoll: return h return None =20 - # This is the heart of the event loop, performing one single # iteration. It asks when the next timeout is due, and then # calculates the maximum amount of time it is able to sleep @@ -235,7 +235,6 @@ class virEventLoopPoll: finally: self.runningPoll =3D False =20 - # Actually run the event loop forever def run_loop(self): self.quit =3D False @@ -247,7 +246,6 @@ class virEventLoopPoll: self.pendingWakeup =3D True os.write(self.pipetrick[1], 'c'.encode("UTF-8")) =20 - # Registers a new file handle 'fd', monitoring for 'events' (libvirt # event constants), firing the callback cb() when an event occurs. # Returns a unique integer identier for this handle, that should be @@ -301,7 +299,7 @@ class virEventLoopPoll: h.set_interval(interval) self.interrupt() =20 - debug("Update timer %d interval %d" % (timerID, interval)) + debug("Update timer %d interval %d" % (timerID, interval)) break =20 # Stop monitoring for events on the file handle @@ -383,26 +381,32 @@ def virEventAddHandleImpl(fd, events, cb, opaque): global eventLoop return eventLoop.add_handle(fd, events, cb, opaque) =20 + def virEventUpdateHandleImpl(handleID, events): global eventLoop return eventLoop.update_handle(handleID, events) =20 + def virEventRemoveHandleImpl(handleID): global eventLoop return eventLoop.remove_handle(handleID) =20 + def virEventAddTimerImpl(interval, cb, opaque): global eventLoop return eventLoop.add_timer(interval, cb, opaque) =20 + def virEventUpdateTimerImpl(timerID, interval): global eventLoop return eventLoop.update_timer(timerID, interval) =20 + def virEventRemoveTimerImpl(timerID): global eventLoop return eventLoop.remove_timer(timerID) =20 + # This tells libvirt what event loop implementation it # should use def virEventLoopPollRegister(): @@ -413,20 +417,24 @@ def virEventLoopPollRegister(): virEventUpdateTimerImpl, virEventRemoveTimerImpl) =20 + # Directly run the event loop in the current thread def virEventLoopPollRun(): global eventLoop eventLoop.run_loop() =20 + def virEventLoopAIORun(loop): import asyncio asyncio.set_event_loop(loop) loop.run_forever() =20 + def virEventLoopNativeRun(): while True: libvirt.virEventRunDefaultImpl() =20 + # Spawn a background thread to run the event loop def virEventLoopPollStart(): global eventLoopThread @@ -435,6 +443,7 @@ def virEventLoopPollStart(): eventLoopThread.setDaemon(True) eventLoopThread.start() =20 + def virEventLoopAIOStart(): global eventLoopThread import libvirtaio @@ -445,6 +454,7 @@ def virEventLoopAIOStart(): eventLoopThread.setDaemon(True) eventLoopThread.start() =20 + def virEventLoopNativeStart(): global eventLoopThread libvirt.virEventRegisterDefaultImpl() @@ -509,10 +519,13 @@ def myDomainEventCallback(conn, dom, event, detail, o= paque): =20 =20 def myDomainEventRebootCallback(conn, dom, opaque): - print("myDomainEventRebootCallback: Domain %s(%s)" % (dom.name(), dom.= ID())) + print("myDomainEventRebootCallback: Domain %s(%s)" % ( + dom.name(), dom.ID())) + =20 def myDomainEventRTCChangeCallback(conn, dom, utcoffset, opaque): - print("myDomainEventRTCChangeCallback: Domain %s(%s) %d" % (dom.name()= , dom.ID(), utcoffset)) + print("myDomainEventRTCChangeCallback: Domain %s(%s) %d" % ( + dom.name(), dom.ID(), utcoffset)) =20 =20 def myDomainEventWatchdogCallback(conn, dom, action, opaque): @@ -521,7 +534,8 @@ def myDomainEventWatchdogCallback(conn, dom, action, op= aque): =20 =20 def myDomainEventIOErrorCallback(conn, dom, srcpath, devalias, action, opa= que): - print("myDomainEventIOErrorCallback: Domain %s(%s) %s %s %d" % (dom.na= me(), dom.ID(), srcpath, devalias, action)) + print("myDomainEventIOErrorCallback: Domain %s(%s) %s %s %d" % ( + dom.name(), dom.ID(), srcpath, devalias, action)) =20 =20 def myDomainEventIOErrorReasonCallback(conn, dom, srcpath, devalias, actio= n, reason, opaque): @@ -535,7 +549,8 @@ def myDomainEventGraphicsCallback(conn, dom, phase, loc= alAddr, remoteAddr, authS =20 =20 def myDomainEventControlErrorCallback(conn, dom, opaque): - print("myDomainEventControlErrorCallback: Domain %s(%s)" % (dom.name()= , dom.ID())) + print("myDomainEventControlErrorCallback: Domain %s(%s)" % ( + dom.name(), dom.ID())) =20 =20 def myDomainEventBlockJobCallback(conn, dom, disk, type, status, opaque): @@ -555,18 +570,27 @@ def myDomainEventTrayChangeCallback(conn, dom, devAli= as, reason, opaque): =20 def myDomainEventPMWakeupCallback(conn, dom, reason, opaque): print("myDomainEventPMWakeupCallback: Domain %s(%s) system pmwakeup" %= ( - dom.name(), dom.ID())) + dom.name(), dom.ID())) + + def myDomainEventPMSuspendCallback(conn, dom, reason, opaque): print("myDomainEventPMSuspendCallback: Domain %s(%s) system pmsuspend"= % ( - dom.name(), dom.ID())) + dom.name(), dom.ID())) + + def myDomainEventBalloonChangeCallback(conn, dom, actual, opaque): - print("myDomainEventBalloonChangeCallback: Domain %s(%s) %d" % (dom.na= me(), dom.ID(), actual)) + print("myDomainEventBalloonChangeCallback: Domain %s(%s) %d" % ( + dom.name(), dom.ID(), actual)) + + def myDomainEventPMSuspendDiskCallback(conn, dom, reason, opaque): print("myDomainEventPMSuspendDiskCallback: Domain %s(%s) system pmsusp= end_disk" % ( - dom.name(), dom.ID())) + dom.name(), dom.ID())) + + def myDomainEventDeviceRemovedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceRemovedCallback: Domain %s(%s) device remove= d: %s" % ( - dom.name(), dom.ID(), dev)) + dom.name(), dom.ID(), dev)) =20 =20 def myDomainEventBlockJob2Callback(conn, dom, disk, type, status, opaque): @@ -575,7 +599,8 @@ def myDomainEventBlockJob2Callback(conn, dom, disk, typ= e, status, opaque): =20 =20 def myDomainEventTunableCallback(conn, dom, params, opaque): - print("myDomainEventTunableCallback: Domain %s(%s) %s" % (dom.name(), = dom.ID(), params)) + print("myDomainEventTunableCallback: Domain %s(%s) %s" % ( + dom.name(), dom.ID(), params)) =20 =20 def myDomainEventAgentLifecycleCallback(conn, dom, state, reason, opaque): @@ -585,21 +610,33 @@ def myDomainEventAgentLifecycleCallback(conn, dom, st= ate, reason, opaque): =20 def myDomainEventDeviceAddedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceAddedCallback: Domain %s(%s) device added: %= s" % ( - dom.name(), dom.ID(), dev)) + dom.name(), dom.ID(), dev)) + + def myDomainEventMigrationIteration(conn, dom, iteration, opaque): print("myDomainEventMigrationIteration: Domain %s(%s) started migratio= n iteration %d" % ( - dom.name(), dom.ID(), iteration)) + dom.name(), dom.ID(), iteration)) + + def myDomainEventJobCompletedCallback(conn, dom, params, opaque): - print("myDomainEventJobCompletedCallback: Domain %s(%s) %s" % (dom.nam= e(), dom.ID(), params)) + print("myDomainEventJobCompletedCallback: Domain %s(%s) %s" % ( + dom.name(), dom.ID(), params)) + + def myDomainEventDeviceRemovalFailedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceRemovalFailedCallback: Domain %s(%s) failed = to remove device: %s" % ( - dom.name(), dom.ID(), dev)) + dom.name(), dom.ID(), dev)) + + def myDomainEventMetadataChangeCallback(conn, dom, mtype, nsuri, opaque): print("myDomainEventMetadataChangeCallback: Domain %s(%s) changed meta= data mtype=3D%d nsuri=3D%s" % ( - dom.name(), dom.ID(), mtype, nsuri)) + dom.name(), dom.ID(), mtype, nsuri)) + + def myDomainEventBlockThresholdCallback(conn, dom, dev, path, threshold, e= xcess, opaque): print("myDomainEventBlockThresholdCallback: Domain %s(%s) block device= %s(%s) threshold %d exceeded by %d" % ( - dom.name(), dom.ID(), dev, path, threshold, excess)) + dom.name(), dom.ID(), dev, path, threshold, excess)) + =20 ########################################################################## # Network events @@ -638,6 +675,7 @@ def myStoragePoolEventLifecycleCallback(conn, pool, eve= nt, detail, opaque): def myStoragePoolEventRefreshCallback(conn, pool, opaque): print("myStoragePoolEventRefreshCallback: Storage pool %s" % pool.name= ()) =20 + ########################################################################## # Node device events ########################################################################## @@ -655,6 +693,7 @@ def myNodeDeviceEventLifecycleCallback(conn, dev, event= , detail, opaque): def myNodeDeviceEventUpdateCallback(conn, dev, opaque): print("myNodeDeviceEventUpdateCallback: Node device %s" % dev.name()) =20 + ########################################################################## # Secret events ########################################################################## @@ -672,6 +711,7 @@ def mySecretEventLifecycleCallback(conn, secret, event,= detail, opaque): def mySecretEventValueChanged(conn, secret, opaque): print("mySecretEventValueChanged: Secret %s" % secret.UUIDString()) =20 + ########################################################################## # Set up and run the program ########################################################################## @@ -695,12 +735,13 @@ def usage(): print(" --loop=3DTYPE, -l Choose event-loop-implementation (native= , poll, asyncio)") print(" --timeout=3DSECS Quit after SECS seconds running") =20 + def main(): try: opts, args =3D getopt.getopt(sys.argv[1:], "hdl:", ["help", "debug= ", "loop=3D", "timeout=3D"]) except getopt.GetoptError as err: # print help information and exit: - print(str(err)) # will print something like "option -a not recogni= zed" + print(str(err)) # will print something like "option -a not recogn= ized" usage() sys.exit(2) timeout =3D None @@ -736,16 +777,19 @@ def main(): =20 # Close connection on exit (to test cleanup paths) old_exitfunc =3D getattr(sys, 'exitfunc', None) + def exit(): print("Closing " + vc.getURI()) if run: vc.close() - if (old_exitfunc): old_exitfunc() + if (old_exitfunc): + old_exitfunc() + sys.exitfunc =3D exit =20 vc.registerCloseCallback(myConnectionCloseCallback, None) =20 - #Add 2 lifecycle callbacks to prove this works with more than just one + # Add 2 lifecycle callbacks to prove this works with more than just one vc.domainEventRegister(myDomainEventCallback, 1) domcallbacks =3D [ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_LIFECY= CLE, myDomainEventCallback, 2), @@ -829,5 +873,6 @@ def main(): # Allow delayed event loop cleanup to run, just for sake of testing time.sleep(2) =20 + if __name__ =3D=3D "__main__": main() --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list