[PATCH 0/6] Fix double free in URI alias lookup and fix misleading error with libvirtd
by Peter Krempa
When libvirtd is built without a driver we report a terrible error
message which doesn't really point to what's happening.
Peter Krempa (6):
virConnectOpenInternal: Avoid double free() when alias is an invalid
URI
virConnectOpenInternal: Switch to automatic memory cleanup
virConnectOpenInternal: Remove 'failed' label
remote: remoteOpenConn: Use virConnectOpenAuth instead of
virConnectOpen(ReadOnly)
Introduce VIR_CONNECT_NO_REMOTE
remote: Don't attempt remote connection from libvirtd
include/libvirt/libvirt-host.h | 2 +
src/libvirt.c | 98 ++++++++++++++---------------
src/remote/remote_daemon_dispatch.c | 15 +++--
3 files changed, 62 insertions(+), 53 deletions(-)
--
2.37.1
2 years, 2 months
[PATCH 0/5] Various cleanups to decrease amount of stack allocated buffers
by Peter Krempa
The common theme is the attempt to decrease the use of stack allocated
buffers. In few cases it's coupled with outher cleanups too.
Most patches are standalone and can be individually applied. The last
patch is also optional but can be applied only if the fixes before that
are applied too.
Peter Krempa (5):
lxc: virLXCProcessReadLogOutput: Automatically close FD
lxc: process: Rework reading errors from the log file
util: netdev: Dynamically allocate 'struct nlattr' in
virNetDevSwitchdevFeature
remote: dispatch: Allocate 'virDomainDef' in ACL helpers dynamically
build: Decrease maximum stack frame size to 2048
meson.build | 2 +-
src/lxc/lxc_process.c | 100 ++++++++++++++++------------
src/remote/remote_daemon_dispatch.c | 17 +++--
src/util/virnetdev.c | 2 +-
4 files changed, 66 insertions(+), 55 deletions(-)
--
2.37.1
2 years, 2 months
[PATCH 0/8] qemu: Fix regression with non-shared storage migration and clean out more dead code
by Peter Krempa
Patch 1 fixes regression caused by improper refactor from the
pre-blockdev removal series. The rest are cleanups noticed while
investigating the code.
Peter Krempa (8):
qemu: migration: Fix setup of non-shared storage migration in
qemuMigrationSrcBeginPhase
NEWS: Mention that non-shared storage migration was broken in
libvirt-8.7
qemu: migration: Always assume support for QEMU_CAPS_NBD_SERVER
qemu: capabilities: Retire QEMU_CAPS_NBD_SERVER
qemu: migration: Don't attempt to fall back to old-style storage
migration
qemu: monitor: Drop support for old-style non-shared storage migration
qemu: migration: Remove QEMU_MONITOR_MIGRATE_BACKGROUND
qemu: monitor: Renumber QEMU_MONITOR_MIGRATE_RESUME
NEWS.rst | 6 ++
src/qemu/qemu_capabilities.c | 3 +-
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_migration.c | 78 ++++++++-----------
src/qemu/qemu_monitor.h | 5 +-
src/qemu/qemu_monitor_json.c | 7 +-
.../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 -
.../qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 -
.../caps_5.1.0.x86_64.xml | 1 -
.../caps_5.2.0.aarch64.xml | 1 -
.../qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 -
.../caps_5.2.0.riscv64.xml | 1 -
.../qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 -
.../caps_5.2.0.x86_64.xml | 1 -
.../caps_6.0.0.aarch64.xml | 1 -
.../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 -
.../caps_6.0.0.x86_64.xml | 1 -
.../caps_6.1.0.x86_64.xml | 1 -
.../caps_6.2.0.aarch64.xml | 1 -
.../qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 -
.../caps_6.2.0.x86_64.xml | 1 -
.../caps_7.0.0.aarch64.xml | 1 -
.../qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 -
.../caps_7.0.0.x86_64.xml | 1 -
.../caps_7.1.0.x86_64.xml | 1 -
tests/qemumonitorjsontest.c | 4 +-
33 files changed, 42 insertions(+), 89 deletions(-)
--
2.37.1
2 years, 2 months
Internal disk-only snapshots in qemu domain
by Or Ozeri
Hi,
We are considering the following use-case of libvirt's domain snapshot (and revert) feature:
1. Domain is qemu
2. Snapshot type is disk-only (VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
3. Snapshot location is internal (VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL)
4. All of the VM disks are:
* Network type (VIR_STORAGE_TYPE_NETWORK)
* RBD protocol (VIR_STORAGE_NET_PROTOCOL_RBD)
* Raw format (VIR_STORAGE_FILE_RAW)
5. VM can be either active or inactive
We want to extend libvirt to support this use-case.
Consider the following changes:
1. For the inactive VM case, libvirt currently calls "qemu-img snapshot" for taking a snapshot, as well as reverting (adding "-a" to qemu-img).
The same would also work for our-use case, as basically the same qemu-img command would work for RBD disks as well (using rbd:poolname/imagename as the filename).
So basically we need to reuse code from qemuDomainSnapshotForEachQcow2Raw.
2. For the active VM case, we can re-use code from qemuDomainSnapshotCreateActiveExternal, but call qemu's "snapshot_blkdev_internal" instead of the current "snapshot_blkdev".
This would work for RBD disks, but more generally for any qemu block driver which implements "bdrv_snapshot_create".
BTW it seems to me that if you try to take an internal snapshot of just the disks, you will actually get an external snapshot? Or is there some place in the code which validates and fails this case?
Anyhow, I would really appreciate any feedback or thoughts.
Thanks,
Or
2 years, 2 months
kvm ram in live migratiom
by Ignazio Cassano
Hello, I am using openstack rdo with kvm libvirt.
Live migration is very slow when the vm is using ram intensively. If I
migrate a vm that has been running on a host for a few days, it takes
several minutes to migrate the memory. After the first migration, I
immediately try another one on the same vm, it takes very little. I think
it's due to the fragmentation of the pages: is there any remedy?
Thanks
Ignazio
2 years, 2 months
[PATCH] Revert "conf: clean up memory containing secrets before freeing"
by Peter Krempa
Adding supposedly secure cleanup for secrets in anything related to the
XML parser is pointless because there are multiple other un-sanitized
copies of the full XML and the XML parser state at the very least.
Similarly in case RPC was used to transport the XML the RPC buffers are
not sanitized.
Additionally this patch was incomplete as it didn't sanitize the the
password in the cleanup function for virDomainGraphicsAuthDef.
This reverts commit 51f8130d78fde3201b49c02b7095ff918b6e658a.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3d1bf18c6c..406c348a00 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -60,7 +60,6 @@
#include "virdomainsnapshotobjlist.h"
#include "virdomaincheckpointobjlist.h"
#include "virutil.h"
-#include "virsecureerase.h"
#include "virdomainjob.h"
#define VIR_FROM_THIS VIR_FROM_DOMAIN
@@ -10862,7 +10861,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse password validity time '%s', expect YYYY-MM-DDTHH:MM:SS"),
validTo);
- virSecureEraseString(def->passwd);
VIR_FREE(def->passwd);
return -1;
}
--
2.37.1
2 years, 2 months
[PATCH 0/3] Fix some coding issues
by Jiacheng Jiang
From: jiangjiacheng <jiangjiacheng(a)huawei.com>
*** BLURB HERE ***
jiangjiacheng (3):
conf: clean up memory containing secrets before freeing
remote: remove unnecessary return value and if branch
Fix some coding style issues
src/conf/domain_conf.c | 4 +++-
src/remote/remote_daemon.c | 6 +-----
src/remote/remote_daemon_config.c | 4 +---
src/remote/remote_daemon_config.h | 2 +-
src/rpc/virnetserverclient.c | 28 ++++++++++++++--------------
5 files changed, 20 insertions(+), 24 deletions(-)
--
2.33.0
2 years, 2 months
[PATCH v2] cpu_map: Introduce Fujitsu a64fx
by Liu Yiding
Add Fujitsu a64fx as a supported cpu model.
Signed-off-by: Liu Yiding <liuyd.fnst(a)fujitsu.com>
---
v2 of:
https://listman.redhat.com/archives/libvir-list/2022-August/234040.html
diff to v1:
- Change title.
- Unify model and vendor spelling.
---
src/cpu_map/arm_a64fx.xml | 6 ++++++
src/cpu_map/arm_vendors.xml | 1 +
src/cpu_map/index.xml | 3 +++
src/cpu_map/meson.build | 1 +
4 files changed, 11 insertions(+)
create mode 100644 src/cpu_map/arm_a64fx.xml
diff --git a/src/cpu_map/arm_a64fx.xml b/src/cpu_map/arm_a64fx.xml
new file mode 100644
index 0000000000..5b53580df4
--- /dev/null
+++ b/src/cpu_map/arm_a64fx.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='a64fx'>
+ <vendor name='Fujitsu'/>
+ <pvr value='0x001'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_vendors.xml b/src/cpu_map/arm_vendors.xml
index 4465463b5b..92d10565f4 100644
--- a/src/cpu_map/arm_vendors.xml
+++ b/src/cpu_map/arm_vendors.xml
@@ -3,6 +3,7 @@
<vendor name='Broadcom' value='0x42'/>
<vendor name='Cavium' value='0x43'/>
<vendor name='DigitalEquipment' value='0x44'/>
+ <vendor name='Fujitsu' value='0x46'/>
<vendor name='HiSilicon' value='0x48'/>
<vendor name='Infineon' value='0x49'/>
<vendor name='Freescale' value='0x4D'/>
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 351c2ae4fa..d533a28865 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -104,6 +104,9 @@
<!-- Cavium-based CPU models -->
<include filename='arm_ThunderX299xx.xml'/>
+ <!-- Fujitsu-based CPU models -->
+ <include filename='arm_a64fx.xml'/>
+
<!-- Hisilicon-based CPU models -->
<include filename='arm_Kunpeng-920.xml'/>
diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build
index 99815981b5..99264289e2 100644
--- a/src/cpu_map/meson.build
+++ b/src/cpu_map/meson.build
@@ -1,4 +1,5 @@
cpumap_data = [
+ 'arm_a64fx.xml',
'arm_cortex-a53.xml',
'arm_cortex-a57.xml',
'arm_cortex-a72.xml',
--
2.34.1
2 years, 2 months
[PATCH] qemu_driver: Fix order of arguments in qemuDomainGetStatsCpuProc()
by Michal Privoznik
Just before pushing my earlier commit I've switch order of two
arguments of virProcessGetStatInfo() (as suggested in review).
However, I forgot to swap the arguments in
qemuDomainGetStatsCpuProc() which leads to userTime and sysTime
being swapped.
Fixes: 044b8744d65f8571038f85685b3c4b241162977b
Reported-by: Daniel P. Berrangé <berrange(a)redhat.com>
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed as trivial.
src/qemu/qemu_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c7cca64001..a3f8d8baf5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17771,10 +17771,10 @@ qemuDomainGetStatsCpuProc(virDomainObj *vm,
virTypedParamList *params)
{
unsigned long long cpuTime = 0;
- unsigned long long sysTime = 0;
unsigned long long userTime = 0;
+ unsigned long long sysTime = 0;
- if (virProcessGetStatInfo(&cpuTime, &sysTime, &userTime,
+ if (virProcessGetStatInfo(&cpuTime, &userTime, &sysTime,
NULL, NULL, vm->pid, 0) < 0) {
/* ignore error */
return 0;
--
2.35.1
2 years, 2 months
[PATCH] qemu: Don't report error from domblkinfo if vm is inactive
by huangy81@chinatelecom.cn
From: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
Libvirt logs and reports error when executing domblkinfo if vm
configured rbd storage and in inactive state.
The steps to reproduce the problem:
1. define and start domain with its storage configured rbd disk,
and corresponding disk label is 'vda'.
2. set vm in inactive state.
3. call 'virsh domblklinfo' as the following and problem reproduced.
$ virsh domblkinfo vm1 vda
error: internal error: missing storage backend for network files using
rbd protocol
Meanwhile, libvirtd log message also report the same error.
To fix this, validate the disk type if vm is inactive before
refreshing capacity and allocation limits of a given storage source
in qemuDomainGetBlockInfo in advance, if storage source type is
VIR_STORAGE_TYPE_NETWORK and net protocol is
VIR_STORAGE_NET_PROTOCAOL_RBD, set info to 0 like 'domblkinfo --all'
command does and return directly.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1724808
Signed-off-by: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
Signed-off-by: Pengcheng Deng <dengpc12(a)chinatelecom.cn>
---
src/qemu/qemu_driver.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c7cca64..bfe1fa2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11118,6 +11118,19 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
/* for inactive domains we have to peek into the files */
if (!virDomainObjIsActive(vm)) {
+ /* for rbd protocol, virStorageFileBackend not loaded if vm is inactive,
+ * so generate 0 based info like 'domblkinfo --all' does and return directly
+ * */
+ if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_NETWORK &&
+ disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
+ info->capacity = 0;
+ info->allocation = 0;
+ info->physical = 0;
+
+ ret = 0;
+ goto endjob;
+ }
+
if ((qemuStorageLimitsRefresh(driver, cfg, vm, disk->src, false)) < 0)
goto endjob;
--
1.8.3.1
2 years, 2 months