[libvirt] [[PATCHv2]] Add support for qxl.revision in domain XML
by Christophe Fergeau
QXL devices have an associated 'revision' which is raised when
new features have been introduced which would break migration
to older versions. This commit makes it possible to set this
revision as QEMU sometimes support newer QXL revisions than what
it defaults to.
---
docs/formatdomain.html.in | 4 +++-
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 20 ++++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 8 ++++++++
.../qemuxml2argv-graphics-spice-compression.args | 3 ++-
.../qemuxml2argv-graphics-spice-compression.xml | 4 ++--
.../qemuxml2argv-graphics-spice-qxl-vga.args | 3 ++-
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 ++--
.../qemuxml2argv-graphics-spice.args | 3 ++-
.../qemuxml2argvdata/qemuxml2argv-graphics-spice.xml | 4 ++--
11 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a9003d7..bcdd90f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3584,7 +3584,9 @@ qemu-kvm -net nic,model=? /dev/null
1.0.2</span>) is allowed for "qxl" type only and specifies
the size of the primary bar, while <code>vram</code> specifies the
secondary bar size. If "ram" or "vram" are not supplied a default
- value is used.
+ value is used. The optional attribute <code>revision</code> (<span
+ class="since">since 1.0.3</span>) specifies the revision of
+ the QXL device, newer revisions provide more functionality.
</dd>
<dt><code>model</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 63be4aa..57128ab 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2283,6 +2283,11 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="revision">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</group>
</choice>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c75838..f4f273c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7646,6 +7646,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
char *vram = NULL;
char *ram = NULL;
char *primary = NULL;
+ char *revision = NULL;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
@@ -7661,6 +7662,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
ram = virXMLPropString(cur, "ram");
vram = virXMLPropString(cur, "vram");
heads = virXMLPropString(cur, "heads");
+ revision = virXMLPropString(cur, "revision");
if ((primary = virXMLPropString(cur, "primary")) != NULL) {
if (STREQ(primary, "yes"))
@@ -7713,6 +7715,19 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
def->vram = virDomainVideoDefaultRAM(dom, def->type);
}
+ if (revision) {
+ if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("revision attribute only supported for type of qxl"));
+ goto error;
+ }
+ if (virStrToLong_ui(revision, NULL, 10, &def->revision) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("cannot parse video revision '%s'"), revision);
+ goto error;
+ }
+ }
+
if (heads) {
if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7730,6 +7745,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
VIR_FREE(ram);
VIR_FREE(vram);
VIR_FREE(heads);
+ VIR_FREE(revision);
return def;
@@ -7739,6 +7755,8 @@ error:
VIR_FREE(ram);
VIR_FREE(vram);
VIR_FREE(heads);
+ VIR_FREE(revision);
+
return NULL;
}
@@ -13632,6 +13650,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " heads='%u'", def->heads);
if (def->primary)
virBufferAddLit(buf, " primary='yes'");
+ if (def->revision)
+ virBufferAsprintf(buf, " revision='%u'", def->revision);
if (def->accel) {
virBufferAddLit(buf, ">\n");
virDomainVideoAccelDefFormat(buf, def->accel);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4ffa4aa..1d7951b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1174,6 +1174,7 @@ struct _virDomainVideoDef {
unsigned int ram; /* kibibytes (multiples of 1024) */
unsigned int vram; /* kibibytes (multiples of 1024) */
unsigned int heads;
+ unsigned int revision;
bool primary;
virDomainVideoAccelDefPtr accel;
virDomainDeviceInfo info;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dee493f..5164bd5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3567,6 +3567,9 @@ qemuBuildDeviceVideoStr(virDomainVideoDefPtr video,
/* QEMU accepts bytes for vram_size. */
virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
+
+ if (video->revision != 0)
+ virBufferAsprintf(&buf, ",revision=%u", video->revision);
}
if (qemuBuildDeviceAddressStr(&buf, &video->info, qemuCaps) < 0)
@@ -6612,6 +6615,11 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgFormat(cmd, "%s.vram_size=%u",
dev, vram * 1024);
}
+ if (def->videos[0]->revision) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "%s.revision=%u",
+ dev, def->videos[0]->revision);
+ }
}
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
index 59f064b..05f5579 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
@@ -7,5 +7,6 @@ image-compression=auto_glz,jpeg-wan-compression=auto,\
zlib-glz-wan-compression=auto,\
playback-compression=on,streaming-video=filter -vga \
qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \
--device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \
+-global qxl.revision=4 \
+-device qxl,id=video1,ram_size=67108864,vram_size=33554432,revision=4,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
index a8c4ad8..2dc5776 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
@@ -31,10 +31,10 @@
<streaming mode='filter'/>
</graphics>
<video>
- <model type='qxl' ram='65536' vram='18432' heads='1'/>
+ <model type='qxl' ram='65536' vram='18432' heads='1' revision='4'/>
</video>
<video>
- <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ <model type='qxl' ram='65536' vram='32768' heads='1' revision='4'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
index ef499e6..0b08038 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
@@ -4,5 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -spice port=5903,tls-port=5904,addr=127.0.0.1,\
x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs -vga \
qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 \
--device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \
+-global qxl-vga.revision=4 \
+-device qxl,id=video1,ram_size=67108864,vram_size=67108864,revision=4,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
index 563d371..3cd0c42 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
@@ -28,10 +28,10 @@
<channel name='inputs' mode='insecure'/>
</graphics>
<video>
- <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ <model type='qxl' ram='65536' vram='32768' heads='1' revision='4'/>
</video>
<video>
- <model type='qxl' ram='65536' vram='65536' heads='1'/>
+ <model type='qxl' ram='65536' vram='65536' heads='1' revision='4'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
index d7cfae0..082eaf7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
@@ -6,5 +6,6 @@ x509-dir=/etc/pki/libvirt-spice,tls-channel=default,tls-channel=main,plaintext-c
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
playback-compression=on,streaming-video=filter,disable-copy-paste -vga \
qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \
--device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \
+-global qxl.revision=4 \
+-device qxl,id=video1,ram_size=67108864,vram_size=33554432,revision=4,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
index 9a36660..e99dbc8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -34,10 +34,10 @@
<clipboard copypaste='no'/>
</graphics>
<video>
- <model type='qxl' ram='65536' vram='18432' heads='1'/>
+ <model type='qxl' ram='65536' vram='18432' heads='1' revision='4'/>
</video>
<video>
- <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ <model type='qxl' ram='65536' vram='32768' heads='1' revision='4'/>
</video>
<memballoon model='virtio'/>
</devices>
--
1.8.1.2
11 years, 8 months
Re: [libvirt] if_bridge.h: include in6.h for struct in6_addr use
by Thomas Backlund
Thomas Backlund skrev 13.1.2013 20:38:
> patch both inline and attached as thunderbird tends to mess up ...
> -----
>
> if_bridge.h uses struct in6_addr ip6; but does not include the in6.h
> header.
>
> Found by trying to build libvirt and connman against 3.8-rc3 headers.
>
Ok,
ignore this patch, it's not the correct fix as it introduces
redefinitions...
Btw, the error that I hit that made me suggest this fix was libvirt
config check bailing out:
config.log:/usr/include/linux/if_bridge.h:173:20: error: field 'ip6' has
incomplete type
> Reported-by: Colin Guthrie <colin(a)mageia.org>
> Reported-by: Christiaan Welvaart <cjw(a)daneel.dyndns.org>
> Signed-off-by: Thomas Backlund <tmb(a)mageia.org>
>
> --
>
> diff -Nurp linux-3.8-rc3/include/uapi/linux/if_bridge.h
> linux-3.8-rc3.fix/include/uapi/linux/if_bridge.h
> --- linux-3.8-rc3/include/uapi/linux/if_bridge.h 2013-01-13
> 20:09:54.257271755 +0200
> +++ linux-3.8-rc3.fix/include/uapi/linux/if_bridge.h 2013-01-13
> 20:15:04.153676151 +0200
> @@ -14,6 +14,7 @@
> #define _UAPI_LINUX_IF_BRIDGE_H
>
> #include <linux/types.h>
> +#include <linux/in6.h>
>
> #define SYSFS_BRIDGE_ATTR "bridge"
> #define SYSFS_BRIDGE_FDB "brforward"
>
>
> -----
> Thomas
>
--
Thomas
11 years, 8 months
[libvirt] [PATCH v3 0/4] qemu: -dtb option support
by Olivia Yin
Sometime QEMU need load specific device tree binary images.
These patches provide -dtb option support and update docs/tests.
Olivia Yin (4):
QEMU: add -dtb option support
qemu: add dtb capability
docs: add -dtb option support to QEMU
tests: add dtb test case
src/conf/domain_conf.c | 4 ++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 6 ++++++
src/qemu/qemu_capabilities.c | 3 +++
src/qemu/qemu_capabilities.h | 1 +
docs/formatdomain.html.in | 5 +++++
docs/schemas/domaincommon.rng | 5 +++++
tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 1 +
tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml | 28 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 2 +
11 years, 8 months
[libvirt] [PATCH v4 0/4] add pci-bridge support
by liguang
Now, it's impossible to arrange devices into multi-pci-bus,
for example:
<sound model='ac97'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x1' slot='0x02' function='0x0'/>
</video>
libvirt will complain about "bus != 0",
fortunately, qemu supports pci-to-pci bridge,
if we want to use multi-pci-bus, we can define
2 pci bridge controllers, then attach 1 to the other
as a subordinate pci-bus, so, 2 pci-buses appear.
for example:
<controller type='pci-bridge' index='0'/>
<controller type='pci-bridge' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<sound model='ac97'>
<address type='pci' domain='0x0000' bus='0x01' slot='0x02' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
src/conf/domain_conf.c | 98 ++++-
src/conf/domain_conf.h | 1 +
docs/schemas/domaincommon.rng | 1 +
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 43 ++++++++++++++++++++-----
6 files changed, 126 insertions(+), 22 deletions(-)
11 years, 8 months
[libvirt] [PATCH] Add NUMA memory information to virsh capabilities output.
by Dusty Mabe
Hi,
This is a follow up to a previous proposed patch that added NUMA memory and CPU thread siblings information to virsh capabilities outout (https://www.redhat.com/archives/libvir-list/2012-November/msg00449.html)
Since in a recent commit the thread siblings information was added (http://libvirt.org/git/?p=libvirt.git;a=commit;h=828820e2d). I have modified my patch to just add the NUMA memory information. An example of the output from virsh capabilities looks like
the following text:
<topology>
<cells num='2'>
<cell id='0'>
<memory unit='KiB'>67073420</memory>
<cpus num='16'>
<cpu id='0' socket_id='0' core_id='0' siblings='0,16'/>
<cpu id='1' socket_id='0' core_id='1' siblings='1,17'/>
...
...
</cpus>
</cell>
Dusty Mabe
Dusty Mabe (1):
Add NUMA memory information to virsh capabilities output.
docs/schemas/capability.rng | 10 ++++
src/conf/capabilities.c | 8 +++
src/conf/capabilities.h | 2 +
src/nodeinfo.c | 64 +++++++++++++++++++++-
src/test/test_driver.c | 2 +-
src/xen/xend_internal.c | 2 +-
tests/capabilityschemadata/caps-test3.xml | 88 +++++++++++++++++++++++++++++++
7 files changed, 173 insertions(+), 3 deletions(-)
create mode 100644 tests/capabilityschemadata/caps-test3.xml
--
1.7.11.7
11 years, 8 months
[libvirt] [PATCH] Fix starting qemu instances when apparmor driver is enabled
by Jim Fehlig
With the apparmor security driver enabled, qemu instances fail
to start
# grep ^security_driver /etc/libvirt/qemu.conf
security_driver = "apparmor"
# virsh start test-kvm
error: Failed to start domain test-kvm
error: internal error security label already defined for VM
The model field of virSecurityLabelDef object is always populated
by virDomainDefGetSecurityLabelDef(), so remove the check for a
NULL model when verifying if a label is already defined for the
instance.
Checking for a NULL model and populating it later in
AppArmorGenSecurityLabel() has been left in the code to be
consistent with virSecuritySELinuxGenSecurityLabel().
---
src/security/security_apparmor.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index ddc1fe4..2e6a57f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -436,8 +436,7 @@ AppArmorGenSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
return rc;
}
- if ((secdef->label) ||
- (secdef->model) || (secdef->imagelabel)) {
+ if (secdef->label || secdef->imagelabel) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s",
_("security label already defined for VM"));
@@ -461,8 +460,7 @@ AppArmorGenSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
goto err;
}
- secdef->model = strdup(SECURITY_APPARMOR_NAME);
- if (!secdef->model) {
+ if (!secdef->model && !(secdef->model = strdup(SECURITY_APPARMOR_NAME))) {
virReportOOMError();
goto err;
}
--
1.8.0.1
11 years, 8 months
[libvirt] [PATCH 00/16] Add ability fill driver specific defaults when parsing the XML
by Peter Krempa
This monster series cleans up a ton of stuff and then adds the ability
to fill driver specific defaults by means of a callback.
The usage is demonstrated on automaticaly filling default NIC type
with qemu.
The long term aim is to move all validations and default settings
out of the parser.
Peter Krempa (16):
conf: Improve core dump config error message
qemu: Refactor error paths in virQEMUDriverCreateCapabilities
conf: Ensure that new devices are added to conf copy function
conf: Fix label naming in virDomainDefFormatInternal
conf: Reformat many function headers in domain_conf.c
conf: Refactor cpumask handling
conf: whitespace cleanups and refactors with no semantic impact
conf: Refactor ABI stability checking and break long lines
conf: Make virDomainDeviceInfoIterate usable without os type
conf: Add separate defaults addition and validation for XML parsing
qemu: Implement the device parse callback and use it for interfaces
tests: add to the tests and fix fallout
qemu_command: Clean up default model passing
conf: Don't add default controllers in the XML parser
conf: Simplify cputune parameter retrieval
conf: Move validation of domain title
src/conf/capabilities.h | 6 +
src/conf/domain_conf.c | 1177 ++++++++++----------
src/conf/domain_conf.h | 4 +-
src/qemu/qemu_command.c | 14 +-
src/qemu/qemu_conf.c | 18 +-
src/qemu/qemu_domain.c | 23 +
src/qemu/qemu_domain.h | 1 +
.../qemuxml2argv-net-bandwidth.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-client.args | 6 +-
.../qemuxml2argv-net-eth-ifname.args | 6 +-
.../qemuxml2argv-net-eth-ifname.xml | 1 +
.../qemuxml2argv-net-eth-names.args | 8 +-
tests/qemuxml2argvdata/qemuxml2argv-net-eth.args | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args | 6 +-
.../qemuxml2argv-net-openvswitch.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-server.args | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-net-user.args | 5 +-
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 1 +
.../qemuxml2argv-net-virtio-network-portgroup.xml | 2 +
.../qemuxml2xmlout-graphics-spice-timeout.xml | 1 +
tests/testutilsqemu.c | 1 +
23 files changed, 663 insertions(+), 633 deletions(-)
--
1.8.1.1
11 years, 8 months
[libvirt] [PATCHv4] virtio-rng: Add rate limiting options for virtio-RNG
by Peter Krempa
Qemu's implementation of virtio RNG supports rate limiting of the
entropy used. This patch exposes the option to tune this functionality.
This patch is based on qemu commit 904d6f588063fb5ad2b61998acdf1e73fb4
The rate limiting is exported in the XML as:
<devices>
...
<rng model='virtio'>
<rate period='1234'>4321</rate>
<backend model='random'/>
</rng>
...
---
Notes:
Version 4:
- Reword docs
- state it is available since 1.0.4 as the tree is frozen and this was actually never acked before
Version 3:
- State the time unit in docs
Version 2:
- Qemu uses bytes/period, adapt the value according to that
docs/formatdomain.html.in | 13 +++++++++++++
docs/schemas/domaincommon.rng | 18 +++++++++++++++++-
src/conf/domain_conf.c | 17 +++++++++++++++++
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_command.c | 9 +++++++++
.../qemuxml2argv-virtio-rng-random.args | 2 +-
.../qemuxml2argv-virtio-rng-random.xml | 1 +
7 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1835b39..1c6c73e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4280,6 +4280,7 @@ qemu-kvm -net nic,model=? /dev/null
...
<devices>
<rng model='virtio'>
+ <rate period="2000">1234</rate>
<backend model='random'>/dev/random</backend>
<!-- OR -->
<backend model='egd' type='udp'>
@@ -4302,6 +4303,18 @@ qemu-kvm -net nic,model=? /dev/null
<li>'virtio' — supported by qemu and virtio-rng kernel module</li>
</ul>
</dd>
+ <dt><code>rate</code></dt>
+ <dd>
+ <p>
+ The optional <code>rate</code> element allows limiting the rate at
+ which entropy can be consumed from the source. An optional
+ <code>period</code> attribute specifies the duration of a period in
+ milliseconds; if omitted, the period is taken as 1000 milliseconds
+ (1 second). The element contents specify how many bits are permitted
+ per period. Drivers may enforce a minimum rate, and may round the
+ rate down to a minimum granularity.
+ </p>
+ </dd>
<dt><code>backend</code></dt>
<dd>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e7231cc..172926c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3500,7 +3500,12 @@
<value>virtio</value>
</choice>
</attribute>
- <ref name="rng-backend"/>
+ <interleave>
+ <ref name="rng-backend"/>
+ <optional>
+ <ref name="rng-rate"/>
+ </optional>
+ </interleave>
</element>
</define>
@@ -3524,6 +3529,17 @@
</element>
</define>
+ <define name="rng-rate">
+ <element name="rate">
+ <optional>
+ <attribute name="period">
+ <ref name="positiveInteger"/>
+ </attribute>
+ </optional>
+ <ref name="positiveInteger"/>
+ </element>
+ </define>
+
<define name="usbmaster">
<element name="master">
<attribute name="startport">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 995cf0c..f556e4c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7399,6 +7399,17 @@ virDomainRNGDefParseXML(const xmlNodePtr node,
ctxt->node = node;
+ if (virXPathUInt("string(./rate)", ctxt, &def->rate) < -1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid RNG rate value"));
+ goto error;
+ }
+
+ if (def->rate > 0 &&
+ virXPathUInt("string(./rate/@period)", ctxt, &def->period) < -1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid RNG period value"));
+ goto error;
+ }
+
if ((nbackends = virXPathNodeSet("./backend", ctxt, &backends)) < 0)
goto error;
@@ -13708,6 +13719,12 @@ virDomainRNGDefFormat(virBufferPtr buf,
const char *backend = virDomainRNGBackendTypeToString(def->backend);
virBufferAsprintf(buf, " <rng model='%s'>\n", model);
+ if (def->rate) {
+ virBufferAddLit(buf, " <rate");
+ if (def->period)
+ virBufferAsprintf(buf, " period='%u'", def->period);
+ virBufferAsprintf(buf, ">%u</rate>\n", def->rate);
+ }
virBufferAsprintf(buf, " <backend model='%s'", backend);
switch ((enum virDomainRNGBackend) def->backend) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 5828ae2..1546f21 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1721,6 +1721,8 @@ enum virDomainRNGBackend {
struct _virDomainRNGDef {
int model;
int backend;
+ unsigned int rate; /* bits per period */
+ unsigned int period; /* milliseconds */
union {
char *file; /* file name for 'random' source */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1c9bfc9..6fcc093 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4255,6 +4255,15 @@ qemuBuildRNGDeviceArgs(virCommandPtr cmd,
virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias);
+ if (dev->rate > 0) {
+ /* qemu uses bytes */
+ virBufferAsprintf(&buf, ",max-bytes=%u", dev->rate / 8);
+ if (dev->period)
+ virBufferAsprintf(&buf, ",period=%u", dev->period);
+ else
+ virBufferAddLit(&buf, ",period=1000");
+ }
+
if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
goto cleanup;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args
index ad27132..4a0437b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args
@@ -3,4 +3,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
-object 'rng-random,id=rng0,filename=/test/ph<ile' \
--device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4
+-device virtio-rng-pci,rng=rng0,max-bytes=100,period=1234,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml
index 0658f4b..3899408 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.xml
@@ -17,6 +17,7 @@
<controller type='usb' index='0'/>
<memballoon model='virtio'/>
<rng model='virtio'>
+ <rate period='1234'>800</rate>
<backend model='random'>/test/ph<ile</backend>
</rng>
</devices>
--
1.8.1.1
11 years, 8 months
[libvirt] [PATCH 0/8] Web page updates/changes
by John Ferlan
I was [t]asked to make updates to the api webpage including an example
of a code path from application into the driver. As I started on the task
I found that the api webpage first needed a couple of updates just to fill
in what seems to have been missing information. As I went through the
various pages I realized that the 'better' location for the example code
path seemed to be the internals page and thus I added it there. My simple
example (hah!) was the virConnectOpen code path - I figured for a intro-
duction to the internals web page - it'd be a good place to start.
While I was doing this I used the hellolibvirt example a bit and based on
information found on the 'api' page I added some more calls into the example
to print network and disk information as well as more domain data.
Finally while going through the pages I found a couple of places where
drv pages weren't referenced although they were available, so I updated
those (phyp and parallels).
Hopefully I've figured things out correctly, but I'm sure if I have something
a bit wrong someone will correct me. Making the figure was quite frustrating
as xfig is a bit less forgiving than say office writer.
John Ferlan (8):
hellolibvirt: Update hellolibvirt example
api: Reword objects exposed section
api: Reword and clean lists for object description
api: Complete list of function and naming conventions
api: Add text and references for drivers section
api: Add text and references for daemon
Add references for phyp and parallels
internals: Update to include RPC and Lock links and add new data
docs/api.html.in | 261 +++++++++++++++++++++++++----------
docs/drivers.html.in | 1 +
docs/index.html.in | 6 +
docs/internals.html.in | 102 +++++++++++++-
docs/libvirt-virConnect-example.fig | 58 ++++++++
docs/libvirt-virConnect-example.png | Bin 0 -> 10464 bytes
docs/sitemap.html.in | 8 ++
examples/hellolibvirt/hellolibvirt.c | 201 +++++++++++++++++++++++----
8 files changed, 530 insertions(+), 107 deletions(-)
create mode 100644 docs/libvirt-virConnect-example.fig
create mode 100644 docs/libvirt-virConnect-example.png
--
1.7.11.7
11 years, 8 months
[libvirt] libvirt does not logout of iscsi targets, causing system hang on shutdown
by Fritz Elfert
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi guys,
There's a quite old bug entry here:
https://bugzilla.redhat.com/show_bug.cgi?id=700010
I just stumbled over that very issue on F18. Doing a little bit
debugging of the shutdown sequence, it turns out that - at least on my
F18 installation - libvirtd is shutdown *after* iscsid, which makes it
impossible for libvirt to perform the logout of the iscsi session properly.
My local fix (diff) is attached. It simply adds another startup
dependancy on iscsid.service which in turn delays iscsid shutdown until
after libvirtd has stopped. Having that applied, the system shuts down
properly again.
I was asked to post that here for discussion...
So please consider this trivial change for the next update.
Cheers
-Fritz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlEvwhoACgkQboM4mAMyprB9agCgpIkGbSBKpfB4e0q6aqSMVGam
rMoAnAtBpp3nFbleWLxJTbCt9EKO9Yx3
=2hHf
-----END PGP SIGNATURE-----
11 years, 8 months