[libvirt] [PATCH go-xml] Add support for device RNG
by Thomas Hipp
Add support for device RNG (random number generator), and add test code.
Signed-off-by: Thomas Hipp <thipp(a)suse.de>
---
domain.go | 34 +++++++++++++++++++++++
domain_test.go | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+)
diff --git a/domain.go b/domain.go
index f9e3a80..b4f56bf 100644
--- a/domain.go
+++ b/domain.go
@@ -184,6 +184,8 @@ type DomainInterfaceSource struct {
Path string `xml:"path,attr,omitempty"`
Mode string `xml:"mode,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
+ Service string `xml:"service,attr,omitempty"`
+ Host string `xml:"host,attr,omitempty"`
}
type DomainInterfaceTarget struct {
@@ -384,6 +386,25 @@ type DomainSound struct {
Address *DomainAddress `xml:"address"`
}
+type DomainRNGRate struct {
+ Bytes uint `xml:"bytes,attr"`
+ Period uint `xml:"period,attr,omitempty"`
+}
+
+type DomainRNGBackend struct {
+ Backend string `xml:",chardata"`
+ Model string `xml:"model,attr"`
+ Type string `xml:"type,attr,omitempty"`
+ Sources []DomainInterfaceSource `xml:"source"`
+}
+
+type DomainRNG struct {
+ XMLName xml.Name `xml:"rng"`
+ Model string `xml:"model,attr"`
+ Rate *DomainRNGRate `xml:"rate"`
+ Backend *DomainRNGBackend `xml:"backend"`
+}
+
type DomainDeviceList struct {
Emulator string `xml:"emulator,omitempty"`
Controllers []DomainController `xml:"controller"`
@@ -398,6 +419,7 @@ type DomainDeviceList struct {
Channels []DomainChannel `xml:"channel"`
MemBalloon *DomainMemBalloon `xml:"memballoon"`
Sounds []DomainSound `xml:"sound"`
+ RNGs []DomainRNG `xml:"rng"`
}
type DomainMemory struct {
@@ -734,3 +756,15 @@ func (d *DomainSound) Marshal() (string, error) {
}
return string(doc), nil
}
+
+func (d *DomainRNG) Unmarshal(doc string) error {
+ return xml.Unmarshal([]byte(doc), d)
+}
+
+func (d *DomainRNG) Marshal() (string, error) {
+ doc, err := xml.MarshalIndent(d, "", " ")
+ if err != nil {
+ return "", err
+ }
+ return string(doc), nil
+}
diff --git a/domain_test.go b/domain_test.go
index 0ce908b..aac23fe 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -333,6 +333,30 @@ var domainTestData = []struct {
},
},
},
+ RNGs: []DomainRNG{
+ DomainRNG{
+ Model: "virtio",
+ Rate: &DomainRNGRate{
+ Period: 2000,
+ Bytes: 1234,
+ },
+ Backend: &DomainRNGBackend{
+ Model: "egd",
+ Type: "udp",
+ Sources: []DomainInterfaceSource{
+ DomainInterfaceSource{
+ Mode: "bind",
+ Service: "1234",
+ },
+ DomainInterfaceSource{
+ Mode: "connect",
+ Host: "1.2.3.4",
+ Service: "1234",
+ },
+ },
+ },
+ },
+ },
},
},
Expected: []string{
@@ -368,6 +392,13 @@ var domainTestData = []struct {
` <codec type="duplex"></codec>`,
` <address type="pci" domain="0" bus="0" slot="8" function="0"></address>`,
` </sound>`,
+ ` <rng model="virtio">`,
+ ` <rate bytes="1234" period="2000"></rate>`,
+ ` <backend model="egd" type="udp">`,
+ ` <source mode="bind" service="1234"></source>`,
+ ` <source mode="connect" service="1234" host="1.2.3.4"></source>`,
+ ` </backend>`,
+ ` </rng>`,
` </devices>`,
`</domain>`,
},
@@ -1334,6 +1365,60 @@ var domainTestData = []struct {
`</sound>`,
},
},
+ {
+ Object: &DomainRNG{
+ Model: "virtio",
+ Rate: &DomainRNGRate{
+ Period: 2000,
+ Bytes: 1234,
+ },
+ Backend: &DomainRNGBackend{
+ Backend: "/dev/random",
+ Model: "random",
+ },
+ },
+
+ Expected: []string{
+ `<rng model="virtio">`,
+ ` <rate bytes="1234" period="2000"></rate>`,
+ ` <backend model="random">/dev/random</backend>`,
+ `</rng>`,
+ },
+ },
+ {
+ Object: &DomainRNG{
+ Model: "virtio",
+ Rate: &DomainRNGRate{
+ Period: 2000,
+ Bytes: 1234,
+ },
+ Backend: &DomainRNGBackend{
+ Model: "egd",
+ Type: "udp",
+ Sources: []DomainInterfaceSource{
+ DomainInterfaceSource{
+ Mode: "bind",
+ Service: "1234",
+ },
+ DomainInterfaceSource{
+ Mode: "connect",
+ Host: "1.2.3.4",
+ Service: "1234",
+ },
+ },
+ },
+ },
+
+ Expected: []string{
+ `<rng model="virtio">`,
+ ` <rate bytes="1234" period="2000"></rate>`,
+ ` <backend model="egd" type="udp">`,
+ ` <source mode="bind" service="1234"></source>`,
+ ` <source mode="connect" service="1234" host="1.2.3.4"></source>`,
+ ` </backend>`,
+ `</rng>`,
+ },
+ },
}
func TestDomain(t *testing.T) {
--
2.13.2
7 years, 4 months
[libvirt] [PATCH v3 0/7] Add new APIs to edit xml configuration of managed save state of a domain
by Kothapally Madhu Pavan
managedsave command offloads the user from managing the save state file.
It does not need the user to specify saved state file location, all it takes
is domain name to identify. This makes it much more comfortable to use in
emergency where immediate shutdowm is needed. But it doesn't provide a way
to edit XML description of the save state file without user going through an
extra effort to search manually where the file actually exists.
The series aims to overcome the above constraints by adding new APIs and
commands to seemlessly edit the managed save state XML description using
just the domain name. The Patches mainly make use of the save-image-edit
code flow only to simplify the above use case.
This patch set provides capability to Dump and Edit the XML configuration
associated with a saved state file of a domain which was created by the
managedsave command.
The new command carry the similar options as the save-image-<XXX> commands
to change the running state as to paused state or running on start.
This is equivalent to:
virsh managedsave-dumpxml domain-name > state-file.xml
vi state-file.xml (or make changes with your other text editor)
virsh managedsave-define domain-name state-file-xml
or you can simply use:
virsh managedsave-edit domain-name
It's always better when we get more.
Changes since v2:
- refracted version references from 3.5.0 to 3.6.0
Changes since v1:
- qemu implementation called directly rather than going through
driver pointer in qemuDomainManagedSaveDefineXML.
- check whether the managed save state file exists and report a
error if it doesn't.
Kothapally Madhu Pavan (7):
lib: Add API to dump xml configuration of managed save state domain
lib: Add API to edit domain's managed save state xml configuration
qemu: Implement qemuDomainManagedSaveGetXMLDesc
qemu: Implement qemuDomainManagedSaveDefineXML
virsh: Implement managedsave-define command
virsh: Implement managedsave-dumpxml command
virsh: Implement managedsave-edit command
include/libvirt/libvirt-domain.h | 6 ++
src/driver-hypervisor.h | 11 +++
src/libvirt-domain.c | 107 ++++++++++++++++++++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_driver.c | 87 ++++++++++++++++
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 31 +++++-
src/remote_protocol-structs | 14 +++
tools/virsh-domain.c | 207 +++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 41 ++++++++
10 files changed, 511 insertions(+), 1 deletion(-)
--
1.8.3.1
7 years, 4 months
[libvirt] [PATCH v3 0/4] lxc improvements
by Cédric Bosdonnat
Hi all,
Here is a series grouping several small patches I sent
independently to the mailing list.
Main change since v2:
* <inituser> and <initgroup> have been changed to hold either a uid or
name as text child, rather than in an attribute.
* Moved the uid/gid setting to after the pivot_root to allow getting
the uid/gid from name.
Cédric Bosdonnat (4):
lxc: allow defining environment variables
util: share code between virExec and virCommandExec
lxc: allow user to specify command working directory
lxc: add possibility to define init uid/gid
docs/formatdomain.html.in | 17 +++++++++
docs/schemas/domaincommon.rng | 29 +++++++++++++++
src/conf/domain_conf.c | 52 ++++++++++++++++++++++++++
src/conf/domain_conf.h | 11 ++++++
src/lxc/lxc_container.c | 59 ++++++++++++++++++++++++++++++
src/util/vircommand.c | 69 ++++++++++++++++++++---------------
tests/lxcxml2xmldata/lxc-initdir.xml | 30 +++++++++++++++
tests/lxcxml2xmldata/lxc-initenv.xml | 30 +++++++++++++++
tests/lxcxml2xmldata/lxc-inituser.xml | 31 ++++++++++++++++
tests/lxcxml2xmltest.c | 3 ++
10 files changed, 302 insertions(+), 29 deletions(-)
create mode 100644 tests/lxcxml2xmldata/lxc-initdir.xml
create mode 100644 tests/lxcxml2xmldata/lxc-initenv.xml
create mode 100644 tests/lxcxml2xmldata/lxc-inituser.xml
--
2.12.2
7 years, 4 months
[libvirt] [PATCH] news: CPU add migration fix into Bug fixes
by Pavel Hrdina
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/news.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index f38abeb91d..f590d9cdfc 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -197,6 +197,18 @@
QEMU releases older than 1.6.
</description>
</change>
+ <change>
+ <summary>
+ qemu: Fix migration to older libvirt/QEMU versions
+ </summary>
+ <description>
+ When the guest is started libvirt updates the CPU definition to
+ reflect the actual CPU features to enforce ABI. We need to send
+ original and updated CPU definition in order to support migration
+ to older libvirt/QEMU versions. Only the updated CPU definition
+ was send to destination.
+ </description>
+ </change>
</section>
</release>
<release version="v3.4.0" date="2017-06-02">
--
2.13.2
7 years, 4 months
[libvirt] [PATCH v3 00/12] Make virNodeDeviceObj and virNodeDeviceObjList private
by John Ferlan
v2: https://www.redhat.com/archives/libvir-list/2017-May/msg00999.html
Some patches from v2 were pushed (3, 4, 6, 7, 8, 9, 11, & 12), but a
few remained from that series and are the first 5 patches of this series.
What changed?
-> Reworked the virNodeDeviceObjRemove patch (former patch 2, but new
series patch 1). That affected the Test patch (former patch 1, but
now patch 2). This patch removes the address of obj logic and moves
the onus of the ObjFree to the caller (see patch for reason).
-> Patch 3 is the former patch 5, with no essential change
-> Patch 4 is the former patch 10, with no essential change
-> Former patch 13 and 14, were altered to remove the offending
address of pointer logic. The result is patch 5 which just
essentially former patch 14 without the address of pointer logic.
-> Patches 6-12 for this series are new, but follow along through the
logic to make things private.
John Ferlan (12):
nodedev: Alter virNodeDeviceObjRemove
test: Adjust cleanup/error paths for nodedev test APIs
nodedev: Use common naming for virnodedeviceobj
nodedev: Use consistent names for driver variables
nodedev: Introduce virNodeDeviceObjNew
nodedev: Introduce virNodeDeviceObjListNew
nodedev: Alter node device obj list function names
nodedev: Dereference the obj/def in virNodeDeviceObjListFind* APIs
nodedev: Introduce virNodeDeviceGetSCSIHostCaps
nodedev: Introduce virNodeDeviceObjListFindSCSIHostByWWNs
nodedev: Privatize _virNodeDeviceObj and _virNodeDeviceObjList
nodedev: Convert virNodeDeviceObj to use virObjectLockable
src/conf/node_device_conf.c | 82 ++++++
src/conf/node_device_conf.h | 20 +-
src/conf/virnodedeviceobj.c | 420 ++++++++++++++++++------------
src/conf/virnodedeviceobj.h | 67 ++---
src/libvirt_private.syms | 20 +-
src/node_device/node_device_driver.c | 159 +++++------
src/node_device/node_device_hal.c | 47 ++--
src/node_device/node_device_linux_sysfs.c | 77 +-----
src/node_device/node_device_udev.c | 52 ++--
src/test/test_driver.c | 136 +++++-----
10 files changed, 570 insertions(+), 510 deletions(-)
--
2.9.4
7 years, 4 months
[libvirt] [PATCH] news: Update for 3.5.0 release
by Andrea Bolognani
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
docs/news.xml | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 636154e..f38abeb 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -68,6 +68,15 @@
running.
</description>
</change>
+ <change>
+ <summary>
+ qemu: Allow VirtIO devices to use vIOMMU
+ </summary>
+ <description>
+ It is now possible to turn on IOTBL for the vIOMMU and have VirtIO
+ devices use it, provided they have been configured appropriately.
+ </description>
+ </change>
</section>
<section title="Improvements">
<change>
@@ -100,6 +109,20 @@
gathered and presented in capabilities if available.
</description>
</change>
+ <change>
+ <summary>
+ apparmor: Several improvements
+ </summary>
+ <description>
+ Allow access to Ceph config, EFI firmware on both x86_64 and
+ aarch64, device tree on ppc64 and more.
+ </description>
+ </change>
+ <change>
+ <summary>
+ qemu: Support host-model on POWER9 machines
+ </summary>
+ </change>
</section>
<section title="Bug fixes">
<change>
@@ -115,6 +138,65 @@
images when doing a block-commit.
</description>
</change>
+ <change>
+ <summary>
+ Parse decimal numbers in a locale-independent way
+ </summary>
+ <description>
+ Some locales, such as <code>de_DE</code> and <code>pt_BR</code>,
+ use comma rather than dot to separate the integer part from the
+ fractional part of a decimal number; however, several data sources
+ such as the kernel use a locale-independent representation and need
+ to be treated accordingly.
+ </description>
+ </change>
+ <change>
+ <summary>
+ Support compilation with newer compiler and libc versions
+ </summary>
+ <description>
+ Several fixes have been included to make compilation with Clang
+ 4.0.0, GCC 7.1 and glibc >= 2.25.90 possible.
+ </description>
+ </change>
+ <change>
+ <summary>
+ qemu: Query name for vhost-user interfaces at runtime
+ </summary>
+ <description>
+ This makes it possible to use <code>virsh</code> subcommands such
+ as <code>domiflist</code> and <code>domifstat</code> on vhost-user
+ interfaces.
+ </description>
+ </change>
+ <change>
+ <summary>
+ qemu: Set MTU for hotplugged interfaces correctly
+ </summary>
+ <description>
+ When hotplugging a network interface, the MTU was only set on the
+ guest side. Set it on the host side as well.
+ </description>
+ </change>
+ <change>
+ <summary>
+ qemu: Forbid updating MTU for interfaces of running guests
+ </summary>
+ <description>
+ The MTU setting can't be modified while the guest is running, so any
+ attempt to alter it at runtime will now result in an error rather
+ than being silently ignored.
+ </description>
+ </change>
+ <change>
+ <summary>
+ qemu: Fix specifying QXL heads with older QEMU releases
+ </summary>
+ <description>
+ Specifying the number of QXL heads was not working correctly for
+ QEMU releases older than 1.6.
+ </description>
+ </change>
</section>
</release>
<release version="v3.4.0" date="2017-06-02">
--
2.7.5
7 years, 4 months
[libvirt] [PATCH RFC V2 0/2] Implement l3 CAT
by Eli Qiao
Allow user to define cachetune in domain xml.
V2 -> V1 changes:
* Redefine cachetune xml in domain xml.
* Create a struct for driver to talk with util/virresctrl.*
* Nit fixes
Eli Qiao (2):
Resctrl: Add new xml element to support cache tune
Resctrl: Do cache allocation while boot a qemu VM
docs/schemas/domaincommon.rng | 29 ++
include/libvirt/virterror.h | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 112 ++++
src/conf/domain_conf.h | 19 +
src/libvirt_private.syms | 9 +
src/qemu/qemu_process.c | 81 +++
src/util/virerror.c | 1 +
src/util/virresctrl.c | 822 ++++++++++++++++++++++++++++++
src/util/virresctrl.h | 88 ++++
tests/Makefile.am | 8 +-
tests/virresctrldata/L3-free.schemata | 1 +
tests/virresctrldata/L3CODE-free.schemata | 1 +
tests/virresctrldata/L3DATA-free.schemata | 1 +
tests/virresctrldata/linux-resctrl | 1 +
tests/virresctrldata/linux-resctrl-cdp | 1 +
tests/virresctrltest.c | 119 +++++
17 files changed, 1294 insertions(+), 1 deletion(-)
create mode 100644 src/util/virresctrl.c
create mode 100644 src/util/virresctrl.h
create mode 100644 tests/virresctrldata/L3-free.schemata
create mode 100644 tests/virresctrldata/L3CODE-free.schemata
create mode 100644 tests/virresctrldata/L3DATA-free.schemata
create mode 120000 tests/virresctrldata/linux-resctrl
create mode 120000 tests/virresctrldata/linux-resctrl-cdp
create mode 100644 tests/virresctrltest.c
--
1.9.1
7 years, 4 months