[PATCH V4] Modify virCPUarmCompare to perform compare actions
by Zhenyu Zheng
Modify virCPUarmCompare in cpu_arm.c to perform compare action.
This patch only adds host to host CPU compare, the rest cases
remains the same. This is useful for source and destination host
compare during migrations to avoid migration between different
CPU models that have different CPU freatures.
Signed-off-by: Zhenyu Zheng <zheng.zhenyu(a)outlook.com>
---
src/cpu/cpu_arm.c | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 939a3b8390..64bd0f03c2 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -463,10 +463,43 @@ virCPUarmBaseline(virCPUDefPtr *cpus,
}
static virCPUCompareResult
-virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED,
- virCPUDefPtr cpu G_GNUC_UNUSED,
- bool failMessages G_GNUC_UNUSED)
+virCPUarmCompare(virCPUDefPtr host,
+ virCPUDefPtr cpu,
+ bool failIncompatible
+)
{
+ /* Only support host to host CPU compare for ARM*/
+ if (cpu->type != VIR_CPU_TYPE_HOST)
+ return VIR_CPU_COMPARE_IDENTICAL;
+
+ if (!host || !host->model) {
+ if (failIncompatible) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
+ _("unknown host CPU"));
+ return VIR_CPU_COMPARE_ERROR;
+ } else {
+ VIR_WARN("unknown host CPU");
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+ }
+
+ /* Compare vendor and model to check if CPUs are identical */
+ if (STRNEQ_NULLABLE(host->vendor, cpu->vendor) ||
+ STRNEQ_NULLABLE(host->model, cpu->model)) {
+ VIR_DEBUG("Host CPU model does not match required CPU "
+ "vendor %s or(and) model %s",
+ NULLSTR(cpu->vendor), NULLSTR(cpu->model));
+
+ if (failIncompatible) {
+ virReportError(VIR_ERR_CPU_INCOMPATIBLE,
+ _("Host CPU model does not match required CPU "
+ "vendor %s or(and) model %s"),
+ NULLSTR(cpu->vendor), NULLSTR(cpu->model));
+ return VIR_CPU_COMPARE_ERROR;
+ } else {
+ return VIR_CPU_COMPARE_INCOMPATIBLE;
+ }
+ }
return VIR_CPU_COMPARE_IDENTICAL;
}
--
2.20.1
4 years, 1 month
[PATCH] tests: cover disk, interface <backenddomain>
by Cole Robinson
There is present no XML test coverage for this.
Add genericxml parse + formatting coverage.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
.../device-backenddomain.xml | 30 +++++++++++++++++++
.../device-backenddomain.xml | 1 +
tests/genericxml2xmltest.c | 1 +
3 files changed, 32 insertions(+)
create mode 100644 tests/genericxml2xmlindata/device-backenddomain.xml
create mode 120000 tests/genericxml2xmloutdata/device-backenddomain.xml
diff --git a/tests/genericxml2xmlindata/device-backenddomain.xml b/tests/genericxml2xmlindata/device-backenddomain.xml
new file mode 100644
index 0000000000..8e89c7fec3
--- /dev/null
+++ b/tests/genericxml2xmlindata/device-backenddomain.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+ <name>foo</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backenddomain name='bar'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <interface type='bridge'>
+ <mac address='aa:bb:cc:dd:ee:ff'/>
+ <source bridge='br0'/>
+ <backenddomain name='foo'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/genericxml2xmloutdata/device-backenddomain.xml b/tests/genericxml2xmloutdata/device-backenddomain.xml
new file mode 120000
index 0000000000..f19471e3b5
--- /dev/null
+++ b/tests/genericxml2xmloutdata/device-backenddomain.xml
@@ -0,0 +1 @@
+../genericxml2xmlindata/device-backenddomain.xml
\ No newline at end of file
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index 102abfdec2..5110bfba86 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -233,6 +233,7 @@ mymain(void)
DO_TEST("launch-security-sev");
DO_TEST_DIFFERENT("cputune");
+ DO_TEST("device-backenddomain");
#define DO_TEST_BACKUP_FULL(name, intrnl) \
do { \
--
2.28.0
4 years, 1 month
[PATCH 0/1] qemu: Add support for free-page-reporting
by Nico Pache
gitlab issue: https://gitlab.com/libvirt/libvirt/-/issues/79
The virtio-balloon device now has the ability to report free pages
back to the hypervisor for reuse by other programs.
This kernel feature allows for more stable and resource friendly systems.
This feature is available in QEMU and is enabled with free-page-reporting=on
default virt setting should be off but the user should be able to enable it.
Nico Pache (1):
Optional free-page-reporting can be enabled/disabled for memballon
device of model 'virtio'.
docs/formatdomain.rst | 6 ++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 21 +++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 4 +++-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 5 +++++
src/qemu/qemu_validate.c | 7 +++++++
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
10 files changed, 51 insertions(+), 1 deletion(-)
--
2.18.4
4 years, 1 month
[PATCH v2 0/4] Add support for QEMU's 'fmode' and 'dmode'
by Brian Turek
This second version of the patch incorporates Peter Krempa's feedback
by tweaking a few things in the code and, more importantly, splitting
up the singular large patch into smaller patches.
Brian Turek (4):
qemu: capabilities: add QEMU_CAPS_FSDEV_CREATEMODE
qemu: add support for 'fmode' and 'dmode' options
qemu: add schema 'fmode' and 'dmode' options
qemu: add docs for 'fmode' and 'dmode' options
docs/formatdomain.rst | 12 ++++
docs/schemas/domaincommon.rng | 16 +++++
src/conf/domain_conf.c | 27 ++++++++
src/conf/domain_conf.h | 2 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 6 ++
src/qemu/qemu_validate.c | 18 ++++++
.../caps_2.10.0.aarch64.xml | 1 +
.../caps_2.10.0.ppc64.xml | 1 +
.../caps_2.10.0.s390x.xml | 1 +
.../caps_2.10.0.x86_64.xml | 1 +
.../caps_2.11.0.s390x.xml | 1 +
.../caps_2.11.0.x86_64.xml | 1 +
.../caps_2.12.0.aarch64.xml | 1 +
.../caps_2.12.0.ppc64.xml | 1 +
.../caps_2.12.0.s390x.xml | 1 +
.../caps_2.12.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 +
.../caps_3.0.0.riscv32.xml | 1 +
.../caps_3.0.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 +
.../caps_3.0.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 +
.../caps_3.1.0.x86_64.xml | 1 +
.../caps_4.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 +
.../caps_4.0.0.riscv32.xml | 1 +
.../caps_4.0.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 +
.../caps_4.0.0.x86_64.xml | 1 +
.../caps_4.1.0.x86_64.xml | 1 +
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
.../virtio-9p-createmode.x86_64-latest.args | 45 ++++++++++++++
.../qemuxml2argvdata/virtio-9p-createmode.xml | 58 ++++++++++++++++++
.../virtio-9p-createmode.x86_64-latest.xml | 61 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
46 files changed, 283 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-9p-createmode.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-9p-createmode.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-9p-createmode.x86_64-latest.xml
--
2.25.1
4 years, 1 month
[libvirt PATCH 1/2] esx: call freeaddrinfo earlier in esxUtil_ResolveHostname
by Pino Toscano
Call freeaddrinfo() as soon as @result is not needed anymore, i.e. right
after getnameinfo(); this avoids calling freeaddrinfo() in two branches.
Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
---
src/esx/esx_util.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 9100873326..555158f953 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -310,17 +310,15 @@ esxUtil_ResolveHostname(const char *hostname,
errcode = getnameinfo(result->ai_addr, result->ai_addrlen, ipAddress,
ipAddress_length, NULL, 0, NI_NUMERICHOST);
+ freeaddrinfo(result);
if (errcode != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Formatting IP address for host '%s' failed: %s"), hostname,
gai_strerror(errcode));
- freeaddrinfo(result);
return -1;
}
- freeaddrinfo(result);
-
return 0;
}
--
2.26.2
4 years, 1 month
[PATCH] docs/submitting-patches: add reference to DCO
by Mauro Matteo Cascella
Signed-off-by: Mauro Matteo Cascella <mcascell(a)redhat.com>
---
docs/submitting-patches.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/submitting-patches.rst b/docs/submitting-patches.rst
index 17b072655d..3ce8b347a0 100644
--- a/docs/submitting-patches.rst
+++ b/docs/submitting-patches.rst
@@ -22,7 +22,8 @@ patch. However, the usual workflow of libvirt developer is:
(hack, committing any changes along the way)
More hints on compiling can be found `here <compiling.html>`__.
-When you want to post your patches:
+Make sure to `sign off <hacking.html#developer-certificate-of-origin>`__
+your commit(s). When you want to post your patches:
::
--
2.26.2
4 years, 1 month
[python-libvirt] RFC:PEP 484 type annotation - how to continue
by Philipp Hahn
Hello,
currently my Merge Quests
<https://gitlab.com/libvirt/libvirt-python/-/merge_requests/9> is stuck
because there are some open technical discussions:
1. The Python binding consists of two layers:
- libvirtmod* is the low-level C-like API, which mostly is just a
thin wrapper around the C-library. It is generated from the API.xml files
- The high-level libvirt* modules, providing an object oriented API,
which is also generated from the API.xml files.
In both cases there are many exceptions defines via
libvirt*-override-api.xml or coded in generator.py:
- skip_impl: Generate Python code, but skip C implementation
- custom_function: Generate neither C nor Python code - hand crafted code
- skip_function: Generate neither C nor Python code - not used at all
- function_skip_python_impl: Generate C code, but skip python impl
Previously the functions listed in "skip_impl" were also duplicated in
the "libvirt-*override-api.xml" files, which is somehow hard to
maintain. With d19699e48ce9c17481f94b4dc0715e18e05d5adb I removed all
those names from "skip_impl", which are also listed in the overrides and
added code to add them back when "generator.py" is invoked.
For this to work I had to change several "files" attributes to start
with "python", which looks okay to me, but still would like to get verified.
2. The low-level library works mostly with bytes, but the high-level
Python API uses nested Lists, Tuples and Dicts. To get most out of the
Python static type annotations the input and output parameters should be
modled in as much detail as possible.
This requires to store those types somewhere. My current
46592e28124858ed863bceba65c3dafa2bbb02cd adds some often used types to
generator.py and then references them from the overrides.xml:
> + 'PyListSecret': ('', 'List["virSecret"]', '', ''),
> + 'PyDictAny': ('', 'Dict[str, Any]', '', ''),
> + <return type='PyListSecret' info='the list of secrets or None in case of error'/>
This still is very painful as there are many "used-once" types, which
still must be declared and used in two places.
So far the "return" type was used for the "C" type and currently I
mis-use it for referencing it for my Python types. This doesn't look
right, so I would prefer adding a new attribute which can be used to
override the Python type.
This also would probably nicely fit with functions like
"virDomainOpenConsole", when "dev_name" is optional and can be "None",
which the current type hint requires a "string".
Is extending the libvirt*-override-api.xml files okay or must this be
coordinated with the other parts of the project?
Thank you for your time
Philipp Hahn
--
Philipp Hahn
Open Source Software Engineer
Univention GmbH
be open.
Mary-Somerville-Str. 1
D-28359 Bremen
📞 +49-421-22232-57
🖶 +49-421-22232-99
✉️ hahn(a)univention.de
🌐 https://www.univention.de/
Geschäftsführer: Peter H. Ganten
HRB 20755 Amtsgericht Bremen
Steuer-Nr.: 71-597-02876
4 years, 1 month
[libvirt PATCH] rpm: drop ia64, sparc64 and alpha architectures
by Daniel P. Berrangé
None of these arches are relevant to current Fedora or RHEL distros.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
libvirt.spec.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index aa2bc84be9..682d43c290 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -97,8 +97,8 @@
# Finally set the OS / architecture specific special cases
-# Xen is available only on i386 x86_64 ia64
-%ifnarch %{ix86} x86_64 ia64
+# Xen is available only on i386 x86_64
+%ifnarch %{ix86} x86_64
%define with_libxl 0
%endif
@@ -438,7 +438,7 @@ Requires: iproute-tc
%endif
Requires: polkit >= 0.112
-%ifarch %{ix86} x86_64 ia64
+%ifarch %{ix86} x86_64
# For virConnectGetSysinfo
Requires: dmidecode
%endif
@@ -1261,7 +1261,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
# Copied into libvirt-docs subpackage eventually
mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs
-%ifarch %{power64} s390x x86_64 ia64 alpha sparc64
+%ifarch %{power64} s390x x86_64
mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \
$RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes-64.stp
--
2.26.2
4 years, 1 month
[PATCH v2 0/7] virbitmaptest: Refactor and modernize
by Peter Krempa
This was split out from my series refactoring the virbitmap util module
to address review feedback.
Patches 1-5 are new, patches 6-7 were already part of the refactor but
needed to be modified to fit on top of the changes needed to comply with
review requirements.
Peter Krempa (7):
virbitmaptest: Split up test12
virbitmaptest: Split up test4
virbitmaptest: Use separate output strings in 'test5'
virbitmaptest: Turn 'TEST_MAP' macro into a helper function
virbitmaptest: Refactor checks in 'test6'
virbitmaptest: Use g_auto(free) for cleanup
virbitmaptest: Remove unnecessary error/cleanup labels
tests/virbitmaptest.c | 512 ++++++++++++++++++------------------------
1 file changed, 224 insertions(+), 288 deletions(-)
--
2.26.2
4 years, 1 month
[libvirt PATCH 0/9] Make unknown XML elements fail CPU comparison
by Tim Wiederhake
We currently ignore unknown elements in the CPU XML description, e.g.
with virsh cpu-compare and hypervisor-cpu-compare. This makes
'<cpu><faeture name=3D"..."/></cpu>' (note the typo in "faeture")
semantically identic to '<cpu/>'. No error is reported.
This series adds checks for unrecognized attributes and elements in
the "<cpu>" element, catching this kind of mistake.
V1: https://www.redhat.com/archives/libvir-list/2020-September/msg00933.html
Changed:
* Factored out Schema defintion of different cpu elements
* Performing validation against actual schema
* Add "--validate" option to virsh [hypervisor-]cpu-compare to opt-in to vali=
dation
* Drive-by: Unify quotation style in docs/schemas/*
Tim Wiederhake (9):
schema: Unify apostrophe and quotation mark usage
schema: Move host cpu definition to cputypes.rng
schema: Move guest cpu definition to cputypes.rng
schema: Add schema for guest or host cpu definition
util: Allow validation for single XML node
cpu: Validate XML
virsh: Add "validate" argument to [hypervisor-]cpu-compare
tests: cpu: Allow passing flags to cpuTestLoadXML
tests: Add tests for unknown elements and attributes in cpu defintion
docs/schemas/basictypes.rng | 82 +--
docs/schemas/capability.rng | 466 ++++++---------
docs/schemas/cpu.rng | 12 +
docs/schemas/cputypes.rng | 117 +++-
docs/schemas/domain.rng | 10 +-
docs/schemas/domainbackup.rng | 178 +++---
docs/schemas/domaincaps.rng | 236 ++++----
docs/schemas/domaincheckpoint.rng | 62 +-
docs/schemas/domaincommon.rng | 431 +++++++-------
docs/schemas/domainsnapshot.rng | 104 ++--
docs/schemas/interface.rng | 6 +-
docs/schemas/meson.build | 1 +
docs/schemas/network.rng | 44 +-
docs/schemas/networkcommon.rng | 26 +-
docs/schemas/networkport.rng | 6 +-
docs/schemas/nodedev.rng | 464 +++++++--------
docs/schemas/nwfilter.rng | 32 +-
docs/schemas/nwfilterbinding.rng | 4 +-
docs/schemas/secret.rng | 70 +--
docs/schemas/storagecommon.rng | 110 ++--
docs/schemas/storagepool.rng | 584 +++++++++----------
docs/schemas/storagepoolcaps.rng | 64 +-
docs/schemas/storagevol.rng | 150 ++---
include/libvirt/libvirt-host.h | 1 +
src/bhyve/bhyve_driver.c | 7 +-
src/conf/cpu_conf.c | 28 +-
src/conf/cpu_conf.h | 6 +-
src/conf/domain_conf.c | 3 +-
src/cpu/cpu.c | 5 +-
src/cpu/cpu.h | 3 +-
src/libxl/libxl_driver.c | 7 +-
src/qemu/qemu_domain.c | 5 +-
src/qemu/qemu_driver.c | 18 +-
src/qemu/qemu_migration_cookie.c | 3 +-
src/util/virxml.c | 15 +
src/util/virxml.h | 6 +
tests/cputest.c | 52 +-
tests/cputestdata/x86_64-bogus-attribute.xml | 2 +
tests/cputestdata/x86_64-bogus-element.xml | 3 +
tools/virsh-host.c | 14 +
40 files changed, 1773 insertions(+), 1664 deletions(-)
create mode 100644 docs/schemas/cpu.rng
create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml
create mode 100644 tests/cputestdata/x86_64-bogus-element.xml
--=20
2.26.2
4 years, 1 month