[libvirt] [PATCH 0/9] Properly implement json pseudo-protocol string deflattening
by Peter Krempa
In qemu's new syntax starting from 2.9 it's possible to have nested objects in
the json pseudo protocol string specifying a backing store for an image. Libvirt
would not be able to handle some of them, since the json deflattener was
meant to deflatten only 1 layer.
Peter Krempa (9):
tests: Rename jsontest to virjsontest
util: json: Add virJSONValueIsObject
util: Move JSON object deflattening code to json utility file
util: json: Don't remove the 'file' subobject when deflattening
tests: json: Add test for the deflattening function
util: json: Properly implement JSON deflattening
util: json: Recursively deflatten objects virJSONValueObjectDeflatten
util: storage: Always deflatten JSON pseudo-protocol objects
tests: Validate that JSON deflattening fixed nested json
pseudo-protocol strings
src/libvirt_private.syms | 2 +
src/util/virjson.c | 115 +++++++++++++++++++++
src/util/virjson.h | 4 +
src/util/virstoragefile.c | 79 ++------------
tests/Makefile.am | 8 +-
tests/virjsondata/deflatten-basic-file-in.json | 8 ++
tests/virjsondata/deflatten-basic-file-out.json | 10 ++
tests/virjsondata/deflatten-basic-generic-in.json | 14 +++
tests/virjsondata/deflatten-basic-generic-out.json | 20 ++++
.../deflatten-concat-double-key-in.json | 7 ++
tests/virjsondata/deflatten-concat-in.json | 5 +
tests/virjsondata/deflatten-concat-out.json | 8 ++
tests/virjsondata/deflatten-deep-file-in.json | 9 ++
tests/virjsondata/deflatten-deep-file-out.json | 23 +++++
tests/virjsondata/deflatten-deep-generic-in.json | 9 ++
tests/virjsondata/deflatten-deep-generic-out.json | 27 +++++
tests/virjsondata/deflatten-double-key-in.json | 4 +
tests/virjsondata/deflatten-nested-in.json | 16 +++
tests/virjsondata/deflatten-nested-out.json | 28 +++++
tests/virjsondata/deflatten-qemu-sheepdog-in.json | 11 ++
tests/virjsondata/deflatten-qemu-sheepdog-out.json | 13 +++
tests/virjsondata/deflatten-unflattened-in.json | 12 +++
tests/virjsondata/deflatten-unflattened-out.json | 14 +++
tests/{jsontest.c => virjsontest.c} | 75 ++++++++++++++
tests/virstoragetest.c | 10 ++
25 files changed, 458 insertions(+), 73 deletions(-)
create mode 100644 tests/virjsondata/deflatten-basic-file-in.json
create mode 100644 tests/virjsondata/deflatten-basic-file-out.json
create mode 100644 tests/virjsondata/deflatten-basic-generic-in.json
create mode 100644 tests/virjsondata/deflatten-basic-generic-out.json
create mode 100644 tests/virjsondata/deflatten-concat-double-key-in.json
create mode 100644 tests/virjsondata/deflatten-concat-in.json
create mode 100644 tests/virjsondata/deflatten-concat-out.json
create mode 100644 tests/virjsondata/deflatten-deep-file-in.json
create mode 100644 tests/virjsondata/deflatten-deep-file-out.json
create mode 100644 tests/virjsondata/deflatten-deep-generic-in.json
create mode 100644 tests/virjsondata/deflatten-deep-generic-out.json
create mode 100644 tests/virjsondata/deflatten-double-key-in.json
create mode 100644 tests/virjsondata/deflatten-nested-in.json
create mode 100644 tests/virjsondata/deflatten-nested-out.json
create mode 100644 tests/virjsondata/deflatten-qemu-sheepdog-in.json
create mode 100644 tests/virjsondata/deflatten-qemu-sheepdog-out.json
create mode 100644 tests/virjsondata/deflatten-unflattened-in.json
create mode 100644 tests/virjsondata/deflatten-unflattened-out.json
rename tests/{jsontest.c => virjsontest.c} (89%)
--
2.12.2
7 years, 5 months
[libvirt] [PATCH 0/5] tests: json: Improve testing of parsing and formatting
by Peter Krempa
For an experiment I was doing I needed to nest JSON string into an attribute of
a different JSON string, so I wrote some tests for that.
The experiment failed, but the tests may make sense to have in libvirt.
Peter Krempa (5):
tests: Rename jsontest to virjsontest
tests: virjson: Modify logic in testJSONFromString
tests: virjson: Remove spaces from 'very-hard' parsing example
tests: virjson: Test formatting along with parsing of JSON objects
tests: virjson: Test string escaping
tests/Makefile.am | 8 +-
tests/{jsontest.c => virjsontest.c} | 195 +++++++++++++++++++++++++++---------
2 files changed, 150 insertions(+), 53 deletions(-)
rename tests/{jsontest.c => virjsontest.c} (69%)
--
2.12.2
7 years, 5 months
[libvirt] [PATCH 0/8] Yet another round of qemu namespace fixes
by Michal Privoznik
I've encountered couple of problems while playing with the namespaces. For the
first issue (2/8) I've got a confirmation from openstack guys that it fixes
their issue.
Michal Privoznik (8):
conf: Rename and expose virDomainChrSourceDefPath
qemuDomainBuildNamespace: Handle special file mount points
qemu: Move preserved mount points path generation into a separate
function
qemuDomainCreateDeviceRecursive: Fail on unsupported file type
qemuDomainAttachDeviceMknodHelper: Fail on unsupported file type
qemuDomainCreateDeviceRecursive: Support file mount points
qemuDomainAttachDeviceMknodRecursive: Support file mount points
qemu ns: Create chardev backends more frequently
src/conf/domain_audit.c | 44 ++---------
src/conf/domain_conf.c | 33 +++++++++
src/conf/domain_conf.h | 2 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 186 ++++++++++++++++++++++++++++++++++-------------
5 files changed, 178 insertions(+), 88 deletions(-)
--
2.13.0
7 years, 5 months
[libvirt] [PATCH go-xml] Support WWN tag in disks
by Thomas Hipp
Support the WWN (World Wide Name) tag in disks, and add test code.
Signed-off-by: Thomas Hipp <thipp(a)suse.de>
---
domain.go | 1 +
domain_test.go | 2 ++
2 files changed, 3 insertions(+)
diff --git a/domain.go b/domain.go
index b9b0f77..93e2b56 100644
--- a/domain.go
+++ b/domain.go
@@ -124,6 +124,7 @@ type DomainDisk struct {
Shareable *DomainDiskShareable `xml:"shareable"`
Address *DomainAddress `xml:"address"`
Boot *DomainDeviceBoot `xml:"boot"`
+ WWN string `xml:"wwn,omitempty"`
}
type DomainFilesystemDriver struct {
diff --git a/domain_test.go b/domain_test.go
index 47e5e26..9568f9e 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -1178,6 +1178,7 @@ var domainTestData = []struct {
Bus: "virtio",
},
Serial: "fishfood",
+ WWN: "0123456789abcdef",
},
Expected: []string{
`<disk type="file" device="cdrom">`,
@@ -1185,6 +1186,7 @@ var domainTestData = []struct {
` <source file="/var/lib/libvirt/images/demo.qcow2"></source>`,
` <target dev="vda" bus="virtio"></target>`,
` <serial>fishfood</serial>`,
+ ` <wwn>0123456789abcdef</wwn>`,
`</disk>`,
},
},
--
2.13.2
7 years, 5 months
[libvirt] [PATCH go-xml v3] Add support for QEMU
by Thomas Hipp
Add support for QEMU, and add test code.
Signed-off-by: Thomas Hipp <thipp(a)suse.de>
---
Changes since v2:
- set default ns in commandline subtree
- remove ns prefix "qemu:"
---
domain.go | 50 +++++++++++++++++++++++++++++++++-----------------
domain_test.go | 27 +++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 17 deletions(-)
diff --git a/domain.go b/domain.go
index b9b0f77..d5d358a 100644
--- a/domain.go
+++ b/domain.go
@@ -590,27 +590,43 @@ type DomainFeatureList struct {
SMM *DomainFeatureState `xml:"smm"`
}
+type DomainQEMUCommandlineArg struct {
+ Value string `xml:"value,attr"`
+}
+
+type DomainQEMUCommandlineEnv struct {
+ Name string `xml:"name,attr"`
+ Value string `xml:"value,attr,omitempty"`
+}
+
+type DomainQEMUCommandline struct {
+ XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/qemu/1.0 commandline"`
+ Args []DomainQEMUCommandlineArg `xml:"arg"`
+ Envs []DomainQEMUCommandlineEnv `xml:"env"`
+}
+
// NB, try to keep the order of fields in this struct
// matching the order of XML elements that libvirt
// will generate when dumping XML.
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"`
- Resource *DomainResource `xml:"resource"`
- SysInfo *DomainSysInfo `xml:"sysinfo"`
- OS *DomainOS `xml:"os"`
- Features *DomainFeatureList `xml:"features"`
- CPU *DomainCPU `xml:"cpu"`
- OnPoweroff string `xml:"on_poweroff,omitempty"`
- OnReboot string `xml:"on_reboot,omitempty"`
- OnCrash string `xml:"on_crash,omitempty"`
- Devices *DomainDeviceList `xml:"devices"`
+ 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"`
+ Resource *DomainResource `xml:"resource"`
+ SysInfo *DomainSysInfo `xml:"sysinfo"`
+ OS *DomainOS `xml:"os"`
+ Features *DomainFeatureList `xml:"features"`
+ CPU *DomainCPU `xml:"cpu"`
+ OnPoweroff string `xml:"on_poweroff,omitempty"`
+ OnReboot string `xml:"on_reboot,omitempty"`
+ OnCrash string `xml:"on_crash,omitempty"`
+ Devices *DomainDeviceList `xml:"devices"`
+ QEMUCommandline *DomainQEMUCommandline
}
func (d *Domain) Unmarshal(doc string) error {
diff --git a/domain_test.go b/domain_test.go
index 47e5e26..f2d83fc 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -1141,6 +1141,33 @@ var domainTestData = []struct {
`</domain>`,
},
},
+ {
+ Object: &Domain{
+ Type: "qemu",
+ Name: "test",
+ QEMUCommandline: &DomainQEMUCommandline{
+ Args: []DomainQEMUCommandlineArg{
+ DomainQEMUCommandlineArg{Value: "-newarg"},
+ DomainQEMUCommandlineArg{Value: "-oldarg"},
+ },
+ Envs: []DomainQEMUCommandlineEnv{
+ DomainQEMUCommandlineEnv{Name: "QEMU_ENV", Value: "VAL"},
+ DomainQEMUCommandlineEnv{Name: "QEMU_VAR", Value: "VAR"},
+ },
+ },
+ },
+ Expected: []string{
+ `<domain type="qemu">`,
+ ` <name>test</name>`,
+ ` <commandline xmlns="http://libvirt.org/schemas/domain/qemu/1.0">`,
+ ` <arg value="-newarg"></arg>`,
+ ` <arg value="-oldarg"></arg>`,
+ ` <env name="QEMU_ENV" value="VAL"></env>`,
+ ` <env name="QEMU_VAR" value="VAR"></env>`,
+ ` </commandline>`,
+ `</domain>`,
+ },
+ },
/* Tests for sub-documents that can be hotplugged */
{
--
2.13.2
7 years, 5 months
[libvirt] [PATCH go-xml] Add support for domain clock and test code
by zhenwei.pi
Signed-off-by: zhenwei.pi <zhenwei.pi(a)youruncloud.com>
---
domain.go | 7 +++++++
domain_test.go | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/domain.go b/domain.go
index b9b0f77..1d020aa 100644
--- a/domain.go
+++ b/domain.go
@@ -532,6 +532,12 @@ type DomainCPU struct {
Features []DomainCPUFeature `xml:"feature"`
}
+type DomainClock struct {
+ Offset string `xml:"offset,attr,omitempty"`
+ Basic string `xml:"basic,attr,omitempty"`
+ Adjustment int `xml:"adjustment,attr,omitempty"`
+}
+
type DomainFeature struct {
}
@@ -607,6 +613,7 @@ type Domain struct {
OS *DomainOS `xml:"os"`
Features *DomainFeatureList `xml:"features"`
CPU *DomainCPU `xml:"cpu"`
+ Clock *DomainClock `xml:"clock,omitempty"`
OnPoweroff string `xml:"on_poweroff,omitempty"`
OnReboot string `xml:"on_reboot,omitempty"`
OnCrash string `xml:"on_crash,omitempty"`
diff --git a/domain_test.go b/domain_test.go
index 47e5e26..536b94c 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -491,6 +491,11 @@ var domainTestData = []struct {
},
},
},
+ Clock: &DomainClock{
+ Offset: "variable",
+ Basic: "utc",
+ Adjustment: 28794,
+ },
},
Expected: []string{
`<domain type="kvm">`,
@@ -524,6 +529,7 @@ var domainTestData = []struct {
` <initarg>--unit</initarg>`,
` <initarg>emergency.service</initarg>`,
` </os>`,
+ ` <clock offset="variable" basic="utc" adjustment="28794"></clock>`,
`</domain>`,
},
},
--
2.7.4
7 years, 5 months
[libvirt] [PATCH] vz: allow to start vz driver without host cache info
by Mikhail Feoktistov
---
src/vz/vz_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 6f4aee3..eb97e54 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -119,7 +119,7 @@ vzBuildCapabilities(void)
goto error;
if (virCapabilitiesInitCaches(caps) < 0)
- goto error;
+ VIR_WARN("Failed to get host CPU cache info");
verify(ARRAY_CARDINALITY(archs) == ARRAY_CARDINALITY(emulators));
--
1.8.3.1
7 years, 5 months
[libvirt] [PATCH] autogen.sh: tell user the correct make command
by Daniel P. Berrange
When autogen.sh finishes it helpfully prints
"Now type 'make' to compile libvirt."
which is fine if on a host with GNU make, but on *BSD running
'make' will end in tears. We should tell users to run 'gmake'
on these platforms. If 'gmake' doesn't exist then we should
report an error too
"GNU make is required to build libvirt"
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
autogen.sh | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/autogen.sh b/autogen.sh
index d5d836a..1e99ce8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -193,4 +193,21 @@ else
fi
echo
-echo "Now type 'make' to compile libvirt."
+
+# Make sure we can find GNU make and tell the user
+# the right command to run
+make -v | grep "GNU Make" 1>/dev/null 2>&1
+if test $? = 0
+then
+ MAKE=make
+else
+ which gmake 1>/dev/null 2>&1
+ if test $? = 0
+ then
+ MAKE=gmake
+ else
+ die "GNU make is required to build libvirt"
+ fi
+fi
+
+echo "Now type '$MAKE' to compile libvirt."
--
2.9.4
7 years, 5 months
[libvirt] [PATCH v4 0/6] Fix error reporting in streams
by Michal Privoznik
v4 of:
https://www.redhat.com/archives/libvir-list/2017-June/msg00190.html
Frankly, nothing much changed since v3, but the discussion on those patches got
very hairy and without any explicit ACKs. So I'm resending to get them :-)
Michal Privoznik (6):
virfdstream: Check for thread error more frequently
fdstream: Report error from the I/O thread
virStream*All: Call virStreamAbort() more frequently
virStream*All: Preserve reported error
virFileInData: preserve errno in cleanup path
virStream*All: Report error if a callback fails
daemon/stream.c | 18 ++++++---
include/libvirt/libvirt-stream.h | 17 +++++++-
src/libvirt-stream.c | 83 +++++++++++++++++++++++++++++++---------
src/util/virfdstream.c | 26 ++++++++++---
src/util/virfile.c | 5 ++-
5 files changed, 117 insertions(+), 32 deletions(-)
--
2.13.0
7 years, 5 months
[libvirt] Potential problem with /proc/mounts items that don't exist inside Kubernetes
by Juan Hernández
Hello all,
This is my first mail to this list, so let me introduce myself. My name
is Juan Hernandez, and I work in the oVirt team. Currently I am
experimenting with the integration between ManageIQ and KubeVirt.
I recently detected a potential issue when running libvirt inside
Kubernetes, as part of KubeVirt. There are entries in /proc/mounts that
don't exist, and libvirt can't start virtual machines because of that.
This is specific to this enviroment, but I think it may be worth
addressing it in libvirt itself. See the following issue for details:
Libvirt fails when there are hidden cgroup mount points in `/proc/mounts`
https://github.com/kubevirt/libvirt/issues/4
I suggested a possible fix there, which seems simple, but it makes all
tests fail. I'd be happy to fix the tests as well, but I would need some
guidance on how to do so. Any suggestion is welcome.
Thanks in advance,
Juan Hernandez
7 years, 5 months