From nobody Mon Feb 9 15:11:21 2026 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.zoho.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 1490796004386116.88236039889523; Wed, 29 Mar 2017 07:00:04 -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 788064D6A3; Wed, 29 Mar 2017 14:00:02 +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 2F506881F3; Wed, 29 Mar 2017 14:00:02 +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 B7EB518523C8; Wed, 29 Mar 2017 14:00:01 +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 v2TDuZuT019467 for ; Wed, 29 Mar 2017 09:56:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id B51DB7F957; Wed, 29 Mar 2017 13:56:35 +0000 (UTC) Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E09A822A7 for ; Wed, 29 Mar 2017 13:56:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 788064D6A3 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 788064D6A3 From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 29 Mar 2017 15:56:27 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-perl][PATCH 1/3] Add block threshold event 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.26]); Wed, 29 Mar 2017 14:00:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- Changes | 1 + Virt.xs | 48 ++++++++++++++++++++++++++++++++++++++++++++++= ++ lib/Sys/Virt/Domain.pm | 6 ++++++ t/030-api-coverage.t | 1 + 4 files changed, 56 insertions(+) diff --git a/Changes b/Changes index aee699d..4d6136f 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,7 @@ Revision history for perl module Sys::Virt - Add PERF_PARAM_PAGE_FAULTS_MAJ constant - Add PERF_PARAM_ALIGNMENT_FAULTS constant - Add PERF_PARAM_EMULATION_FAULTS constant + - Add block threshold event =20 3.1.0 2017-03-03 =20 diff --git a/Virt.xs b/Virt.xs index e80182f..e0588f0 100644 --- a/Virt.xs +++ b/Virt.xs @@ -1136,6 +1136,50 @@ _domain_event_metadata_change_callback(virConnectPtr= con, =20 =20 static int +_domain_event_block_threshold_callback(virConnectPtr con, + virDomainPtr dom, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess, + void *opaque) +{ + AV *data =3D opaque; + SV **self; + SV **cb; + SV *domref; + dSP; + + self =3D av_fetch(data, 0, 0); + cb =3D av_fetch(data, 1, 0); + + SvREFCNT_inc(*self); + + ENTER; + SAVETMPS; + + PUSHMARK(SP); + XPUSHs(*self); + domref =3D sv_newmortal(); + sv_setref_pv(domref, "Sys::Virt::Domain", (void *) dom); + virDomainRef(dom); + XPUSHs(domref); + XPUSHs(sv_2mortal(newSVpv(dev, 0))); + XPUSHs(sv_2mortal(newSVpv(path, 0))); + XPUSHs(sv_2mortal(newSViv(threshold))); + XPUSHs(sv_2mortal(newSViv(excess))); + PUTBACK; + + call_sv(*cb, G_DISCARD); + + FREETMPS; + LEAVE; + + return 0; +} + + +static int _network_event_lifecycle_callback(virConnectPtr con, virNetworkPtr net, int event, @@ -3375,6 +3419,9 @@ PREINIT: case VIR_DOMAIN_EVENT_ID_METADATA_CHANGE: callback =3D VIR_DOMAIN_EVENT_CALLBACK(_domain_event_metadata_ch= ange_callback); break; + case VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD: + callback =3D VIR_DOMAIN_EVENT_CALLBACK(_domain_event_block_thres= hold_callback); + break; default: callback =3D VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_cal= lback); break; @@ -8384,6 +8431,7 @@ BOOT: REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_JOB_COMPLETED, EVENT_ID_JOB_CO= MPLETED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, EVENT_I= D_DEVICE_REMOVAL_FAILED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, EVENT_ID_META= DATA_CHANGE); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD, EVENT_ID_BLOC= K_THRESHOLD); =20 REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_NONE, EVENT_WATCHDOG_NON= E); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, EVENT_WATCHDOG_PA= USE); diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm index eea8b26..b46eca1 100644 --- a/lib/Sys/Virt/Domain.pm +++ b/lib/Sys/Virt/Domain.pm @@ -3274,6 +3274,12 @@ Guest device removal has failed. =20 The domain metadata has changed =20 +=3Ditem Sys::Virt::Domain::EVENT_ID_BLOCK_THRESHOLD + +The event occurs when the hypervisor detects that the given +storage element was written beyond the point specified by +threshold. The event is useful for thin-provisioned storage. + =3Dback =20 =3Dhead2 IO ERROR EVENT CONSTANTS diff --git a/t/030-api-coverage.t b/t/030-api-coverage.t index 3a0d0c5..3049713 100644 --- a/t/030-api-coverage.t +++ b/t/030-api-coverage.t @@ -95,6 +95,7 @@ virConnectDomainEventMigrationIterationCallback virConnectDomainEventJobCompletedCallback virConnectDomainEventDeviceRemovalFailedCallback virConnectDomainEventMetadataChangeCallback +virConnectDomainEventBlockThresholdCallback =20 virConnectNetworkEventLifecycleCallback =20 --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list