set custom loglevel for external libraries
by Olaf Hering
In src/libxl/libxl_conf.c:libxlDriverConfigInit, virLogGetDefaultPriority is used to specify the (private) loglevel of an external library. This value could be controlled via "log_level=N" in libvirtd.conf. But doing it that way will affect libvirtd itself, instead of libxenlight.so as intended. There might be ways to suppress everything but libxl output via "log_filters=", but it is not clear what the syntax would be.
I wonder what the preferred way is to specify the desired loglevel for the external library. It seems a separate configuration setting is required so that each value of XTL_* from xentoollog.h can be specified.
Olaf
3 years, 1 month
[PATCH RFC 0/5] Subject: [PATCH RFC 0/5] qapi: Add feature flags to enum members
by Markus Armbruster
PATCH 1+2 add feature flags to enum members. Awkward due to an
introspection design mistake; see PATCH 1 for details. Feedback
welcome, in particular from management application guys.
PATCH 3+4 implement policy deprecated-input={reject,crash} for enum
values.
Policy deprecated-output=hide is not implemented, because we can't
hide a value without hiding the entire member, which is almost
certainly more than the requester of this policy bargained for.
Perhaps we want a new policy deprecated-output=crash to help us catch
unwanted use of deprecated enum values. Thoughts?
PATCH 5 puts the new feature flags to use. It makes sense only on top
of Vladimir's deprecation of drive-backup. See its commit message for
a reference.
Based on my "[PATCH 00/22] qapi: Remove simple unions from the schema
language".
Based-on: Message-Id: <20210913123932.3306639-1-armbru(a)redhat.com>
Markus Armbruster (5):
qapi: Enable enum member introspection to show more than name
qapi: Add feature flags to enum members
qapi: Move compat policy from QObject to generic visitor
qapi: Implement deprecated-input={reject,crash} for enum values
block: Deprecate transaction type drive-backup
docs/devel/qapi-code-gen.rst | 4 ++-
qapi/compat.json | 3 +++
qapi/introspect.json | 23 ++++++++++++++--
qapi/transaction.json | 5 +++-
include/qapi/qobject-input-visitor.h | 4 ---
include/qapi/qobject-output-visitor.h | 4 ---
include/qapi/util.h | 6 ++++-
include/qapi/visitor-impl.h | 3 +++
include/qapi/visitor.h | 9 +++++++
qapi/qapi-visit-core.c | 27 ++++++++++++++++---
qapi/qmp-dispatch.c | 4 +--
qapi/qobject-input-visitor.c | 14 +---------
qapi/qobject-output-visitor.c | 14 +---------
scripts/qapi/expr.py | 3 ++-
scripts/qapi/introspect.py | 19 ++++++++++---
scripts/qapi/schema.py | 22 +++++++++++++--
scripts/qapi/types.py | 17 +++++++++++-
tests/qapi-schema/doc-good.json | 5 +++-
tests/qapi-schema/doc-good.out | 3 +++
tests/qapi-schema/doc-good.txt | 3 +++
.../qapi-schema/enum-dict-member-unknown.err | 2 +-
tests/qapi-schema/qapi-schema-test.json | 3 ++-
tests/qapi-schema/qapi-schema-test.out | 1 +
tests/qapi-schema/test-qapi.py | 1 +
24 files changed, 144 insertions(+), 55 deletions(-)
--
2.31.1
3 years, 1 month
Squelch 'eof from qemu monitor' error on normal VM shutdown
by Jim Fehlig
Hi All,
Likely Christian received a bug report that motivated commit aeda1b8c56, which
was later reverted by Michal with commit 72adaf2f10. In the past, I recall being
asked about "internal error: End of file from qemu monitor" on normal VM
shutdown and gave a hand wavy response using some of Michal's words from the
revert commit message.
I recently received a bug report (sorry, but no public link) from a concerned
user about this error and wondered if there is some way to improve it? I went
down some dead ends before circling back to Christian's patch. When rebased to
latest master, I cannot reproduce the hangs reported by Michal [1]. Perhaps
Nikolay's series to resolve hangs/crashes of libvirtd [2] has now made
Christian's patch viable?
Regards
Jim
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1536461
[2] https://listman.redhat.com/archives/libvir-list/2020-July/msg01606.html
3 years, 1 month
[libvirt PATCH v3 0/5] add interface infomation in guestinfo command
by zhanglei
zhanglei (5):
domain: add interface information to 'virDomainGetGuestInfo'
virsh: add interface information to guestinfo command
qemu: refactor 'qemuAgentGetInterfaces'
qemu: add guest interface information in 'qemuDomainGetGuestInfo'
NEWS: add guest interface information in 'virDomainGetGuestInfo'
NEWS.rst | 5 ++
docs/manpages/virsh.rst | 12 ++++-
include/libvirt/libvirt-domain.h | 1 +
src/libvirt-domain.c | 12 +++++
src/qemu/qemu_agent.c | 9 ++--
src/qemu/qemu_agent.h | 3 +-
src/qemu/qemu_driver.c | 90 +++++++++++++++++++++++++++++++-
tests/qemuagenttest.c | 2 +-
tools/virsh-domain.c | 6 +++
9 files changed, 131 insertions(+), 9 deletions(-)
--
2.31.1
3 years, 1 month
[PATCH 00/11] qdev: Add JSON -device and fix QMP device_add
by Kevin Wolf
It's still a long way until we'll have QAPIfied devices, but there are
some improvements that we can already make now to make the future switch
easier.
One important part of this is having code paths without QemuOpts, which
we want to get rid of and replace with the keyval parser in the long
run. This series adds support for JSON syntax to -device, which bypasses
QemuOpts.
While we're not using QAPI yet, devices are based on QOM, so we already
do have type checks and an implied schema. JSON syntax supported now can
be supported by QAPI later and regarding command line compatibility,
actually switching to it becomes an implementation detail this way (of
course, it will still add valuable user-visible features like
introspection and documentation).
Apart from making things more future proof, this also immediately adds
a way to do non-scalar properties on the command line. nvme could have
used list support recently, and the lack of it in -device led to some
rather unnatural solution in the first version (doing the relationship
between a device and objects backwards) and loss of features in the
following. With this series, using a list as a device property should be
possible without any weird tricks.
Unfortunately, even QMP device_add goes through QemuOpts before this
series, which destroys any type safety QOM provides and also can't
support non-scalar properties. This is a bug that is fixed during this
series, but that is technically an incompatible change. A similar change
was made for netdev_add in commit db2a380c84.
libvirt needs to make sure that it actually always passes the right
type, because passing a wrong type will start to fail after this
series. I hope that libvirt already does things correctly, so this
won't cause any trouble, but if it does, there is the option of using
the QemuOpts-less code path only for JSON -device and going through a
deprecation period for QMP device_add.
Kevin Wolf (11):
qom: Reduce use of error_propagate()
iotests/245: Fix type for iothread property
iotests/051: Fix typo
qdev: Avoid using string visitor for properties
qdev: Make DeviceState.id independent of QemuOpts
qdev: Add Error parameter to qdev_set_id()
qemu-option: Allow deleting opts during qemu_opts_foreach()
qdev: Base object creation on QDict rather than QemuOpts
qdev: Avoid QemuOpts in QMP device_add
vl: Enable JSON syntax for -device
Deprecate stable non-JSON -device and -object
qapi/qdev.json | 15 +++--
docs/about/deprecated.rst | 11 ++++
include/hw/qdev-core.h | 10 ++--
include/monitor/qdev.h | 2 +-
hw/arm/virt.c | 2 +-
hw/core/qdev.c | 6 +-
hw/net/virtio-net.c | 4 +-
hw/pci-bridge/pci_expander_bridge.c | 2 +-
hw/ppc/e500.c | 2 +-
hw/vfio/pci.c | 4 +-
hw/xen/xen-legacy-backend.c | 3 +-
qom/object.c | 7 +--
qom/object_interfaces.c | 17 ++----
softmmu/qdev-monitor.c | 90 +++++++++++++++++------------
softmmu/vl.c | 58 ++++++++++++++++---
util/qemu-option.c | 4 +-
tests/qemu-iotests/051 | 2 +-
tests/qemu-iotests/051.pc.out | 4 +-
tests/qemu-iotests/245 | 4 +-
19 files changed, 161 insertions(+), 86 deletions(-)
--
2.31.1
3 years, 1 month
[PATCH 0/8] virsh: Use g_autoptr() for public types
by Michal Privoznik
In this patchset I'm switching from virXXXFree to g_autoptr(). There are
still some left, but very rare occurrence:
libvirt.git $ git grep -o "vir[A-Z].*Free" -- tools/ | \
cut -d':' -f 2 | sort | uniq -c | sort -n
And of course, after these some functions could use subsequent cleanup,
e.g. because cleanup label collapsed to just return statement. But I
leave those for future work.
Michal Prívozník (8):
virsh-util.h: Fix ordering of virshXXXFree functions
virsh: Add wrapper for virInterfaceFree
virsh: Add wrapper for virStoragePoolFree
virsh: Add wrapper for virStorageVolFree
virsh: Add wrapper for virNetworkFree
virsh: Add wrapper for virNodeDeviceFree
virsh: Add wrapper for virNWFilterFree
virsh: Add wrapper for virStreamFree
build-aux/syntax-check.mk | 4 +-
tools/virsh-completer-interface.c | 3 +-
tools/virsh-completer-network.c | 8 +--
tools/virsh-completer-nodedev.c | 3 +-
tools/virsh-completer-nwfilter.c | 3 +-
tools/virsh-completer-pool.c | 3 +-
tools/virsh-completer-volume.c | 8 +--
tools/virsh-console.c | 8 +--
tools/virsh-domain.c | 10 +--
tools/virsh-interface.c | 55 +++++----------
tools/virsh-network.c | 75 ++++++--------------
tools/virsh-nodedev.c | 49 ++++----------
tools/virsh-nwfilter.c | 22 ++----
tools/virsh-pool.c | 67 ++++++------------
tools/virsh-util.c | 78 +++++++++++++++++++++
tools/virsh-util.h | 46 +++++++++++--
tools/virsh-volume.c | 109 ++++++++----------------------
17 files changed, 254 insertions(+), 297 deletions(-)
--
2.32.0
3 years, 1 month
[PATCH 0/1] vmx: Fix <genid/> mapping
by Michal Privoznik
Apparently, parsing vmx.genid is not as easy as I thought. Anyway, it
was brought up in a private thread that libvirt doesn't report correct
UUIDs. For instance for the following input:
vm.genid = "-8536691797830587195"
vm.genidX = "-1723453263670062919"
Libvirt would report:
<genid>8987940a-0951-2cc5-e815-10634ff550b9</genid>
while virt-v2v would report:
<genid>09512cc5-940a-8987-b950-f54f631015e8</genid>
Another example:
vm.genid = "-6284418052148993891"
vm.genidX = "-649955058627554545"
Libvirt:
<genid>a8c94313-ed9b-609d-f6fa-e5515a89530f</genid>
virt-v2v:
<genid>ed9b609d-4313-a8c9-0f53-895a51e5faf6</genid>
To test my patch I modified tests/vmx2xmldata/esx-in-the-wild-10.vmx
(because it already contains vmx.genid, but any file can be modified
really), and then ran:
libvirt.git/_build/tests $ VIR_TEST_DEBUG=1 VIR_TEST_RANGE=58 ./vmx2xmltest
Mind you, the fix is almost direct rewrite of virt-v2v's algorithm,
except it's optimized for C and not OCaml :-) You can find various
attempts/versions of that on my gitlab:
https://gitlab.com/MichalPrivoznik/libvirt/-/commits/vmx_genid/
I'm sending only the last one because that looks the best IMO.
Michal Prívozník (1):
vmx: Fix <genid/> mapping
src/vmx/vmx.c | 16 ++++++++++++----
tests/vmx2xmldata/esx-in-the-wild-10.xml | 2 +-
2 files changed, 13 insertions(+), 5 deletions(-)
--
2.32.0
3 years, 1 month
[libvirt PATCH v5 0/7] Add a PCI/PCIe device VPD Capability
by Dmitrii Shcherbakov
Add support for deserializing the binary PCI/PCIe VPD format and
exposing VPD resources as XML elements in a new nested capability
of PCI/PCIe devices called 'vpd'.
The series contains the following incremental changes:
* The PCI VPD parser module, in-memory resource representation
and tests;
* VPD-related helpers added to the virpci module;
* VPD capability support: XML serialization/deserialization from/into
VPD resource data structures;
* Documentation.
The VPD format is specified in "I.3. VPD Definitions" in PCI specs
(2.2+) and "6.28.1 VPD Format" PCIe 4.0. As section 6.28 in PCIe 4.0
notes, the PCI Local Bus and PCIe VPD formats are binary compatible
and PCIe 4.0 merely started incorporating what was already present in
PCI specs.
Linux kernel exposes a binary blob in the VPD format via sysfs since
v2.6.26 (commit 94e6108803469a37ee1e3c92dafdd1d59298602f) which requires
a parser to interpret.
There are usage scenarios where information such as the board serial
number needs to be retrieved from PCI(e) VPD. Projects like Nova can
utilize this information for cases which involve virtual interface
plugging on SmartNIC DPUs but there may be other scenarios and types of
information useful to retrieve from VPD. The fact that the format is
binary requires proper parsing instead of substring searching hence the
full parser is proposed. Likewise, checksum validation requires proper
parsing as well.
A usage example is present here:
https://review.opendev.org/c/openstack/nova/+/808199
The patch follows a prior discussion on the mailing list which has
additional context about the use-case but a narrower proposal:
https://listman.redhat.com/archives/libvir-list/2021-May/msg00873.html
https://www.mail-archive.com/libvir-list@redhat.com/msg218165.html
The new functionality is mostly contained in virpcivpd with a
couple of new functions added to virpci. Additionally, the necessary XML
serialization/deserialization and glue code is added to expose the VPD
capability to external clients as XML.
A new capability flag is added along with a new capability in order to
allow for filtering of PCI devices with the VPD capability using virsh:
virsh nodedev-list --cap vpd
sudo virsh nodedev-dumpxml --device pci_dddd_bb_ss_f
In this example having the root uid is required in order to access the
vpd sysfs entry, therefore, the nodedev XML output will only contain
the VPD capability if virsh is run as root.
The capability is treated as dynamic due to the presence of read-write
sections in the VPD format per PCI/PCIe specs (the idea being that
read-write resource fields may potentially be altered by the DPU OS
over time independently from the host OS).
Unit tests cover the parser functionality (including many possible
invalid cases), in-memory representation as well as XML serialization
and deserialization.
Manual functional testing was performed with 2 DPUs and several other
NIC models which expose PCI(e) VPD. Testing have also been performed
for devices that do not have VPD or those that expose a VPD capability
but exhibit invalid behavior (I/O errors while reading a sysfs entry).
Per the existing guidelines, the implementation relies heavily on glib
for various purposes.
https://libvirt.org/glib-adoption.html
* v5 fixes a couple of minor typos and adds NEWS entries.
* The v4 of the patch includes a number of fixes compared to v3:
* Fixed the patch to correctly build against older glib (2.56.0);
* Notably, glib commit 86c073dba9d82ef3f1bc3d3116b058b9b5c3b1eb (in
2.59.0) fixes g_autolist support for derivable Glib types. To make
things work in 2.56.0 a workaround is conditionally applied;
* virCreateAnonymousFile now uses a temporary file which is
unlinked after creation instead of memfd because OpenSUSE 15.2 does
not have support memfd;
* Keyword resources now use GTree instead of GHashTable as the
underlying data structure:
* This allows for stable ordering which is important for XML2XML tests
as they were failing with when GLib versions were different,
resulting in a different ordering of elements;
* The keyword resource iteration function was complex and got replaced
by a simpler g_tree_foreach-based approach;
* Added more testing: functions added to virpci are now assessed by
creating a mocked vpd file under a mocked sysfs structure while the
parser is still tested in virpcivpdtest file;
* Refactoring:
* Applied changes based on the indent tool operation with some
post-processing;
* Renamed functions which had the Glib naming style to use camel case
where possible. Auto-generated declarations are an exception:
gobject/gtype.h defines type_name##_init, type_name##_class_init,
module_obj_name##_get_type functions which were left unchanged;
* camelCase is now used for local variables and function parameters;
* Replaced //-style comments with multi-line ones;
* Split out one patch into 4 based on distinct features:
* PCI VPD parser functionality and the respective in-memory types;
* VPD helpers in virpci;
* XML serialization/deserialization and VPD capability support;
* Documentation.
Build & test results for targets in ci/manifest.yaml:
ci/helper test --meson-args='-Dexpensive_tests=enabled' <target>
https://gist.github.com/dshcherb/225b5da9478275f08c220487814ffd1c
Dmitrii Shcherbakov (7):
Add a PCI/PCIe device VPD Parser
News: Add a PCI VPD parser
Add PCI VPD-related helper functions to virpci
News: Add PCI VPD-related helper functions to virpci
Add PCI VPD Capability Support
News: Add PCI VPD capability support
Add PCI VPD Capability Documentation
NEWS.rst | 22 +
build-aux/syntax-check.mk | 4 +-
docs/drvnodedev.html.in | 46 ++
docs/formatnode.html.in | 24 +-
docs/schemas/nodedev.rng | 40 +
include/libvirt/libvirt-nodedev.h | 1 +
po/POTFILES.in | 1 +
src/conf/node_device_conf.c | 271 +++++++
src/conf/node_device_conf.h | 6 +-
src/conf/virnodedeviceobj.c | 7 +-
src/libvirt_private.syms | 17 +
src/node_device/node_device_driver.c | 2 +
src/node_device/node_device_udev.c | 2 +
src/util/meson.build | 1 +
src/util/virpci.c | 62 ++
src/util/virpci.h | 3 +
src/util/virpcivpd.c | 755 ++++++++++++++++++
src/util/virpcivpd.h | 117 +++
src/util/virpcivpdpriv.h | 45 ++
tests/meson.build | 1 +
.../pci_0000_42_00_0_vpd.xml | 33 +
.../pci_0000_42_00_0_vpd.xml | 1 +
tests/nodedevxml2xmltest.c | 1 +
tests/testutils.c | 40 +
tests/testutils.h | 4 +
tests/virpcimock.c | 30 +
tests/virpcitest.c | 64 ++
tests/virpcivpdtest.c | 705 ++++++++++++++++
tools/virsh-nodedev.c | 3 +
29 files changed, 2303 insertions(+), 5 deletions(-)
create mode 100644 src/util/virpcivpd.c
create mode 100644 src/util/virpcivpd.h
create mode 100644 src/util/virpcivpdpriv.h
create mode 100644 tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
create mode 120000 tests/nodedevxml2xmlout/pci_0000_42_00_0_vpd.xml
create mode 100644 tests/virpcivpdtest.c
--
2.30.2
3 years, 1 month
[PATCH] conf: fix block type CDROM cannot support startupPolicy
by Jie Wang
block type CDROM also support startupPolicy in the past, so
let us fix it.
Signed-off-by: Jie Wang <wangjie88(a)huawei.com>
---
src/conf/domain_conf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f7025bffe4..dd374e8ab3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30853,9 +30853,10 @@ virDomainDiskTranslateSourcePool(virDomainDiskDef *def)
}
if (def->startupPolicy != 0 &&
- virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_FILE) {
+ (virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_FILE &&
+ virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_BLOCK)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'startupPolicy' is only valid for 'file' type volume"));
+ _("'startupPolicy' is only valid for 'file' or 'block' type volume"));
return -1;
}
--
2.24.0.windows.2
3 years, 1 month