[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-perl PATCH] Add support for virDomainSetIOThreadParams



Signed-off-by: John Ferlan <jferlan redhat com>
---
 Although I suppose a build breaker, it would be good to have someone
 review my (lack of) Perl writing skills.  The changes do allow the build
 to pass though ;-).

 Changes                |  2 ++
 lib/Sys/Virt.xs        | 41 +++++++++++++++++++++++++++++++++++++++++
 lib/Sys/Virt/Domain.pm | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+)

diff --git a/Changes b/Changes
index a76bb95..6adf2c7 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@ Revision history for perl module Sys::Virt
 4.10.0 2018-00-00
 
  - Add VIR_DOMAIN_SHUTOFF_DAEMON constant
+ - Add VIR_DOMAIN_IOTHREAD_POLL_{MAX_NS|GROW|SHRINK} params and the
+   virDomainSetIOThreadParams binding
 
 4.8.0 2018-10-05
 
diff --git a/lib/Sys/Virt.xs b/lib/Sys/Virt.xs
index 3398971..07a5bca 100644
--- a/lib/Sys/Virt.xs
+++ b/lib/Sys/Virt.xs
@@ -6234,6 +6234,42 @@ del_iothread(dom, iothread_id, flags=0)
          _croak_error();
 
 
+void
+set_iothread(dom, iothread_id, newparams, flags=0)
+     virDomainPtr dom;
+     unsigned int iothread_id;
+     HV *newparams;
+     unsigned int flags;
+ PREINIT:
+     virTypedParameterPtr params;
+     size_t nparams;
+   PPCODE:
+     nparams = 3;
+     Newx(params, nparams, virTypedParameter);
+
+     strncpy(params[0].field, VIR_DOMAIN_IOTHREAD_POLL_MAX_NS,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[0].type = VIR_TYPED_PARAM_ULLONG;
+
+     strncpy(params[1].field, VIR_DOMAIN_IOTHREAD_POLL_GROW,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[1].type = VIR_TYPED_PARAM_UINT;
+
+     strncpy(params[2].field, VIR_DOMAIN_IOTHREAD_POLL_SHRINK,
+             VIR_TYPED_PARAM_FIELD_LENGTH);
+     params[2].type = VIR_TYPED_PARAM_UINT;
+
+     nparams = vir_typed_param_from_hv(newparams, params, nparams);
+
+     if (virDomainSetIOThreadParams(dom, iothread_id,
+                                    params, nparams, flags) < 0) {
+         vir_typed_param_safe_free(params, nparams);
+         _croak_error();
+     }
+
+     vir_typed_param_safe_free(params, nparams);
+
+
 int
 num_of_snapshots(dom, flags=0)
       virDomainPtr dom;
@@ -8823,6 +8859,7 @@ BOOT:
       REGISTER_CONSTANT(VIR_DOMAIN_STATS_STATE, STATS_STATE);
       REGISTER_CONSTANT(VIR_DOMAIN_STATS_VCPU, STATS_VCPU);
       REGISTER_CONSTANT(VIR_DOMAIN_STATS_PERF, STATS_PERF);
+      REGISTER_CONSTANT(VIR_DOMAIN_STATS_IOTHREAD, STATS_IOTHREAD);
 
       REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE, GET_ALL_STATS_ACTIVE);
       REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE, GET_ALL_STATS_INACTIVE);
@@ -9129,6 +9166,10 @@ BOOT:
       REGISTER_CONSTANT_STR(VIR_PERF_PARAM_ALIGNMENT_FAULTS, PERF_PARAM_ALIGNMENT_FAULTS);
       REGISTER_CONSTANT_STR(VIR_PERF_PARAM_EMULATION_FAULTS, PERF_PARAM_EMULATION_FAULTS);
 
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, IOTHREAD_PARAM_POLL_MAX_NS);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_IOTHREAD_POLL_GROW, IOTHREAD_PARAM_POLL_GROW);
+      REGISTER_CONSTANT_STR(VIR_DOMAIN_IOTHREAD_POLL_SHRINK, IOTHREAD_PARAM_POLL_SHRINK);
+
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_AVERAGE, BANDWIDTH_IN_AVERAGE);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_PEAK, BANDWIDTH_IN_PEAK);
       REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_BURST, BANDWIDTH_IN_BURST);
diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm
index c56fe4e..a466efc 100644
--- a/lib/Sys/Virt/Domain.pm
+++ b/lib/Sys/Virt/Domain.pm
@@ -1423,6 +1423,13 @@ Delete an existing IOThread by the C<$iothread> value from the guest domain.
 The C<$flags> parameter accepts one or more the CONFIG OPTION constants
 documented later, and defaults to 0 if omitted.
 
+=item $dom->set_iothread($iothread, $params, $nparams, $flags=0)
+
+Set parameters for the IOThread by the C<$iothread> value on the guest domain.
+The C<$params> parameter
+The C<$flags> parameter accepts one or more the CONFIG OPTION constants
+documented later, and defaults to 0 if omitted.
+
 =item my @stats = $dom->get_cpu_stats($startCpu, $numCpus, $flags=0)
 
 Requests the guests host physical CPU usage statistics, starting
@@ -2989,6 +2996,34 @@ field in the *Stats APIs.
 
 =back
 
+=head2 IOTHREAD STATS
+
+The following constants defined IOThread statistics which
+can be monitored for a guest
+
+=over 4
+
+=item Sys::Virt::Domain::IOTHREAD_PARAM_POLL_MAX_NS
+
+The maximum polling time that can be used by polling algorithm in ns.
+The polling time starts at 0 (zero) and is the time spent by the guest
+to process IOThread data before returning the CPU to the host. The
+polling time will be dynamically modified over time based on the
+poll_grow and poll_shrink parameters provided.
+
+=item Sys::Virt::Domain::IOTHREAD_PARAM_POLL_GROW
+
+This provides a value for the dynamic polling adjustment algorithm to
+use to grow its polling interval up to the poll_max_ns value.
+
+=item Sys::Virt::Domain::IOTHREAD_PARAM_POLL_SHRINK
+
+This provides a value for the dynamic polling adjustment algorithm to
+use to shrink its polling interval when the polling interval exceeds
+the poll_max_ns value.
+
+=back
+
 =head2 VCPU FLAGS
 
 The following constants are useful when getting/setting the
@@ -4175,6 +4210,10 @@ Virtual CPU info
 
 Performance event counter values
 
+=item Sys::Virt::Domain::STATS_IOTHREAD
+
+IOThread performance statistics values
+
 =back
 
 =head2 PROCESS SIGNALS
-- 
2.17.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]