From nobody Wed Nov 27 20:35:01 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