[PATCH 0/4] Allow xml-configured coredump format on VM crash
by Nikolai Barybin
When libvirt processes VM crash event it always dumps core in raw
format.
This series makes it possible to configure dump format via domain xml.
This would be especcialy helpful for Windows guests, because it requires
a lot effort to convert raw dump into wingdb.
Nikolai Barybin (4):
conf: schemas: add coredump_format element to events section
src: conf: add parsing/formatting for 'coredump_format' value
qemu: use configurable dump format in doCoreDumpToAutoDumpPath()
docs: formatdomain: document 'coredump_format' element
docs/formatdomain.rst | 9 +++++
src/conf/domain_conf.c | 64 +++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 2 +
src/conf/schemas/domaincommon.rng | 19 +++++++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_driver.c | 2 +-
6 files changed, 97 insertions(+), 1 deletion(-)
--
2.43.5
1 week, 1 day
[PATCH] qemu: Switch to virtio-scsi on ARM
by Jim Fehlig
From: Jim Fehlig <jfehlig(a)suse.com>
Similar to x86, the default SCSI controller model for ARM is lsilogic.
But unlike x86, the ARM virt machine type prefers virtio devices. Switch
the default controller model for ARM from lsilogic to virtio-scsi.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
IMO, the lsilogic SCSI controller is a poor default for the ARM virt machine
type. One could argue modern operating systems are more likely to contain a
functional virtio-scsi driver than an LSI one. However, I do understand this
change could break existing ARM VM configurations containing a SCSI
controller without a model specification. One could also argue the pain
inflicted is tolerable :-).
The test churn is interesting. I haven't yet investigated if there's an
underlying bug, or if it's a consequence of libvirt's processing of
controllers. Much appreciated if anyone has an explanation handy :-).
src/qemu/qemu_domain.c | 3 ++-
...ault-models.aarch64-latest.abi-update.args | 13 +++++------
...fault-models.aarch64-latest.abi-update.xml | 22 ++++++++-----------
...64-virt-default-models.aarch64-latest.args | 13 +++++------
...h64-virt-default-models.aarch64-latest.xml | 22 ++++++++-----------
5 files changed, 32 insertions(+), 41 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0d2548d8d4..499db0ad78 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4252,7 +4252,8 @@ qemuDomainGetSCSIControllerModel(const virDomainDef *def,
if (qemuDomainIsPSeries(def))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
- if (ARCH_IS_S390(def->os.arch) || qemuDomainIsLoongArchVirt(def))
+ if (ARCH_IS_ARM(def->os.arch) || ARCH_IS_S390(def->os.arch) ||
+ qemuDomainIsLoongArchVirt(def))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
index 96fb251d80..ff86567c59 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
@@ -29,20 +29,19 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \
-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \
-device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}' \
--device '{"driver":"pcie-pci-bridge","id":"pci.4","bus":"pci.1","addr":"0x0"}' \
--device '{"driver":"pcie-root-port","port":11,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x1.0x3"}' \
--device '{"driver":"pcie-root-port","port":12,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x1.0x4"}' \
--device '{"driver":"qemu-xhci","id":"usb","bus":"pci.3","addr":"0x0"}' \
--device '{"driver":"lsi","id":"scsi0","bus":"pci.4","addr":"0x1"}' \
+-device '{"driver":"pcie-root-port","port":11,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x1.0x3"}' \
+-device '{"driver":"pcie-root-port","port":12,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x1.0x4"}' \
+-device '{"driver":"qemu-xhci","id":"usb","bus":"pci.2","addr":"0x0"}' \
+-device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.3","addr":"0x0"}' \
-netdev '{"type":"user","id":"hostnet0"}' \
--device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x0"}' \
+-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-serial chardev:charserial0 \
-chardev socket,id=chrtpm,path=/dev/test \
-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
-device '{"driver":"tpm-tis-device","tpmdev":"tpm-tpm0","id":"tpm0"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.5","addr":"0x0"}' \
+-device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.4","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-device '{"driver":"pvpanic-pci","bus":"pcie.0","addr":"0x2"}' \
-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
index f27e7e1522..5abf55cf36 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
@@ -21,11 +21,11 @@
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type='usb' index='0' model='qemu-xhci'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
</controller>
- <controller type='scsi' index='0' model='lsilogic'>
- <address type='pci' domain='0x0000' bus='0x04' slot='0x01' function='0x0'/>
- </controller>
<controller type='pci' index='0' model='pcie-root'/>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
@@ -42,24 +42,20 @@
<target chassis='3' port='0xa'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
- <controller type='pci' index='4' model='pcie-to-pci-bridge'>
- <model name='pcie-pci-bridge'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
- </controller>
- <controller type='pci' index='5' model='pcie-root-port'>
+ <controller type='pci' index='4' model='pcie-root-port'>
<model name='pcie-root-port'/>
- <target chassis='5' port='0xb'/>
+ <target chassis='4' port='0xb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
</controller>
- <controller type='pci' index='6' model='pcie-root-port'>
+ <controller type='pci' index='5' model='pcie-root-port'>
<model name='pcie-root-port'/>
- <target chassis='6' port='0xc'/>
+ <target chassis='5' port='0xc'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
</controller>
<interface type='user'>
<mac address='52:54:00:09:a4:37'/>
<model type='virtio'/>
- <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
<serial type='pty'>
<target type='system-serial' port='0'>
@@ -75,7 +71,7 @@
<audio id='1' type='none'/>
<video>
<model type='virtio' heads='1' primary='yes'/>
- <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
<panic model='pvpanic'>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
index 96fb251d80..ff86567c59 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
@@ -29,20 +29,19 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \
-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \
-device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}' \
--device '{"driver":"pcie-pci-bridge","id":"pci.4","bus":"pci.1","addr":"0x0"}' \
--device '{"driver":"pcie-root-port","port":11,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x1.0x3"}' \
--device '{"driver":"pcie-root-port","port":12,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x1.0x4"}' \
--device '{"driver":"qemu-xhci","id":"usb","bus":"pci.3","addr":"0x0"}' \
--device '{"driver":"lsi","id":"scsi0","bus":"pci.4","addr":"0x1"}' \
+-device '{"driver":"pcie-root-port","port":11,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x1.0x3"}' \
+-device '{"driver":"pcie-root-port","port":12,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x1.0x4"}' \
+-device '{"driver":"qemu-xhci","id":"usb","bus":"pci.2","addr":"0x0"}' \
+-device '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.3","addr":"0x0"}' \
-netdev '{"type":"user","id":"hostnet0"}' \
--device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x0"}' \
+-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-serial chardev:charserial0 \
-chardev socket,id=chrtpm,path=/dev/test \
-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
-device '{"driver":"tpm-tis-device","tpmdev":"tpm-tpm0","id":"tpm0"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.5","addr":"0x0"}' \
+-device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.4","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-device '{"driver":"pvpanic-pci","bus":"pcie.0","addr":"0x2"}' \
-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
index f27e7e1522..5abf55cf36 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
@@ -21,11 +21,11 @@
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type='usb' index='0' model='qemu-xhci'>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
</controller>
- <controller type='scsi' index='0' model='lsilogic'>
- <address type='pci' domain='0x0000' bus='0x04' slot='0x01' function='0x0'/>
- </controller>
<controller type='pci' index='0' model='pcie-root'/>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
@@ -42,24 +42,20 @@
<target chassis='3' port='0xa'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
- <controller type='pci' index='4' model='pcie-to-pci-bridge'>
- <model name='pcie-pci-bridge'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
- </controller>
- <controller type='pci' index='5' model='pcie-root-port'>
+ <controller type='pci' index='4' model='pcie-root-port'>
<model name='pcie-root-port'/>
- <target chassis='5' port='0xb'/>
+ <target chassis='4' port='0xb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
</controller>
- <controller type='pci' index='6' model='pcie-root-port'>
+ <controller type='pci' index='5' model='pcie-root-port'>
<model name='pcie-root-port'/>
- <target chassis='6' port='0xc'/>
+ <target chassis='5' port='0xc'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
</controller>
<interface type='user'>
<mac address='52:54:00:09:a4:37'/>
<model type='virtio'/>
- <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
<serial type='pty'>
<target type='system-serial' port='0'>
@@ -75,7 +71,7 @@
<audio id='1' type='none'/>
<video>
<model type='virtio' heads='1' primary='yes'/>
- <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</video>
<memballoon model='none'/>
<panic model='pvpanic'>
--
2.43.0
1 week, 1 day
Re: [PATCH V2 1/5] qom: qom-tree-get
by Markus Armbruster
Steve Sistare <steven.sistare(a)oracle.com> writes:
> Define the qom-tree-get QAPI command, which fetches an entire tree of
> properties and values with a single QAPI call. This is much faster
> than using qom-list plus qom-get for every node and property of the
> tree. See qom.json for details.
>
> Signed-off-by: Steve Sistare <steven.sistare(a)oracle.com>
> ---
> qapi/qom.json | 56 ++++++++++++++++++++++++++++++++++++++++++
> qom/qom-qmp-cmds.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 128 insertions(+)
>
> diff --git a/qapi/qom.json b/qapi/qom.json
> index 28ce24c..94662ad 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -46,6 +46,38 @@
> '*default-value': 'any' } }
>
> ##
> +# @ObjectPropertyValue:
> +#
> +# @name: the name of the property
> +#
> +# @type: the type of the property, as described in @ObjectPropertyInfo
That description is crap. In part because what it tries to describe is
crap. Neither is this patch's problem.
> +#
> +# @value: the value of the property. Omitted if cannot be read.
Suggest "Absent when the property cannot be read."
> +#
> +# Since 10.1
> +##
> +{ 'struct': 'ObjectPropertyValue',
> + 'data': { 'name': 'str',
> + 'type': 'str',
> + '*value': 'any' } }
ObjectPropertyValue suggests this describes a property's value. It does
not. It includes the name, i.e. it describes the *property*.
So does ObjectPropertyInfo.
The two overlap: both habe name and type. Only ObjectPropertyValue has
the current value. Only ObjectPropertyInfo has the default value and
description (I suspect the latter is useless in practice).
ObjectPropertyInfo is used with qom-list and qom-list-properties.
qom-list takes a QOM path, like your qom-tree-get and qom-list-getv.
I'd expect your commands to supersede qom-list in practice.
qom-list-properties is unlike your qom-tree-get and qom-list-getv: it
takes a type name. It's unreliable for non-abstract types: it can miss
dynamically created properties.
Let's ignore all this for now.
> +
> +##
> +# @ObjectNode:
> +#
> +# @name: the name of the node
> +#
> +# @children: child nodes
> +#
> +# @properties: properties of the node
> +#
> +# Since 10.1
> +##
> +{ 'struct': 'ObjectNode',
> + 'data': { 'name': 'str',
> + 'children': [ 'ObjectNode' ],
> + 'properties': [ 'ObjectPropertyValue' ] }}
> +
> +##
> # @qom-list:
> #
> # This command will list any properties of a object given a path in
> @@ -126,6 +158,30 @@
> 'allow-preconfig': true }
>
> ##
> +# @qom-tree-get:
> +#
> +# This command returns a tree of objects and their properties,
> +# rooted at the specified path.
> +#
> +# @path: The absolute or partial path within the object model, as
> +# described in @qom-get
> +#
> +# Errors:
> +# - If path is not valid or is ambiguous, returns an error.
By convention, we use "If <condition>, <error>, where <error> is a
member of QapiErrorClass.
What are the possible error classes? As far as I can tell:
- If path is ambiguous, GenericError
- If path cannot be resolved, DeviceNotFound
However, use of error classes other than GenericError is strongly
discouraged (see error_set() in qapi/error.h).
Is the ability to distinguish between these two errors useful?
Existing related commands such as qom-get also use DeviceNotFound.
Entirely undocumented, exact error conditions unclear. Awesome.
Libvirt seems to rely on this undocumented behavior: I can see code
checking for DeviceNotFound. Hyrum's law strikes.
qom-get fails with DeviceNotFound in both of the above cases. It fails
with GenericError when @property doesn't exist or cannot be read. Your
qom-tree-get fails differently. Awesome again.
Choices:
1. Leave errors undocumented and inconsistent.
2. Document errors for all related commands. Make the new ones as
consistent as we can.
> +# - If a property cannot be read, the value field is omitted in
> +# the corresponding @ObjectPropertyValue.
This is not an error, and therefore doesn't belong here.
ObjectPropertyValue's documentation also mentions it. Good enough?
> +#
> +# Returns: A tree of @ObjectNode. Each node contains its name, list
> +# of properties, and list of child nodes.
Hmm.
A struct Object has no name. Only properties have a name.
An ObjectNode has a name, and an ObjectPropertyValue has a name.
I may get back to this in a later message.
> +#
> +# Since 10.1
> +##
> +{ 'command': 'qom-tree-get',
> + 'data': { 'path': 'str' },
> + 'returns': 'ObjectNode',
> + 'allow-preconfig': true }
> +
> +##
> # @qom-set:
> #
> # This command will set a property from a object model path.
> diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
> index 293755f..b876681 100644
> --- a/qom/qom-qmp-cmds.c
> +++ b/qom/qom-qmp-cmds.c
> @@ -69,6 +69,78 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
> return props;
> }
>
> +static void qom_list_add_property_value(Object *obj, ObjectProperty *prop,
> + ObjectPropertyValueList **props)
> +{
> + ObjectPropertyValue *item = g_new0(ObjectPropertyValue, 1);
> + Error *err = NULL;
> +
> + QAPI_LIST_PREPEND(*props, item);
List elements are in reverse iteration order. Not wrong. I would've
reached for QAPI_LIST_APPEND(), though.
Wait! Existing command code uses QAPI_LIST_PREPEND(). Nevermind, carry
on!
> +
> + item->name = g_strdup(prop->name);
> + item->type = g_strdup(prop->type);
> + item->value = object_property_get_qobject(obj, prop->name, &err);
> +
> + if (!item->value) {
> + /*
> + * For bulk get, the error message is dropped, but the value field
> + * is omitted so the caller knows this property could not be read.
> + */
> + error_free(err);
Simpler: pass NULL to object_property_get_qobject().
> + }
> +}
> +
> +static ObjectNode *qom_tree_get(const char *path, Error **errp)
> +{
> + Object *obj;
> + ObjectProperty *prop;
> + ObjectNode *result, *child;
> + ObjectPropertyIterator iter;
> +
> + obj = qom_resolve_path(path, errp);
> + if (obj == NULL) {
> + return NULL;
> + }
> +
> + result = g_new0(ObjectNode, 1);
> +
> + object_property_iter_init(&iter, obj);
> + while ((prop = object_property_iter_next(&iter))) {
> + if (strstart(prop->type, "child<", NULL)) {
> + g_autofree char *child_path = g_strdup_printf("%s/%s",
> + path, prop->name);
> + child = qom_tree_get(child_path, errp);
> + if (!child) {
> + qapi_free_ObjectNode(result);
> + return NULL;
> + }
> + child->name = g_strdup(prop->name);
WAT?
> + QAPI_LIST_PREPEND(result->children, child);
> + } else {
> + qom_list_add_property_value(obj, prop, &result->properties);
> + }
> + }
> +
Oh, result->name remains unset, and the caller is expected to fill it
in. Two callers, "WAT" above, and ...
> + return result;
> +}
> +
> +ObjectNode *qmp_qom_tree_get(const char *path, Error **errp)
> +{
> + ObjectNode *result = qom_tree_get(path, errp);
> +
> + if (result) {
> + /* Strip the path prefix if any */
> + const char *basename = strrchr(path, '/');
> +
> + if (!basename || !basename[1]) {
> + result->name = g_strdup(path);
> + } else {
> + result->name = g_strdup(basename + 1);
> + }
> + }
... this one.
Not a fan. But it works.
> + return result;
> +}
> +
> void qmp_qom_set(const char *path, const char *property, QObject *value,
> Error **errp)
> {
1 week, 1 day
Re: [PATCH V2 4/5] qom: qom-list-getv
by Markus Armbruster
Steve Sistare <steven.sistare(a)oracle.com> writes:
> Define the qom-list-getv command, which fetches all the properties and
> values for a list of paths. This is faster than qom-tree-get when
> fetching a subset of the QOM tree. See qom.json for details.
>
> Signed-off-by: Steve Sistare <steven.sistare(a)oracle.com>
> ---
> qapi/qom.json | 34 ++++++++++++++++++++++++++++++++++
> qom/qom-qmp-cmds.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 74 insertions(+)
>
> diff --git a/qapi/qom.json b/qapi/qom.json
> index 94662ad..dc710d6 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -62,6 +62,16 @@
> '*value': 'any' } }
>
> ##
> +# @ObjectPropertiesValues:
> +#
> +# @properties: a list of properties.
> +#
> +# Since 10.1
> +##
> +{ 'struct': 'ObjectPropertiesValues',
> + 'data': { 'properties': [ 'ObjectPropertyValue' ] }}
> +
> +##
> # @ObjectNode:
> #
> # @name: the name of the node
> @@ -158,6 +168,30 @@
> 'allow-preconfig': true }
>
> ##
> +# @qom-list-getv:
> +#
> +# This command returns a list of properties and their values for
> +# each object path in the input list.
Imperative mood, please: "Return a list of ..."
> +#
> +# @paths: The absolute or partial path for each object, as described
> +# in @qom-get
> +#
> +# Errors:
> +# - If any path is not valid or is ambiguous, returns an error.
> +# - If a property cannot be read, the value field is omitted in
> +# the corresponding @ObjectPropertyValue.
My comment on qom-tree-get's Errors: section applies.
> +#
> +# Returns: A list of @ObjectPropertiesValues. Each element contains
> +# the properties of the corresponding element in @paths.
Again, ObjectPropertiesValues is an unfortunate name.
> +#
> +# Since 10.1
> +##
> +{ 'command': 'qom-list-getv',
> + 'data': { 'paths': [ 'str' ] },
> + 'returns': [ 'ObjectPropertiesValues' ],
> + 'allow-preconfig': true }
> +
> +##
> # @qom-tree-get:
> #
> # This command returns a tree of objects and their properties,
I find this command *much* simpler than qom-tree-get.
qom-list-getv treats all properties the same. References, whether they
are children and links, are the same: a QOM path.
qom-tree-get separates properties into children and non-children.
Children become nested ObjectNodes, links remain QOM paths.
> diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
> index b876681..1f05956 100644
> --- a/qom/qom-qmp-cmds.c
> +++ b/qom/qom-qmp-cmds.c
> @@ -90,6 +90,46 @@ static void qom_list_add_property_value(Object *obj, ObjectProperty *prop,
> }
> }
>
> +static ObjectPropertyValueList *qom_get_property_value_list(const char *path,
> + Error **errp)
> +{
> + Object *obj;
> + ObjectProperty *prop;
> + ObjectPropertyIterator iter;
> + ObjectPropertyValueList *props = NULL;
> +
> + obj = qom_resolve_path(path, errp);
> + if (obj == NULL) {
> + return NULL;
> + }
> +
> + object_property_iter_init(&iter, obj);
> + while ((prop = object_property_iter_next(&iter))) {
> + qom_list_add_property_value(obj, prop, &props);
> + }
> +
> + return props;
> +}
> +
> +ObjectPropertiesValuesList *qmp_qom_list_getv(strList *paths, Error **errp)
> +{
> + ObjectPropertiesValuesList *head = NULL, **tail = &head;
> +
> + for ( ; paths ; paths = paths->next) {
I'd prefer a separate variable:
for (tail = paths; tail; tail = tail->next) {
> + ObjectPropertiesValues *item = g_new0(ObjectPropertiesValues, 1);
> +
> + QAPI_LIST_APPEND(tail, item);
> +
> + item->properties = qom_get_property_value_list(paths->value, errp);
> + if (!item->properties) {
> + qapi_free_ObjectPropertiesValuesList(head);
> + return NULL;
> + }
> + }
> +
> + return head;
> +}
> +
> static ObjectNode *qom_tree_get(const char *path, Error **errp)
> {
> Object *obj;
The implementation is simpler than qom-tree's, too.
1 week, 1 day
Re: [PATCH V2 0/5] fast qom tree get
by Markus Armbruster
Steve Sistare <steven.sistare(a)oracle.com> writes:
> Using qom-list and qom-get to get all the nodes and property values in a
> QOM tree can take multiple seconds because it requires 1000's of individual
> QOM requests. Some managers fetch the entire tree or a large subset
> of it when starting a new VM, and this cost is a substantial fraction of
> start up time.
>
> To reduce this cost, consider QAPI calls that fetch more information in
> each call:
> * qom-list-get: given a path, return a list of properties and values.
> * qom-list-getv: given a list of paths, return a list of properties and
> values for each path.
> * qom-tree-get: given a path, return all descendant nodes rooted at that
> path, with properties and values for each.
>
> In all cases, a returned property is represented by ObjectPropertyValue,
> with fields name, type, and value. If an error occurs when reading a value
> the value field is omitted. Thus an error for one property will not cause a
> bulk fetch operation to fail.
>
> To evaluate each method, I modified scripts/qmp/qom-tree to use the method,
> verified all methods produce the same output, and timed each using:
>
> qemu-system-x86_64 -display none \
> -chardev socket,id=monitor0,path=/tmp/vm1.sock,server=on,wait=off \
> -mon monitor0,mode=control &
>
> time qom-tree -s /tmp/vm1.sock > /dev/null
>
> I only measured once per method, but the variation is low after a warm up run.
> The 'real - user - sys' column is a proxy for QEMU CPU time.
>
> method real(s) user(s) sys(s) (real - user - sys)(s)
> qom-list / qom-get 2.048 0.932 0.057 1.059
> qom-list-get 0.402 0.230 0.029 0.143
> qom-list-getv 0.200 0.132 0.015 0.053
> qom-tree-get 0.143 0.123 0.012 0.008
>
> qom-tree-get is the clear winner, reducing elapsed time by a factor of 14X,
> and reducing QEMU CPU time by 132X.
>
> qom-list-getv is slower when fetching the entire tree, but can beat
> qom-tree-get when only a subset of the tree needs to be fetched (not shown).
> qom-list-get is shown for comparison only, and is not included in this series.
How badly do you need the additional performance qom-tree-get can give
you in certain cases?
I'm asking because I find qom-list-getv *much* simpler.
1 week, 2 days
[PATCH 00/10] virDomainDriverAutoShutdown: Fix 3 bugs related to auto shutdown of VMs
by Peter Krempa
Following bugs are addressed:
- ordering of systemd units, which cause the VMs to be killed prior to
auto-shutdown finishing
- transient VMs are attempted to be managesaved
- restore of state is applied to VMs which the auto shutdown code
didn't act on otherwise
Peter Krempa (10):
virSystemdCreateMachine: Document @maxthreds
cgroup: Unexport 'virDomainCgroupInitCgroup'
qemu: conf: Store 'autoShutdown' config in
virDomainDriverAutoShutdownConfig
hypervisor: domain: Extract logic for auto shutdown to
virDomainDriverAutoShutdownActive
virSystemdCreateMachine: Add flag to invert machined unit dependencies
cgroup: Plumb the 'daemonDomainShutdown' parameter of
'virSystemdCreateMachine' to drivers
qemu: Fix auto-shutdown of qemu VMs by the qemu driver
hypervisor: Split out individual steps out of
virDomainDriverAutoShutdown
virDomainDriverAutoShutdownDoSave: Don't attempt to save transient VMs
virDomainDriverAutoShutdown: Refactor selection logic for VMs
src/ch/ch_process.c | 2 +
src/hypervisor/domain_cgroup.c | 6 +-
src/hypervisor/domain_cgroup.h | 11 +-
src/hypervisor/domain_driver.c | 390 +++++++++++++++++++--------------
src/hypervisor/domain_driver.h | 1 +
src/libvirt_private.syms | 2 +-
src/lxc/lxc_cgroup.c | 1 +
src/qemu/qemu.conf.in | 15 +-
src/qemu/qemu_cgroup.c | 7 +
src/qemu/qemu_conf.c | 30 +--
src/qemu/qemu_conf.h | 7 +-
src/qemu/qemu_driver.c | 12 +-
src/util/vircgroup.c | 7 +-
src/util/vircgroup.h | 1 +
src/util/virsystemd.c | 28 ++-
src/util/virsystemd.h | 3 +-
tests/virsystemdtest.c | 15 +-
17 files changed, 322 insertions(+), 216 deletions(-)
--
2.49.0
1 week, 2 days
[PATCH 0/7] qemu-10.1 test data and dropped machine type cleanups
by Peter Krempa
Peter Krempa (7):
qemuxmlconftest: x86_64: Drop explicit use of '2.10' machine type
qemuxmlconftest: x86_64: Drop explicit use of '2.12' machine type
qemuxmlconftest: x86_64: Drop explicit use of '2.5' machine type
qemuxmlconftest: x86_64: Drop explicit use of '2.9' machine type
qemuxmlconftest: x86_64: Bump 'firmware*' test cases to
'pc-i440fx-10.0'
qemuxmlconftest: x86_64: Bump 'firmware*' test cases to 'pc-q35-10.0'
qemucapabilitiestest: Add dump for the qemu-10.1 development cycle on
x86_64
.../domaincapsdata/qemu_10.1.0-q35.x86_64.xml | 1722 +
.../domaincapsdata/qemu_10.1.0-tcg.x86_64.xml | 1827 +
tests/domaincapsdata/qemu_10.1.0.x86_64.xml | 1722 +
.../caps_10.1.0_x86_64.replies | 46736 ++++++++++++++++
.../caps_10.1.0_x86_64.xml | 4574 ++
...host-model-fallback-tcg.x86_64-latest.args | 2 +-
...st-model-nofallback-tcg.x86_64-latest.args | 2 +-
.../cpu-host-model-tcg.x86_64-latest.args | 2 +-
.../firmware-auto-bios-not-stateless.xml | 2 +-
.../firmware-auto-bios-nvram.xml | 2 +-
...are-auto-bios-stateless.x86_64-latest.args | 2 +-
...ware-auto-bios-stateless.x86_64-latest.xml | 2 +-
.../firmware-auto-bios-stateless.xml | 2 +-
.../firmware-auto-bios.x86_64-latest.args | 2 +-
.../firmware-auto-bios.x86_64-latest.xml | 2 +-
tests/qemuxmlconfdata/firmware-auto-bios.xml | 2 +-
...ware-auto-efi-enrolled-keys-no-secboot.xml | 2 +-
...-auto-efi-enrolled-keys.x86_64-latest.args | 2 +-
...e-auto-efi-enrolled-keys.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-enrolled-keys.xml | 2 +-
...loader-qcow2-nvram-path.x86_64-latest.args | 2 +-
...-loader-qcow2-nvram-path.x86_64-latest.xml | 2 +-
...uto-efi-format-loader-qcow2-nvram-path.xml | 2 +-
...efi-format-loader-qcow2.x86_64-latest.args | 2 +-
...-efi-format-loader-qcow2.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-format-loader-qcow2.xml | 2 +-
...uto-efi-format-mismatch.x86_64-latest.args | 2 +-
...auto-efi-format-mismatch.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-format-mismatch.xml | 2 +-
...nvram-qcow2-network-nbd.x86_64-latest.args | 2 +-
...-nvram-qcow2-network-nbd.x86_64-latest.xml | 2 +-
...uto-efi-format-nvram-qcow2-network-nbd.xml | 2 +-
...format-nvram-qcow2-path.x86_64-latest.args | 2 +-
...-format-nvram-qcow2-path.x86_64-latest.xml | 2 +-
...mware-auto-efi-format-nvram-qcow2-path.xml | 2 +-
...-efi-format-nvram-qcow2.x86_64-latest.args | 2 +-
...o-efi-format-nvram-qcow2.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-format-nvram-qcow2.xml | 2 +-
...uto-efi-loader-insecure.x86_64-latest.args | 2 +-
...auto-efi-loader-insecure.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-loader-insecure.xml | 2 +-
...-loader-path-nonstandard.x86_64-latest.xml | 2 +-
...mware-auto-efi-loader-path-nonstandard.xml | 2 +-
...re-auto-efi-loader-path.x86_64-latest.args | 2 +-
...are-auto-efi-loader-path.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-loader-path.xml | 2 +-
...oader-secure.x86_64-latest.abi-update.args | 2 +-
...loader-secure.x86_64-latest.abi-update.xml | 2 +-
...-auto-efi-loader-secure.x86_64-latest.args | 2 +-
...e-auto-efi-loader-secure.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-loader-secure.xml | 2 +-
...to-efi-no-enrolled-keys.x86_64-latest.args | 2 +-
...uto-efi-no-enrolled-keys.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-no-enrolled-keys.xml | 2 +-
...are-auto-efi-no-secboot.x86_64-latest.args | 2 +-
...ware-auto-efi-no-secboot.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-no-secboot.xml | 2 +-
...are-auto-efi-nvram-file.x86_64-latest.args | 2 +-
...ware-auto-efi-nvram-file.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-nvram-file.xml | 2 +-
...efi-nvram-network-iscsi.x86_64-latest.args | 2 +-
...-efi-nvram-network-iscsi.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-nvram-network-iscsi.xml | 2 +-
...o-efi-nvram-network-nbd.x86_64-latest.args | 2 +-
...to-efi-nvram-network-nbd.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-nvram-network-nbd.xml | 2 +-
...are-auto-efi-nvram-path.x86_64-latest.args | 2 +-
...ware-auto-efi-nvram-path.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-nvram-path.xml | 2 +-
...ram-template-nonstandard.x86_64-latest.xml | 2 +-
...re-auto-efi-nvram-template-nonstandard.xml | 2 +-
...auto-efi-nvram-template.x86_64-latest.args | 2 +-
...-auto-efi-nvram-template.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-nvram-template.xml | 2 +-
...mware-auto-efi-rw-pflash.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-rw-pflash.xml | 2 +-
.../firmware-auto-efi-rw.x86_64-latest.xml | 2 +-
.../qemuxmlconfdata/firmware-auto-efi-rw.xml | 2 +-
...rmware-auto-efi-secboot.x86_64-latest.args | 2 +-
...irmware-auto-efi-secboot.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-secboot.xml | 2 +-
...rmware-auto-efi-smm-off.x86_64-latest.args | 2 +-
...irmware-auto-efi-smm-off.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-smm-off.xml | 2 +-
...ware-auto-efi-stateless.x86_64-latest.args | 2 +-
...mware-auto-efi-stateless.x86_64-latest.xml | 2 +-
.../firmware-auto-efi-stateless.xml | 2 +-
...are-auto-efi.x86_64-latest.abi-update.args | 2 +-
...ware-auto-efi.x86_64-latest.abi-update.xml | 2 +-
.../firmware-auto-efi.x86_64-latest.args | 2 +-
.../firmware-auto-efi.x86_64-latest.xml | 2 +-
tests/qemuxmlconfdata/firmware-auto-efi.xml | 2 +-
.../firmware-manual-bios-not-stateless.xml | 2 +-
...e-manual-bios-stateless.x86_64-latest.args | 2 +-
...re-manual-bios-stateless.x86_64-latest.xml | 2 +-
.../firmware-manual-bios-stateless.xml | 2 +-
.../firmware-manual-bios.x86_64-latest.args | 2 +-
.../firmware-manual-bios.x86_64-latest.xml | 2 +-
.../qemuxmlconfdata/firmware-manual-bios.xml | 2 +-
...are-manual-efi-acpi-q35.x86_64-latest.args | 2 +-
...ware-manual-efi-acpi-q35.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-acpi-q35.xml | 2 +-
...are-manual-efi-features.x86_64-latest.args | 2 +-
...ware-manual-efi-features.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-features.xml | 2 +-
.../firmware-manual-efi-loader-no-path.xml | 2 +-
...loader-path-nonstandard.x86_64-latest.args | 2 +-
...-loader-path-nonstandard.x86_64-latest.xml | 2 +-
...are-manual-efi-loader-path-nonstandard.xml | 2 +-
...anual-efi-loader-secure.x86_64-latest.args | 2 +-
...manual-efi-loader-secure.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-loader-secure.xml | 2 +-
...olled-keys-legacy-paths.x86_64-latest.args | 2 +-
...rolled-keys-legacy-paths.x86_64-latest.xml | 2 +-
...nual-efi-no-enrolled-keys-legacy-paths.xml | 2 +-
...al-efi-no-enrolled-keys.x86_64-latest.args | 2 +-
...ual-efi-no-enrolled-keys.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-no-enrolled-keys.xml | 2 +-
...no-secboot-legacy-paths.x86_64-latest.args | 2 +-
...-no-secboot-legacy-paths.x86_64-latest.xml | 2 +-
...are-manual-efi-no-secboot-legacy-paths.xml | 2 +-
...e-manual-efi-no-secboot.x86_64-latest.args | 2 +-
...re-manual-efi-no-secboot.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-no-secboot.xml | 2 +-
.../firmware-manual-efi-noacpi-q35.xml | 2 +-
...e-manual-efi-nvram-file.x86_64-latest.args | 2 +-
...re-manual-efi-nvram-file.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-nvram-file.xml | 2 +-
...efi-nvram-network-iscsi.x86_64-latest.args | 2 +-
...-efi-nvram-network-iscsi.x86_64-latest.xml | 2 +-
...irmware-manual-efi-nvram-network-iscsi.xml | 2 +-
...l-efi-nvram-network-nbd.x86_64-latest.args | 2 +-
...al-efi-nvram-network-nbd.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-nvram-network-nbd.xml | 2 +-
.../firmware-manual-efi-nvram-stateless.xml | 2 +-
...am-template-nonstandard.x86_64-latest.args | 2 +-
...ram-template-nonstandard.x86_64-latest.xml | 2 +-
...-manual-efi-nvram-template-nonstandard.xml | 2 +-
...re-manual-efi-nvram-template-stateless.xml | 2 +-
...nual-efi-nvram-template.x86_64-latest.args | 2 +-
...anual-efi-nvram-template.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-nvram-template.xml | 2 +-
...-manual-efi-rw-implicit.x86_64-latest.args | 2 +-
...e-manual-efi-rw-implicit.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-rw-implicit.xml | 2 +-
...ual-efi-rw-legacy-paths.x86_64-latest.args | 2 +-
...nual-efi-rw-legacy-paths.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-rw-legacy-paths.xml | 2 +-
...ual-efi-rw-modern-paths.x86_64-latest.args | 2 +-
...nual-efi-rw-modern-paths.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-rw-modern-paths.xml | 2 +-
.../firmware-manual-efi-rw.x86_64-latest.args | 2 +-
.../firmware-manual-efi-rw.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-rw.xml | 2 +-
...fi-secboot-legacy-paths.x86_64-latest.args | 2 +-
...efi-secboot-legacy-paths.x86_64-latest.xml | 2 +-
...rmware-manual-efi-secboot-legacy-paths.xml | 2 +-
...ware-manual-efi-secboot.x86_64-latest.args | 2 +-
...mware-manual-efi-secboot.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-secboot.xml | 2 +-
...re-manual-efi-stateless.x86_64-latest.args | 2 +-
...are-manual-efi-stateless.x86_64-latest.xml | 2 +-
.../firmware-manual-efi-stateless.xml | 2 +-
.../firmware-manual-efi.x86_64-latest.args | 2 +-
.../firmware-manual-efi.x86_64-latest.xml | 2 +-
tests/qemuxmlconfdata/firmware-manual-efi.xml | 2 +-
...e-manual-noefi-acpi-q35.x86_64-latest.args | 2 +-
...re-manual-noefi-acpi-q35.x86_64-latest.xml | 2 +-
.../firmware-manual-noefi-acpi-q35.xml | 2 +-
...manual-noefi-noacpi-q35.x86_64-latest.args | 2 +-
...-manual-noefi-noacpi-q35.x86_64-latest.xml | 2 +-
.../firmware-manual-noefi-noacpi-q35.xml | 2 +-
...pi-root-hotplug-disable.x86_64-latest.args | 2 +-
.../pc-i440fx-acpi-root-hotplug-disable.xml | 2 +-
...cpi-root-hotplug-enable.x86_64-latest.args | 2 +-
.../pc-i440fx-acpi-root-hotplug-enable.xml | 2 +-
...pm-emulator-crb-profile.x86_64-latest.args | 2 +-
.../tpm-emulator-crb-profile.xml | 2 +-
.../tpm-emulator-tpm2-enc.x86_64-latest.args | 2 +-
.../qemuxmlconfdata/tpm-emulator-tpm2-enc.xml | 2 +-
...pm-emulator-tpm2-pstate.x86_64-latest.args | 2 +-
.../tpm-emulator-tpm2-pstate.xml | 2 +-
.../tpm-emulator-tpm2.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/tpm-emulator-tpm2.xml | 2 +-
.../tpm-emulator.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/tpm-emulator.xml | 2 +-
.../tpm-external.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/tpm-external.xml | 2 +-
.../tpm-passthrough-crb.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/tpm-passthrough-crb.xml | 2 +-
.../tpm-passthrough.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/tpm-passthrough.xml | 2 +-
.../tseg-explicit-size.x86_64-latest.args | 2 +-
.../tseg-explicit-size.x86_64-latest.xml | 2 +-
tests/qemuxmlconfdata/tseg-explicit-size.xml | 2 +-
.../vhost-vsock-auto.x86_64-latest.args | 2 +-
.../vhost-vsock-auto.x86_64-latest.xml | 2 +-
tests/qemuxmlconfdata/vhost-vsock-auto.xml | 2 +-
198 files changed, 56774 insertions(+), 193 deletions(-)
create mode 100644 tests/domaincapsdata/qemu_10.1.0-q35.x86_64.xml
create mode 100644 tests/domaincapsdata/qemu_10.1.0-tcg.x86_64.xml
create mode 100644 tests/domaincapsdata/qemu_10.1.0.x86_64.xml
create mode 100644 tests/qemucapabilitiesdata/caps_10.1.0_x86_64.replies
create mode 100644 tests/qemucapabilitiesdata/caps_10.1.0_x86_64.xml
--
2.49.0
1 week, 2 days
[PATCH v2] nwfilter: Remove 'qemu-announce-self' example
by Peter Krempa
From: Peter Krempa <pkrempa(a)redhat.com>
The example allows packets sent by qemu after migration with broken
protocol ID. The proper self announce is handled via
'qemu-announce-self-rarp'.
The qemu bug was addressed by f8778a7785d530515b0db39 (released as
v0.13.0). As we no longer support such old qemus, and allowing broken
packets makes no sense. Remove the rule and make it into an alias of
'qemu-announce-self-rarp' to preserve compatibility. Adjust the existing
examples to use only the proper rule.t
Closes: https://gitlab.com/libvirt/libvirt/-/issues/792
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
v2:
- keep the old rule as alias
- update comment to say that it's no longer needed
docs/firewall.rst | 1 -
docs/formatnwfilter.rst | 2 +-
src/nwfilter/xml/clean-traffic-gateway.xml | 2 +-
src/nwfilter/xml/clean-traffic.xml | 2 +-
src/nwfilter/xml/qemu-announce-self-rarp.xml | 2 ++
src/nwfilter/xml/qemu-announce-self.xml | 14 ++++----------
6 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/docs/firewall.rst b/docs/firewall.rst
index 26474d3317..81114d2c95 100644
--- a/docs/firewall.rst
+++ b/docs/firewall.rst
@@ -285,7 +285,6 @@ useful rules:
fb57c546-76dc-a372-513f-e8179011b48a no-mac-spoofing
dba10ea7-446d-76de-346f-335bd99c1d05 no-other-l2-traffic
f5c78134-9da4-0c60-a9f0-fb37bc21ac1f no-other-rarp-traffic
- 7637e405-4ccf-42ac-5b41-14f8d03d8cf3 qemu-announce-self
9aed52e7-f0f3-343e-fe5c-7dcb27b594e5 qemu-announce-self-rarp
Most of these are just building blocks. The interesting one here is
diff --git a/docs/formatnwfilter.rst b/docs/formatnwfilter.rst
index 13e9a791af..e50497aaf8 100644
--- a/docs/formatnwfilter.rst
+++ b/docs/formatnwfilter.rst
@@ -438,7 +438,7 @@ several other filters.
<filterref filter='allow-incoming-ipv4'/>
<filterref filter='no-arp-spoofing'/>
<filterref filter='no-other-l2-traffic'/>
- <filterref filter='qemu-announce-self'/>
+ <filterref filter='qemu-announce-self-rarp'/>
</filter>
To reference another filter, the XML node ``filterref`` needs to be provided
diff --git a/src/nwfilter/xml/clean-traffic-gateway.xml b/src/nwfilter/xml/clean-traffic-gateway.xml
index b8c204041a..1768a67697 100644
--- a/src/nwfilter/xml/clean-traffic-gateway.xml
+++ b/src/nwfilter/xml/clean-traffic-gateway.xml
@@ -30,5 +30,5 @@
<filterref filter='no-other-l2-traffic'/>
<!-- allow qemu to send a self-announce upon migration end -->
- <filterref filter='qemu-announce-self'/>
+ <filterref filter='qemu-announce-self-rarp'/>
</filter>
diff --git a/src/nwfilter/xml/clean-traffic.xml b/src/nwfilter/xml/clean-traffic.xml
index b8cde9c560..b0530da70a 100644
--- a/src/nwfilter/xml/clean-traffic.xml
+++ b/src/nwfilter/xml/clean-traffic.xml
@@ -25,6 +25,6 @@
<filterref filter='no-other-l2-traffic'/>
<!-- allow qemu to send a self-announce upon migration end -->
- <filterref filter='qemu-announce-self'/>
+ <filterref filter='qemu-announce-self-rarp'/>
</filter>
diff --git a/src/nwfilter/xml/qemu-announce-self-rarp.xml b/src/nwfilter/xml/qemu-announce-self-rarp.xml
index b7a848ad0f..db7b650320 100644
--- a/src/nwfilter/xml/qemu-announce-self-rarp.xml
+++ b/src/nwfilter/xml/qemu-announce-self-rarp.xml
@@ -11,4 +11,6 @@
arpsrcmacaddr='$MAC' arpdstmacaddr='$MAC'
arpsrcipaddr='0.0.0.0' arpdstipaddr='0.0.0.0'/>
</rule>
+
+ <filterref filter='no-other-rarp-traffic'/>
</filter>
diff --git a/src/nwfilter/xml/qemu-announce-self.xml b/src/nwfilter/xml/qemu-announce-self.xml
index 352db500de..73b77804cf 100644
--- a/src/nwfilter/xml/qemu-announce-self.xml
+++ b/src/nwfilter/xml/qemu-announce-self.xml
@@ -1,13 +1,7 @@
<filter name='qemu-announce-self' chain='root'>
- <!-- as of 4/26/2010 qemu sends out a bogus packet with
- wrong rarp protocol ID -->
- <!-- accept what is being sent now -->
- <rule action='accept' direction='out'>
- <mac protocolid='0x835'/>
- </rule>
-
- <!-- accept if it was changed to rarp -->
+ <!-- This rule originally allowed protocol '0x835' which qemu originally used.
+ As this bug in qemu was fixed and libvirt no longer supports such old qemu
+ versions this now is just a shim refering to 'qemu-announce-self-rarp' to
+ preserve compatibility if someone used this rule directly -->
<filterref filter='qemu-announce-self-rarp'/>
- <filterref filter='no-other-rarp-traffic'/>
-
</filter>
--
2.49.0
1 week, 2 days
[PATCH] nwfilter: Remove 'qemu-announce-self' example
by Peter Krempa
From: Peter Krempa <pkrempa(a)redhat.com>
The example allows packets sent by qemu after migration with broken
protocol ID. The proper self announce is handled via
'qemu-announce-self-rarp'.
The qemu bug was addressed by f8778a7785d530515b0db39 (released as
v0.13.0). As we no longer support such old qemus, and allowing broken
packets makes no sense remove the filter, and adjust the existing ones
to refer to the proper name.
Closes: https://gitlab.com/libvirt/libvirt/-/issues/792
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
docs/firewall.rst | 1 -
docs/formatnwfilter.rst | 2 +-
src/nwfilter/xml/clean-traffic-gateway.xml | 2 +-
src/nwfilter/xml/clean-traffic.xml | 2 +-
src/nwfilter/xml/meson.build | 1 -
src/nwfilter/xml/qemu-announce-self-rarp.xml | 2 ++
src/nwfilter/xml/qemu-announce-self.xml | 13 -------------
7 files changed, 5 insertions(+), 18 deletions(-)
delete mode 100644 src/nwfilter/xml/qemu-announce-self.xml
diff --git a/docs/firewall.rst b/docs/firewall.rst
index 26474d3317..81114d2c95 100644
--- a/docs/firewall.rst
+++ b/docs/firewall.rst
@@ -285,7 +285,6 @@ useful rules:
fb57c546-76dc-a372-513f-e8179011b48a no-mac-spoofing
dba10ea7-446d-76de-346f-335bd99c1d05 no-other-l2-traffic
f5c78134-9da4-0c60-a9f0-fb37bc21ac1f no-other-rarp-traffic
- 7637e405-4ccf-42ac-5b41-14f8d03d8cf3 qemu-announce-self
9aed52e7-f0f3-343e-fe5c-7dcb27b594e5 qemu-announce-self-rarp
Most of these are just building blocks. The interesting one here is
diff --git a/docs/formatnwfilter.rst b/docs/formatnwfilter.rst
index 13e9a791af..e50497aaf8 100644
--- a/docs/formatnwfilter.rst
+++ b/docs/formatnwfilter.rst
@@ -438,7 +438,7 @@ several other filters.
<filterref filter='allow-incoming-ipv4'/>
<filterref filter='no-arp-spoofing'/>
<filterref filter='no-other-l2-traffic'/>
- <filterref filter='qemu-announce-self'/>
+ <filterref filter='qemu-announce-self-rarp'/>
</filter>
To reference another filter, the XML node ``filterref`` needs to be provided
diff --git a/src/nwfilter/xml/clean-traffic-gateway.xml b/src/nwfilter/xml/clean-traffic-gateway.xml
index b8c204041a..1768a67697 100644
--- a/src/nwfilter/xml/clean-traffic-gateway.xml
+++ b/src/nwfilter/xml/clean-traffic-gateway.xml
@@ -30,5 +30,5 @@
<filterref filter='no-other-l2-traffic'/>
<!-- allow qemu to send a self-announce upon migration end -->
- <filterref filter='qemu-announce-self'/>
+ <filterref filter='qemu-announce-self-rarp'/>
</filter>
diff --git a/src/nwfilter/xml/clean-traffic.xml b/src/nwfilter/xml/clean-traffic.xml
index b8cde9c560..b0530da70a 100644
--- a/src/nwfilter/xml/clean-traffic.xml
+++ b/src/nwfilter/xml/clean-traffic.xml
@@ -25,6 +25,6 @@
<filterref filter='no-other-l2-traffic'/>
<!-- allow qemu to send a self-announce upon migration end -->
- <filterref filter='qemu-announce-self'/>
+ <filterref filter='qemu-announce-self-rarp'/>
</filter>
diff --git a/src/nwfilter/xml/meson.build b/src/nwfilter/xml/meson.build
index 0d96c54ebe..de3f205a7c 100644
--- a/src/nwfilter/xml/meson.build
+++ b/src/nwfilter/xml/meson.build
@@ -22,7 +22,6 @@ nwfilter_xml_files = [
'no-other-l2-traffic.xml',
'no-other-rarp-traffic.xml',
'qemu-announce-self-rarp.xml',
- 'qemu-announce-self.xml',
]
install_data(nwfilter_xml_files, install_dir: sysconfdir / 'libvirt' / 'nwfilter')
diff --git a/src/nwfilter/xml/qemu-announce-self-rarp.xml b/src/nwfilter/xml/qemu-announce-self-rarp.xml
index b7a848ad0f..db7b650320 100644
--- a/src/nwfilter/xml/qemu-announce-self-rarp.xml
+++ b/src/nwfilter/xml/qemu-announce-self-rarp.xml
@@ -11,4 +11,6 @@
arpsrcmacaddr='$MAC' arpdstmacaddr='$MAC'
arpsrcipaddr='0.0.0.0' arpdstipaddr='0.0.0.0'/>
</rule>
+
+ <filterref filter='no-other-rarp-traffic'/>
</filter>
diff --git a/src/nwfilter/xml/qemu-announce-self.xml b/src/nwfilter/xml/qemu-announce-self.xml
deleted file mode 100644
index 352db500de..0000000000
--- a/src/nwfilter/xml/qemu-announce-self.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<filter name='qemu-announce-self' chain='root'>
- <!-- as of 4/26/2010 qemu sends out a bogus packet with
- wrong rarp protocol ID -->
- <!-- accept what is being sent now -->
- <rule action='accept' direction='out'>
- <mac protocolid='0x835'/>
- </rule>
-
- <!-- accept if it was changed to rarp -->
- <filterref filter='qemu-announce-self-rarp'/>
- <filterref filter='no-other-rarp-traffic'/>
-
-</filter>
--
2.49.0
1 week, 2 days
[libvirt PATCH] qemu: prefer memfd if we have to format system memory
by Ján Tomko
From: Ján Tomko <jtomko(a)redhat.com>
For any vhost-user device to work, the memory needs to be marked as
shared.
What we recommend to users (e.g. in the virtiofs quide [0]) is:
<memoryBacking>
<source type='memfd'/>
<access mode='shared'/>
</memoryBacking>
Technically, only the access mode is needed:
<memoryBacking>
<access mode='shared'/>
</memoryBacking>
But this results in libvirt assuming the file backend.
Switch this case to use memfd which should offer better performance,
and less disk usage, at the cost of eating unswappable RAM.
[0] https://libvirt.org/kbase/virtiofs.html
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_command.c | 9 +++++++--
tests/qemuxmlconfdata/disk-vhostvdpa.x86_64-latest.args | 2 +-
.../net-vhostuser-multiq.x86_64-latest.args | 2 +-
.../net-vhostuser-passt.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args | 2 +-
.../schema-reorder-domain-subelements.x86_64-latest.args | 2 +-
.../qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.args | 2 +-
7 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7658cc4d39..ca9d4d6609 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3417,8 +3417,13 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
if (!priv->memPrealloc)
prealloc = true;
- } else if (!nvdimmPath &&
- def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_MEMFD) {
+ } else if ((!nvdimmPath &&
+ def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_MEMFD) ||
+ (systemMemory &&
+ memAccess &&
+ !useHugepage &&
+ def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_NONE &&
+ virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD))) {
backendType = "memory-backend-memfd";
if (useHugepage &&
diff --git a/tests/qemuxmlconfdata/disk-vhostvdpa.x86_64-latest.args b/tests/qemuxmlconfdata/disk-vhostvdpa.x86_64-latest.args
index 93d2ef0d98..04732df68a 100644
--- a/tests/qemuxmlconfdata/disk-vhostvdpa.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/disk-vhostvdpa.x86_64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-accel tcg \
-cpu qemu64 \
-m size=219136k \
--object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
+-object '{"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args
index 4ea3d4eebd..ac5c8b7652 100644
--- a/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-accel tcg \
-cpu qemu64 \
-m size=219136k \
--object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
+-object '{"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args
index afbbe188cf..ee395deffe 100644
--- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-accel tcg \
-cpu qemu64 \
-m size=219136k \
--object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
+-object '{"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args
index f5925c77fe..74454d3d24 100644
--- a/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-accel tcg \
-cpu qemu64 \
-m size=219136k \
--object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
+-object '{"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64-latest.args b/tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64-latest.args
index 76df9c30b0..5fb594df87 100644
--- a/tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-passtvhostuu/.config \
-accel kvm \
-cpu qemu64 \
-m size=16777216k \
--object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-passtvhostuu/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":17179869184}' \
+-object '{"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":17179869184}' \
-overcommit mem-lock=off \
-smp 16,sockets=16,cores=1,threads=1 \
-uuid d79698e0-46b2-4459-87ee-7c762990dd6e \
diff --git a/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.args b/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.args
index 72ca38c305..eed9af8bb1 100644
--- a/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.args
+++ b/tests/qemuxmlconfdata/vhost-user-fs-ccw.s390x-latest.args
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-accel tcg \
-cpu qemu \
-m size=219136k \
--object '{"qom-type":"memory-backend-file","id":"s390.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/s390.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
+-object '{"qom-type":"memory-backend-memfd","id":"s390.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--
2.50.0
1 week, 2 days