[libvirt] [PATCH go-xml] add support for domain features
by Ryan Goodfellow
This commit adds support for domain features. It does so by introducing
a new family of types DomainFeature*. The aggregate type
DomainFeatureList has been added to the Domain type to plumb in the new
type family. Testing has also been added in domain_test.go
---
domain.go | 91 +++++++++++++++++++++++++++++++++++++++++++++++-----------
domain_test.go | 55 +++++++++++++++++++++++++++++++++++
2 files changed, 130 insertions(+), 16 deletions(-)
diff --git a/domain.go b/domain.go
index cccd9a6..c9ffaef 100644
--- a/domain.go
+++ b/domain.go
@@ -371,23 +371,82 @@ type DomainCPU struct {
Features []DomainCPUFeature `xml:"feature"`
}
+type DomainFeature struct {
+ State string `xml:"state,attr,omitempty"`
+}
+
+type DomainFeatureAPIC struct {
+ DomainFeature
+ EOI string `xml:"eio,attr,omitempty"`
+}
+
+type DomainFeatureVendorId struct {
+ DomainFeature
+ Value string `xml:"value,attr,omitempty"`
+}
+
+type DomainFeatureSpinlocks struct {
+ DomainFeature
+ Retries uint `xml:"retries,attr,omitempty"`
+}
+
+type DomainFeatureHyperV struct {
+ DomainFeature
+ Relaxed *DomainFeature `xml:"relaxed,omitempty"`
+ VAPIC *DomainFeature `xml:"vapic,omitempty"`
+ Spinlocks *DomainFeatureSpinlocks `xml:"spinlocks,omitempty"`
+ VPIndex *DomainFeature `xml:"vpindex,omitempty"`
+ Runtime *DomainFeature `xml:"runtime,omitempty"`
+ Synic *DomainFeature `xml:"synic,omitempty"`
+ STimer *DomainFeature `xml:"stimer,omitempty"`
+ Reset *DomainFeature `xml:"reset,omitempty"`
+ VendorId *DomainFeatureVendorId `xml:"vendor_id,omitempty"`
+}
+
+type DomainFeatureKVM struct {
+ DomainFeature
+ Hidden *DomainFeature `xml:"hidden,omitempty"`
+}
+
+type DomainFeatureGIC struct {
+ DomainFeature
+ Version string `xml:"version,attr,omitempty"`
+}
+
+type DomainFeatureList struct {
+ PAE *DomainFeature `xml:"pae,omitempty"`
+ ACPI *DomainFeature `xml:"acpi,omitempty"`
+ APIC *DomainFeatureAPIC `xml:"apic,omitempty"`
+ HAP *DomainFeature `xml:"hap,omitempty"`
+ Viridian *DomainFeature `xml:"viridian,omitempty"`
+ PrivNet *DomainFeature `xml:"privnet,omitempty"`
+ HyperV *DomainFeatureHyperV `xml:"hyperv,omitempty"`
+ KVM *DomainFeatureKVM `xml:"kvm,omitempty"`
+ PVSpinlock *DomainFeature `xml:"pvspinlock,omitempty"`
+ PMU *DomainFeature `xml:"pmu,omitempty"`
+ VMPort *DomainFeature `xml:"vmport,omitempty"`
+ GIC *DomainFeatureGIC `xml:"gic,omitempty"`
+ SMM *DomainFeature `xml:"smm,omitempty"`
+}
+
type Domain struct {
- XMLName xml.Name `xml:"domain"`
- Type string `xml:"type,attr,omitempty"`
- Name string `xml:"name"`
- UUID string `xml:"uuid,omitempty"`
- Memory *DomainMemory `xml:"memory"`
- CurrentMemory *DomainMemory `xml:"currentMemory"`
- MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
- VCPU *DomainVCPU `xml:"vcpu"`
- CPU *DomainCPU `xml:"cpu"`
- Resource *DomainResource `xml:"resource"`
- Devices *DomainDeviceList `xml:"devices"`
- OS *DomainOS `xml:"os"`
- SysInfo *DomainSysInfo `xml:"sysinfo"`
- OnPoweroff string `xml:"on_poweroff,omitempty"`
- OnReboot string `xml:"on_reboot,omitempty"`
- OnCrash string `xml:"on_crash,omitempty"`
+ XMLName xml.Name `xml:"domain"`
+ Type string `xml:"type,attr,omitempty"`
+ Name string `xml:"name"`
+ UUID string `xml:"uuid,omitempty"`
+ Memory *DomainMemory `xml:"memory"`
+ CurrentMemory *DomainMemory `xml:"currentMemory"`
+ MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
+ VCPU *DomainVCPU `xml:"vcpu"`
+ CPU *DomainCPU `xml:"cpu"`
+ Resource *DomainResource `xml:"resource"`
+ Devices *DomainDeviceList `xml:"devices"`
+ OS *DomainOS `xml:"os"`
+ SysInfo *DomainSysInfo `xml:"sysinfo"`
+ OnPoweroff string `xml:"on_poweroff,omitempty"`
+ OnReboot string `xml:"on_reboot,omitempty"`
+ OnCrash string `xml:"on_crash,omitempty"`
+ Features *DomainFeatureList `xml:"features,omitempty"`
}
func (d *Domain) Unmarshal(doc string) error {
diff --git a/domain_test.go b/domain_test.go
index 06d585c..e25007e 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -745,6 +745,61 @@ var domainTestData = []struct {
`</domain>`,
},
},
+ {
+ Object: &Domain{
+ Type: "kvm",
+ Name: "test",
+ Features: &DomainFeatureList{
+ PAE: &DomainFeature{},
+ ACPI: &DomainFeature{},
+ APIC: &DomainFeatureAPIC{},
+ HAP: &DomainFeature{},
+ PrivNet: &DomainFeature{},
+ HyperV: &DomainFeatureHyperV{
+ Relaxed: &DomainFeature{State: "on"},
+ VAPIC: &DomainFeature{State: "on"},
+ Spinlocks: &DomainFeatureSpinlocks{DomainFeature{State: "on"}, 4096},
+ VPIndex: &DomainFeature{State: "on"},
+ Runtime: &DomainFeature{State: "on"},
+ Synic: &DomainFeature{State: "on"},
+ Reset: &DomainFeature{State: "on"},
+ VendorId: &DomainFeatureVendorId{DomainFeature{State: "on"}, "KVM Hv"},
+ },
+ KVM: &DomainFeatureKVM{
+ Hidden: &DomainFeature{State: "on"},
+ },
+ PVSpinlock: &DomainFeature{State: "on"},
+ GIC: &DomainFeatureGIC{Version: "2"},
+ },
+ },
+ Expected: []string{
+ `<domain type="kvm">`,
+ ` <name>test</name>`,
+ ` <features>`,
+ ` <pae></pae>`,
+ ` <acpi></acpi>`,
+ ` <apic></apic>`,
+ ` <hap></hap>`,
+ ` <privnet></privnet>`,
+ ` <hyperv>`,
+ ` <relaxed state="on"></relaxed>`,
+ ` <vapic state="on"></vapic>`,
+ ` <spinlocks state="on" retries="4096"></spinlocks>`,
+ ` <vpindex state="on"></vpindex>`,
+ ` <runtime state="on"></runtime>`,
+ ` <synic state="on"></synic>`,
+ ` <reset state="on"></reset>`,
+ ` <vendor_id state="on" value="KVM Hv"></vendor_id>`,
+ ` </hyperv>`,
+ ` <kvm>`,
+ ` <hidden state="on"></hidden>`,
+ ` </kvm>`,
+ ` <pvspinlock state="on"></pvspinlock>`,
+ ` <gic version="2"></gic>`,
+ ` </features>`,
+ `</domain>`,
+ },
+ },
}
func TestDomain(t *testing.T) {
--
2.11.0
7 years, 6 months
[libvirt] [PATCH v2 0/4] qemu: Allow setting sslverify option
by Peter Krempa
This is a rebased version now that the <cookie> support was postponed.
Peter Krempa (4):
qemu: capabilities: Add capability for the sslverify curl driver
option
conf: Use only one temporary string in virDomainDiskSourceParse
conf: Add support for modifying ssl validation for https/ftps disks
qemu: command: Implement ssl verification configuration
docs/formatdomain.html.in | 9 ++++
docs/schemas/domaincommon.rng | 47 ++++++++++++++++++-
src/conf/domain_conf.c | 34 +++++++++++---
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 22 +++++++--
src/util/virstoragefile.h | 1 +
.../generic-disk-network-http.xml | 9 ++++
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
.../qemuxml2argv-disk-drive-network-http.args | 37 +++++++++++++++
.../qemuxml2argv-disk-drive-network-http.xml | 52 ++++++++++++++++++++++
11 files changed, 202 insertions(+), 13 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xml
--
2.12.2
7 years, 6 months
[libvirt] [PATCH] mdev: Cleanup code after commits @daf5081b and @2739a983
by Erik Skultety
So, because mingw is somehow OK with dereferencing a pointer within a
VIR_DEBUG macro, compared to outside of it to which it complained with a
"potential NULL pointer dereference" error (still a false positive), we
can make the code a tiny bit cleaner.
Sighed-by: Erik Skultety <eskultet(a)redhat.com>
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/util/virmdev.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index 174f48cb3..bd8e3f8de 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -449,13 +449,8 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst,
virObjectLock(dst);
for (i = 0; i < count; i++) {
- const char *mdev_path = NULL;
virMediatedDevicePtr mdev = virMediatedDeviceListGet(src, i);
- if (!mdev)
- goto cleanup;
-
- mdev_path = mdev->path;
if (virMediatedDeviceIsUsed(mdev, dst) ||
virMediatedDeviceSetUsedBy(mdev, drvname, domname) < 0)
goto cleanup;
@@ -464,11 +459,11 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst,
* - caller is responsible for NOT freeing devices in @src on success
* - we're responsible for performing a rollback on failure
*/
+ VIR_DEBUG("Add '%s' to list of active mediated devices used by '%s'",
+ mdev->path, domname);
if (virMediatedDeviceListAdd(dst, &mdev) < 0)
goto rollback;
- VIR_DEBUG("'%s' added to list of active mediated devices used by '%s'",
- mdev_path, domname);
}
ret = 0;
--
2.12.2
7 years, 6 months
[libvirt] [PATCH] virNWFilterObjListFree: Don't leak nwfilters->objs
by Michal Privoznik
When adding a nwfilter onto the list in
virNWFilterObjListAssignDef() this array is re-allocated to match
demand for new size. However, it is never freed leading to a
leak:
==26535== 136 bytes in 1 blocks are definitely lost in loss record 1,079 of 1,250
==26535== at 0x4C2E2BE: realloc (vg_replace_malloc.c:785)
==26535== by 0x54BA28E: virReallocN (viralloc.c:245)
==26535== by 0x54BA384: virExpandN (viralloc.c:294)
==26535== by 0x54BA657: virInsertElementsN (viralloc.c:436)
==26535== by 0x55DB011: virNWFilterObjListAssignDef (virnwfilterobj.c:362)
==26535== by 0x55DB530: virNWFilterObjListLoadConfig (virnwfilterobj.c:503)
==26535== by 0x55DB635: virNWFilterObjListLoadAllConfigs (virnwfilterobj.c:539)
==26535== by 0x2AC5A28B: nwfilterStateInitialize (nwfilter_driver.c:250)
==26535== by 0x5621C64: virStateInitialize (libvirt.c:770)
==26535== by 0x124379: daemonRunStateInit (libvirtd.c:881)
==26535== by 0x554AC78: virThreadHelper (virthread.c:206)
==26535== by 0x8F5F493: start_thread (in /lib64/libpthread-2.23.so)
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/virnwfilterobj.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index c69407a..b5aaa6b 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -110,6 +110,7 @@ virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
size_t i;
for (i = 0; i < nwfilters->count; i++)
virNWFilterObjFree(nwfilters->objs[i]);
+ VIR_FREE(nwfilters->objs);
VIR_FREE(nwfilters);
}
--
2.10.2
7 years, 6 months
[libvirt] [PATCH] virPerfEventIsEnabled: Accept NULL @perf
by Michal Privoznik
After bdcf6e481 there is a crasher in libvirt. The commit assumes
that priv->perf is always set. That is not true. For inactive
domains, the priv->perf is not allocated as it is set in
qemuProcessLaunch(). Now, usually we differentiate between
accesses to inactive and active definition and it works just
fine. Except for 'domstats'. There priv->perf is accessed without
prior check for domain inactivity. While we could check for that,
more robust solution is to make virPerfEventIsEnabled() accept
NULL.
How to reproduce:
1) ensure you have at least one inactive domain
2) virsh domstats
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virperf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virperf.c b/src/util/virperf.c
index fa5b6cc..2c832b3 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -297,7 +297,7 @@ virPerfEventDisable(virPerfPtr perf,
bool virPerfEventIsEnabled(virPerfPtr perf,
virPerfEventType type)
{
- return perf->events[type].enabled;
+ return perf && perf->events[type].enabled;
}
int
--
2.10.2
7 years, 6 months
[libvirt] [PATCH] mdev: Fix mingw build by adding a check for non-NULL pointer
by Erik Skultety
This patch fixes the following MinGW error (although actually being a
false positive):
../../src/util/virmdev.c: In function 'virMediatedDeviceListMarkDevices':
../../src/util/virmdev.c:453:21: error: potential null pointer
dereference [-Werror=null-dereference]
const char *mdev_path = mdev->path;
^~~~~~~~~
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
Pushed under the build breaker rule.
Erik
src/util/virmdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index c861d21..174f48c 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -449,9 +449,13 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst,
virObjectLock(dst);
for (i = 0; i < count; i++) {
+ const char *mdev_path = NULL;
virMediatedDevicePtr mdev = virMediatedDeviceListGet(src, i);
- const char *mdev_path = mdev->path;
+ if (!mdev)
+ goto cleanup;
+
+ mdev_path = mdev->path;
if (virMediatedDeviceIsUsed(mdev, dst) ||
virMediatedDeviceSetUsedBy(mdev, drvname, domname) < 0)
goto cleanup;
--
2.9.3
7 years, 6 months
[libvirt] Raising limits for our RPC messages
by Michal Privoznik
Dear list,
maybe you've seen us raising limit for various parts of RPC messages
(for eaxmple: d15b29be, 66bfc7cc61ca0, e914dcfd, etc.). It usually
happens when we receive a report that current limits are not enough.
Well, we just did:
https://bugzilla.redhat.com/show_bug.cgi?id=1440683
The thing is, virConnectGetAllDomainStats() is unable to encode RPC
message because there's so much domains & stats to send that the limit
is reached. Now, I was thinking how to approach this problem. Yes, we
can raise the limits again. But we also have another approach: split
data into multiple messages. The current limit for an RPC message is
4MB. Say you have 9MB of data you want to send to the other side. We
could construct 3 messages (4 + 4 + 1) and send them to the other side
where the data would be reconstructed.
At RPC level, we could use @status header file to represent intermediate
messages. That is, for the example above messages with the following
headers would be constructed:
{.len = 4MB, prog, vers, proc, .type = VIR_NET_REPLY, .serial, .status =
VIR_NET_CONTINUE}
{.len = 4MB, prog, vers, proc, .type = VIR_NET_REPLY, .serial, .status =
VIR_NET_CONTINUE}
{.len = 1MB, prog, vers, proc, .type = VIR_NET_REPLY, .serial, .status =
VIR_NET_OK}
(the actual @len accounts for message header too, so the message would
be split into <nearly 4MB + nearly 4MB + slightly over 1MB> chunks, but
that is not important right now)
Just like we have in streams, VIR_NET_CONTINUE tells that there is more
data yet to come, VIR_NET_OK could then mark the last packet in the stream.
Cool you say, this could work. But not really. The problem with this
approach is:
a) we just transform problem to a different one (the limit of number of
messages data can be split into)
b) increased overhead (message header is sent multiple times)
c) I don't expect we will ever support cherry-picking of messages
(caller picks just the message that contains data they are interested in
and discards the rest).
So after all, we will effectively have the limit of message size
increased to $limit_of_split_messages * $current_limit_of_message_size.
Instead of introducing complex code that splits data into messages and
reconstructs back, we might as well increase the current limit of
message size.
Michal
7 years, 6 months
[libvirt] [PATCH 0/2] news: Update for v3.3.0
by Andrea Bolognani
The release notes have been almost completely neglected this
cycle, so I've spent some time going through the git log and
trying to include what to me looked like relevant changes.
Summaries and descriptions are going to be worse that they
would be if they were written by the people implementing the
changes, but I reckon it's still better than nothing :)
Reviews are much appreciated, but if I won't get any feedback
I will push this anyway before release just so that v3.3.0
doesn't end up including such sorry excuse for release notes
in the final tarball.
Andrea Bolognani (2):
news: Tweak existing v3.3.0 entries
news: Add more v3.3.0 entries
docs/news.xml | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 119 insertions(+), 4 deletions(-)
--
2.7.4
7 years, 6 months