Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Changes | 1 +
Virt.xs | 12 ++++++++++++
lib/Sys/Virt/Domain.pm | 9 +++++++++
3 files changed, 22 insertions(+)
diff --git a/Changes b/Changes
index 4d6136f..3faaf08 100644
--- a/Changes
+++ b/Changes
@@ -12,6 +12,7 @@ Revision history for perl module Sys::Virt
- Add PERF_PARAM_ALIGNMENT_FAULTS constant
- Add PERF_PARAM_EMULATION_FAULTS constant
- Add block threshold event
+ - Add virDomainSetBlockThreshold API
3.1.0 2017-03-03
diff --git a/Virt.xs b/Virt.xs
index e0588f0..a05cf4d 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -6120,6 +6120,18 @@ send_process_signal(dom, pidsv, signum, flags=0)
if (virDomainSendProcessSignal(dom, pid, signum, flags) < 0)
_croak_error();
+void
+set_block_threshold(dom, dev, thresholdsv, flags=0)
+ virDomainPtr dom;
+ const char *dev;
+ SV *thresholdsv;
+ unsigned int flags;
+ PREINIT:
+ unsigned long long threshold;
+ PPCODE:
+ threshold = virt_SvIVull(thresholdsv);
+ if (virDomainSetBlockThreshold(dom, dev, threshold, flags) < 0)
+ _croak_error();
void
destroy(dom_rv, flags=0)
diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm
index b46eca1..a192ad5 100644
--- a/lib/Sys/Virt/Domain.pm
+++ b/lib/Sys/Virt/Domain.pm
@@ -1924,6 +1924,15 @@ C<$signum> value must be one of the constants listed
later, not a POSIX or Linux signal value. C<$flags>
is currently unused and defaults to zero.
+=item $dom->set_block_threshold($dev, $threshold, $flags=0);
+
+Set the threshold level for delivering the
+EVENT_ID_BLOCK_THRESHOLD if the device or backing chain element
+described by C<$dev> is written beyond the set C<$threshold>
+level. The threshold level is unset once the event fires. The
+event might not be delivered at all if libvirtd was not running
+at the moment when the threshold was reached.
+
=back
=head1 CONSTANTS
--
2.10.2