[libvirt] [PATCH go] Add back compat constants for iothreads
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
domain_compat.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Pushed as a build break fix for old libvirt
diff --git a/domain_compat.h b/domain_compat.h
index 371bcc4..19a3e24 100644
--- a/domain_compat.h
+++ b/domain_compat.h
@@ -917,4 +917,20 @@ struct _virDomainInterface {
#define VIR_DOMAIN_SHUTOFF_DAEMON 8
#endif
+#ifndef VIR_DOMAIN_STATS_IOTHREAD
+#define VIR_DOMAIN_STATS_IOTHREAD (1 << 7)
+#endif
+
+#ifndef VIR_DOMAIN_IOTHREAD_POLL_GROW
+#define VIR_DOMAIN_IOTHREAD_POLL_GROW "poll_grow"
+#endif
+
+#ifndef VIR_DOMAIN_IOTHREAD_POLL_SHRINK
+#define VIR_DOMAIN_IOTHREAD_POLL_SHRINK "poll_shrink"
+#endif
+
+#ifndef VIR_DOMAIN_IOTHREAD_POLL_MAX_NS
+#define VIR_DOMAIN_IOTHREAD_POLL_MAX_NS "poll_max_ns"
+#endif
+
#endif /* LIBVIRT_GO_DOMAIN_COMPAT_H__ */
--
2.19.1
6 years
[libvirt] [sandbox PATCH 0/2] Resolve builder issues
by Radostin Stoyanov
Radostin Stoyanov (2):
builder: Use prefix '=> /' to identify lib path
Use "/boot/vmlinuz-linux" as default kernel path
bin/virt-sandbox.c | 5 +++--
libvirt-sandbox/libvirt-sandbox-builder-machine.c | 4 ++++
libvirt-sandbox/libvirt-sandbox-builder.c | 14 ++++++--------
3 files changed, 13 insertions(+), 10 deletions(-)
--
2.17.1
6 years
[libvirt] [libvirt-go PATCH] Add virDomainSetIOThreadParams binding
by John Ferlan
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Well I've given it a "go", hopefully it's (more or less) right. The build
and test at least pass ;-)
domain.go | 52 +++++++++++++++++++++++++++++++++++++++++++++++
domain_wrapper.go | 20 ++++++++++++++++++
domain_wrapper.h | 8 ++++++++
3 files changed, 80 insertions(+)
diff --git a/domain.go b/domain.go
index e011980..3a6811f 100644
--- a/domain.go
+++ b/domain.go
@@ -769,6 +769,7 @@ const (
DOMAIN_STATS_INTERFACE = DomainStatsTypes(C.VIR_DOMAIN_STATS_INTERFACE)
DOMAIN_STATS_BLOCK = DomainStatsTypes(C.VIR_DOMAIN_STATS_BLOCK)
DOMAIN_STATS_PERF = DomainStatsTypes(C.VIR_DOMAIN_STATS_PERF)
+ DOMAIN_STATS_IOTHREAD = DomainStatsTypes(C.VIR_DOMAIN_STATS_IOTHREAD)
)
type DomainCoreDumpFlags int
@@ -4207,6 +4208,57 @@ func (d *Domain) DelIOThread(id uint, flags DomainModificationImpact) error {
return nil
}
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetIOThread...
+
+type DomainSetIOThreadParams struct {
+ PollMaxNsSet bool
+ PollMaxNs uint64
+ PollGrowSet bool
+ PollGrow uint
+ PollShrinkSet bool
+ PollShrink uint64
+}
+
+func getSetIOThreadParamsFieldInfo(params *DomainSetIOThreadParams) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_IOTHREAD_POLL_MAX_NS: typedParamsFieldInfo{
+ set: ¶ms.PollMaxNsSet,
+ ul: ¶ms.PollMaxNs,
+ },
+ C.VIR_DOMAIN_IOTHREAD_POLL_GROW: typedParamsFieldInfo{
+ set: ¶ms.PollGrowSet,
+ ui: ¶ms.PollGrow,
+ },
+ C.VIR_DOMAIN_IOTHREAD_POLL_SHRINK: typedParamsFieldInfo{
+ set: ¶ms.PollShrinkSet,
+ ul: ¶ms.PollShrink,
+ },
+ }
+}
+
+func (d *Domain) SetIOThreadParams(iothreadid uint, params *DomainSetIOThreadParams, flags DomainModificationImpact) error {
+ if C.LIBVIR_VERSION_NUMBER < 4010000 {
+ return makeNotImplementedError("virDomainSetIOThreadParams")
+ }
+ info := getSetIOThreadParamsFieldInfo(params)
+
+ cparams, gerr := typedParamsPackNew(info)
+ if gerr != nil {
+ return gerr
+ }
+ nparams := len(*cparams)
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams))
+
+ var err C.virError
+ ret := C.virDomainSetIOThreadParamsWrapper(d.ptr, C.uint(iothreadid), (*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetEmulator...
func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]bool, error) {
var cnodeinfo C.virNodeInfo
diff --git a/domain_wrapper.go b/domain_wrapper.go
index b42dd42..f674bd5 100644
--- a/domain_wrapper.go
+++ b/domain_wrapper.go
@@ -1913,6 +1913,26 @@ virDomainSetGuestVcpusWrapper(virDomainPtr domain,
}
+int
+virDomainSetIOThreadParamsWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4010000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetIOThreadParams(domain, iothread_id, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
int
virDomainSetInterfaceParametersWrapper(virDomainPtr domain,
const char *device,
diff --git a/domain_wrapper.h b/domain_wrapper.h
index 7bd8282..48a4cd3 100644
--- a/domain_wrapper.h
+++ b/domain_wrapper.h
@@ -813,6 +813,14 @@ virDomainSetGuestVcpusWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err);
+int
+virDomainSetIOThreadParamsWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
int
virDomainSetInterfaceParametersWrapper(virDomainPtr domain,
const char *device,
--
2.17.2
6 years
[libvirt] [PATCH] util: Fix a bug in virResctrlMonitorGetStats
by Wang Huaqiang
The path argument of virFileIsDir should be a full name
of file, pathname and filename. Fixed it by passing the
full path name to virFileIsDir.
Signed-off-by: Wang Huaqiang <huaqiang.wang(a)intel.com>
---
src/util/virresctrl.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 7aeca9d..e0ad460 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2665,6 +2665,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
int ret = -1;
DIR *dirp = NULL;
char *datapath = NULL;
+ char *filepath = NULL;
struct dirent *ent = NULL;
virResctrlMonitorStatsPtr stat = NULL;
@@ -2684,13 +2685,18 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
while (virDirRead(dirp, &ent, datapath) > 0) {
char *node_id = NULL;
+ VIR_FREE(filepath);
+
/* Looking for directory that contains resource utilization
* information file. The directory name is arranged in format
* "mon_<node_name>_<node_id>". For example, "mon_L3_00" and
* "mon_L3_01" are two target directories for a two nodes system
* with resource utilization data file for each node respectively.
*/
- if (!virFileIsDir(ent->d_name))
+ if (virAsprintf(&filepath, "%s/%s", datapath, ent->d_name) < 0);
+ goto cleanup;
+
+ if (!virFileIsDir(filepath))
continue;
/* Looking for directory has a prefix 'mon_L' */
@@ -2734,6 +2740,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
ret = 0;
cleanup:
VIR_FREE(datapath);
+ VIR_FREE(filepath);
VIR_FREE(stat);
VIR_DIR_CLOSE(dirp);
return ret;
--
2.7.4
6 years
[libvirt] [libvirt-python PATCH] Fix copy paste error on the version check value
by John Ferlan
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
This one I'll push under the build/test breaker rule...
I hadn't "installed" the libvirt library with the API so when "testing"
the build I just removed the CHECK_VERSION lines... Of course when looking
at the CI results I still saw the fail... So I looked more closely and saw
the errors of my ways, <sigh>... Before pushing this, I did install the
libvirt API/library changes on my host and rebuilt "naturally" and got a
pass, so I sincerely hope I got this right for the CI test env.!
libvirt-override.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 349ac63..f7b2f6b 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1679,7 +1679,7 @@ libvirt_virDomainPinIOThread(PyObject *self ATTRIBUTE_UNUSED,
#endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */
-#if LIBVIR_CHECK_VERSION(4, 10, 4)
+#if LIBVIR_CHECK_VERSION(4, 10, 0)
static virPyTypedParamsHint virPyDomainSetIOThreadParams[] = {
{ VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, VIR_TYPED_PARAM_ULLONG },
@@ -10039,7 +10039,7 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetIOThreadInfo", libvirt_virDomainGetIOThreadInfo, METH_VARARGS, NULL},
{(char *) "virDomainPinIOThread", libvirt_virDomainPinIOThread, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */
-#if LIBVIR_CHECK_VERSION(4, 10, 4)
+#if LIBVIR_CHECK_VERSION(4, 10, 0)
{(char *) "virDomainSetIOThreadParams", libvirt_virDomainSetIOThreadParams, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(4, 10, 0) */
{(char *) "virConnectListStoragePools", libvirt_virConnectListStoragePools, METH_VARARGS, NULL},
--
2.17.2
6 years
[libvirt] [PATCH v2 0/2] Couple of fixes and impl for virDomainSetIOThreadParams
by John Ferlan
v1: https://www.redhat.com/archives/libvir-list/2018-November/msg00772.html
Changes since v1:
- Pushed the first two patches w/ R-By
- Add/Insert a patch to handle when PyDict_Check fails
- Modify libvirt_virDomainSetIOThreadParams from code review for
the @args on the same line (not sure why I did that) and to add
the else for PyDict_Check failure with error message.
- Change the "IOThread performance parameters" to "IOThread polling
parameters" since that more closely describes them.
John Ferlan (2):
Add check for params, nparams being a dictionary
Implement API binding for virDomainSetIOThreadParams
generator.py | 1 +
libvirt-override-api.xml | 8 +++++
libvirt-override.c | 67 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+)
--
2.17.2
6 years
[libvirt] [libvirt-python PATCH 0/3] Couple of fixes and impl for virDomainSetIOThreadParams
by John Ferlan
First two patches are a couple of fixes I noted while implementing
and looking for "similar examples". The last patch is the impl for
the API (it does fix the build).
John Ferlan (3):
Fix typos in virDomainSetSchedulerParameters name
Add missing virPyDictToTypedParams for libvirt_virDomainBlockCopy
Implement API binding for virDomainSetIOThreadParams
generator.py | 1 +
libvirt-override-api.xml | 8 ++++++
libvirt-override.c | 56 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 63 insertions(+), 2 deletions(-)
--
2.17.2
6 years
[libvirt] [libvirt-perl PATCH] Add support for virDomainSetIOThreadParams
by John Ferlan
Signed-off-by: John Ferlan <jferlan(a)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
6 years
[libvirt] [PATCH 00/13] Add hvf domain type for Hypervisor.framework
by Roman Bolshakov
Hypervisor.framework provides a lightweight interface to run a virtual
cpu on macOS without the need to install third-party kernel
extensions (KEXTs).
It's supported on machines with Intel VT-x feature set that includes
Extended Page Tables (EPT) and Unrestricted Mode since macOS 10.10.
QEMU supports Hypervisor.framework since 2.12.
Roman Bolshakov (13):
conf: Define hvf domain type
qemu: Define hvf capability
qemu: Query hvf capability on macOS
qemu: Expose hvf domain type if hvf is supported
qemu: Rename kvmCPU to accelCPU
qemu: Introduce virQEMUCapsTypeIsAccelerated
qemu: Introduce virQEMUCapsHaveAccel
qemu: Introduce virQEMUCapsToVirtType
qemu: Introduce virQEMUCapsAccelStr
qemu: Make error message accel-agnostic
qemu: Correct CPU capabilities probing for hvf
schema: Add hvf domain type
news: Mention hvf domain type
docs/news.xml | 12 +++
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 4 +-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 171 +++++++++++++++++++++++++---------
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 4 +
7 files changed, 148 insertions(+), 46 deletions(-)
--
2.17.1 (Apple Git-112)
6 years