[PATCH] spec: change gettext requires to gettext-runtime for F37
by Cole Robinson
From: Jens Petersen <petersen(a)redhat.com>
See https://fedoraproject.org/wiki/Changes/GettextRuntimeSubpackage
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
libvirt.spec.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 5408aa3154..d946a8da48 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -471,7 +471,11 @@ Requires: dbus
# For uid creation during pre
Requires(pre): shadow-utils
# Needed by /usr/libexec/libvirt-guests.sh script.
+%if 0%{?fedora} >= 37
+Requires: gettext-runtime
+%else
Requires: gettext
+%endif
# Ensure smooth upgrades
Obsoletes: libvirt-admin < 7.3.0
--
2.37.3
2 years, 1 month
[PATCH 0/3] fix some issue in concurrency scenarios
by Jiang Jiacheng
Jiang Jiacheng (3):
qemu: Init address before qemuProcessShutdownOrReboot during reconnect
process
qemu: get the stackManager lock before getting nested lock
qemu: back up the path in qemuMonitorOpen
src/qemu/qemu_conf.c | 6 +++++-
src/qemu/qemu_driver.c | 3 +++
src/qemu/qemu_monitor.c | 5 ++++-
src/qemu/qemu_process.c | 10 +++++-----
4 files changed, 17 insertions(+), 7 deletions(-)
--
2.33.0
2 years, 1 month
[PATCH] Fix race condition when detaching a device
by Pierre LIBEAU
Qemu reply to libvirt "DeviceNotFound" and libvirt didn't clean on the
side the live configuration.
qemuMonitorDelDevice() return -2 to qemuDomainDeleteDevice() and during
this action in qemuDomainDetachDeviceLive() the remove is never call.
Ref #359
Signed-off-by: Pierre LIBEAU <pierre.libeau(a)corp.ovh.com>
---
src/qemu/qemu_hotplug.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9b508dc8f0..52a14a4476 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -93,6 +93,8 @@ qemuDomainResetDeviceRemoval(virDomainObj *vm);
*
* Returns: 0 on success,
* -1 otherwise.
+ * -2 device does not exist in qemu, but it still
+ * exists in libvirt
*/
static int
qemuDomainDeleteDevice(virDomainObj *vm,
@@ -124,7 +126,6 @@ qemuDomainDeleteDevice(virDomainObj *vm,
* domain XML is queried right after detach API the
* device would still be there. */
VIR_DEBUG("Detaching of device %s failed and no event arrived", alias);
- rc = 0;
}
}
@@ -6055,7 +6056,11 @@ qemuDomainDetachDeviceLive(virDomainObj *vm,
if (!async)
qemuDomainMarkDeviceForRemoval(vm, info);
- if (qemuDomainDeleteDevice(vm, info->alias) < 0) {
+ int rc;
+ rc = qemuDomainDeleteDevice(vm, info->alias);
+ if (rc < 0) {
+ if (rc == -2)
+ ret = qemuDomainRemoveDevice(driver, vm, &detach);
if (virDomainObjIsActive(vm))
qemuDomainRemoveAuditDevice(vm, &detach, false);
goto cleanup;
--
2.37.3
2 years, 1 month
[PATCH v3] cpu_map: Introduce Neoverse N1/N2/V1
by Zhenyu Zhang
Add Neoverse N1/N2/V1 as a supported cpu model.
Signed-off-by: Zhenyu Zhang <zhenyzha(a)redhat.com>
v2: https://listman.redhat.com/archives/libvir-list/2022-September/234512.html
v1: https://listman.redhat.com/archives/libvir-list/2022-September/234294.html
Changelog
=========
v3:
* Remove the Ampere vendor from arm_vendors (Martin)
* Change Neoverse N1/N2/V1 vendor from Ampere to ARM (Martin)
v2:
* Introduce Neoverse N1/N2/V1 (Martin)
* Corrected ampere vendor value (Martin)
---
src/cpu_map/arm_Neoverse-N1.xml | 6 ++++++
src/cpu_map/arm_Neoverse-N2.xml | 6 ++++++
src/cpu_map/arm_Neoverse-V1.xml | 6 ++++++
src/cpu_map/index.xml | 3 +++
src/cpu_map/meson.build | 3 +++
5 files changed, 24 insertions(+)
create mode 100644 src/cpu_map/arm_Neoverse-N1.xml
create mode 100644 src/cpu_map/arm_Neoverse-N2.xml
create mode 100644 src/cpu_map/arm_Neoverse-V1.xml
diff --git a/src/cpu_map/arm_Neoverse-N1.xml b/src/cpu_map/arm_Neoverse-N1.xml
new file mode 100644
index 0000000000..b83b8af8cc
--- /dev/null
+++ b/src/cpu_map/arm_Neoverse-N1.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='Neoverse-N1'>
+ <vendor name='ARM'/>
+ <pvr value='0xd0c'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_Neoverse-N2.xml b/src/cpu_map/arm_Neoverse-N2.xml
new file mode 100644
index 0000000000..cba2c6ca16
--- /dev/null
+++ b/src/cpu_map/arm_Neoverse-N2.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='Neoverse-N2'>
+ <vendor name='ARM'/>
+ <pvr value='0xd49'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_Neoverse-V1.xml b/src/cpu_map/arm_Neoverse-V1.xml
new file mode 100644
index 0000000000..a449322952
--- /dev/null
+++ b/src/cpu_map/arm_Neoverse-V1.xml
@@ -0,0 +1,6 @@
+<cpus>
+ <model name='Neoverse-V1'>
+ <vendor name='ARM'/>
+ <pvr value='0xd40'/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index d533a28865..deae92552f 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -97,6 +97,9 @@
<include filename='arm_cortex-a53.xml'/>
<include filename='arm_cortex-a57.xml'/>
<include filename='arm_cortex-a72.xml'/>
+ <include filename='arm_Neoverse-N1.xml'/>
+ <include filename='arm_Neoverse-N2.xml'/>
+ <include filename='arm_Neoverse-V1.xml'/>
<!-- Qualcomm-based CPU models -->
<include filename='arm_Falkor.xml'/>
diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build
index 99264289e2..55c3703006 100644
--- a/src/cpu_map/meson.build
+++ b/src/cpu_map/meson.build
@@ -7,6 +7,9 @@ cpumap_data = [
'arm_FT-2000plus.xml',
'arm_features.xml',
'arm_Kunpeng-920.xml',
+ 'arm_Neoverse-N1.xml',
+ 'arm_Neoverse-N2.xml',
+ 'arm_Neoverse-V1.xml',
'arm_Tengyun-S2500.xml',
'arm_ThunderX299xx.xml',
'arm_vendors.xml',
--
2.31.1
2 years, 1 month
[RFC 0/1] Check for pid re-use before killing domain process
by manish.mishra
Libvirt stores pid of domain(e.g Qemu) process when a domain process is started
and same pid is used while destroying domain process. There is always a race
possible that before libvirt tries to kill domain process, actual domain process
is already dead and same pid is used for another process. In that case libvirt
may kill an innocent process.
With this patch we store start time of domain process when domain is started and
we match stime again while killing domain process if it does not match we can
assume domain process is already dead.
This patch series tries to create a generic interface which can be used for
non-domain processes too, even though initial patch series handles pid re-use
for domain process only.
Proposed changes:
1. While creating a daemon process through virExec, create a file which stores
start time of the process, along with the pid file. A Separate file for start
time is created instead of storing start time too in *.pid file so that
existing external user of <domain-id>*.pid file does not break.
2. Persist stime in domstatus in domain xml.
3. In virProcessKill before sending signal to process also verify start time of
process. For sending signal to process pidfd_send_signal is used avoid any
race between verifying start time and sending signal. Following steps are
taken while killing a process.
3.1 Open a pid-fd for given pid with pidfd_open.
3.2 Verify start time of pid with stored start time. If start time does not
match, assume process is already dead.
3.3 Send signal to pid-fd with pidfd_send_signal. Even if pid was re-used
just after verifying star time, signal will be sent to a pidfd instance
which was created before verifying timestamp.
manish.mishra (1):
Check for pid re-use before killing qemu process
src/conf/domain_conf.c | 14 ++-
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 7 ++
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_process.c | 49 ++++++--
src/util/vircommand.c | 37 ++++++
src/util/vircommand.h | 3 +
src/util/virpidfile.c | 113 +++++++++++++-----
src/util/virpidfile.h | 17 +++
src/util/virprocess.c | 73 ++++++++++-
src/util/virprocess.h | 8 ++
.../qemustatusxml2xmldata/backup-pull-in.xml | 2 +-
.../blockjob-blockdev-in.xml | 2 +-
.../blockjob-mirror-in.xml | 2 +-
.../migration-in-params-in.xml | 2 +-
.../migration-out-nbd-bitmaps-in.xml | 2 +-
.../migration-out-nbd-in.xml | 2 +-
.../migration-out-nbd-out.xml | 2 +-
.../migration-out-nbd-tls-in.xml | 2 +-
.../migration-out-nbd-tls-out.xml | 2 +-
.../migration-out-params-in.xml | 2 +-
tests/qemustatusxml2xmldata/modern-in.xml | 2 +-
tests/qemustatusxml2xmldata/upgrade-in.xml | 2 +-
tests/qemustatusxml2xmldata/upgrade-out.xml | 2 +-
.../qemustatusxml2xmldata/vcpus-multi-in.xml | 2 +-
25 files changed, 295 insertions(+), 56 deletions(-)
--
2.22.3
2 years, 1 month
[PATCH] capabilities: use g_autofree in capabilities.c
by Jiang Jiacheng
Use g_autofree in capabilities.c for some pointers still using manual cleanup,
and remove unnecessary cleanup.
Signed-off-by: Jiang Jiacheng <jiangjiacheng(a)huawei.com>
---
src/conf/capabilities.c | 44 +++++++++++++----------------------------
1 file changed, 14 insertions(+), 30 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 1a7ebf4a13..e56049687b 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1489,15 +1489,14 @@ virCapabilitiesGetNUMADistances(int node,
virNumaDistance **distancesRet,
int *ndistancesRet)
{
- virNumaDistance *tmp = NULL;
+ g_autofree virNumaDistance *tmp = NULL;
int tmp_size = 0;
- int ret = -1;
- int *distances = NULL;
+ g_autofree int *distances = NULL;
int ndistances = 0;
size_t i;
if (virNumaGetDistances(node, &distances, &ndistances) < 0)
- goto cleanup;
+ return -1;
if (!distances) {
*distancesRet = NULL;
@@ -1521,11 +1520,8 @@ virCapabilitiesGetNUMADistances(int node,
*ndistancesRet = tmp_size;
*distancesRet = g_steal_pointer(&tmp);
tmp_size = 0;
- ret = 0;
- cleanup:
- VIR_FREE(distances);
- VIR_FREE(tmp);
- return ret;
+
+ return 0;
}
static int
@@ -1533,13 +1529,12 @@ virCapabilitiesGetNUMAPagesInfo(int node,
virCapsHostNUMACellPageInfo **pageinfo,
int *npageinfo)
{
- int ret = -1;
- unsigned int *pages_size = NULL;
- unsigned long long *pages_avail = NULL;
+ g_autofree unsigned int *pages_size = NULL;
+ g_autofree unsigned long long *pages_avail = NULL;
size_t npages, i;
if (virNumaGetPages(node, &pages_size, &pages_avail, NULL, &npages) < 0)
- goto cleanup;
+ return -1;
*pageinfo = g_new0(virCapsHostNUMACellPageInfo, npages);
*npageinfo = npages;
@@ -1549,12 +1544,7 @@ virCapabilitiesGetNUMAPagesInfo(int node,
(*pageinfo)[i].avail = pages_avail[i];
}
- ret = 0;
-
- cleanup:
- VIR_FREE(pages_avail);
- VIR_FREE(pages_size);
- return ret;
+ return 0;
}
@@ -1685,7 +1675,7 @@ static int
virCapabilitiesHostNUMAInitFake(virCapsHostNUMA *caps)
{
virNodeInfo nodeinfo;
- virCapsHostNUMACellCPU *cpus;
+ g_autofree virCapsHostNUMACellCPU *cpus;
int ncpus;
int n, s, c, t;
int id, cid;
@@ -1741,7 +1731,6 @@ virCapabilitiesHostNUMAInitFake(virCapsHostNUMA *caps)
error:
for (; cid >= 0; cid--)
virBitmapFree(cpus[cid].siblings);
- VIR_FREE(cpus);
return -1;
}
@@ -1925,7 +1914,7 @@ static int
virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
{
int n;
- virCapsHostNUMACellCPU *cpus = NULL;
+ g_autofree virCapsHostNUMACellCPU *cpus = NULL;
int ret = -1;
int ncpus = 0;
int max_node;
@@ -1989,7 +1978,6 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
cleanup:
virCapabilitiesClearHostNUMACellCPUTopology(cpus, ncpus);
- VIR_FREE(cpus);
return ret;
}
@@ -2034,22 +2022,18 @@ virCapabilitiesHostNUMANewHost(void)
int
virCapabilitiesInitPages(virCaps *caps)
{
- int ret = -1;
- unsigned int *pages_size = NULL;
+ g_autofree unsigned int *pages_size = NULL;
size_t npages;
if (virNumaGetPages(-1 /* Magic constant for overall info */,
&pages_size, NULL, NULL, &npages) < 0)
- goto cleanup;
+ return -1;
caps->host.pagesSize = g_steal_pointer(&pages_size);
caps->host.nPagesSize = npages;
npages = 0;
- ret = 0;
- cleanup:
- VIR_FREE(pages_size);
- return ret;
+ return 0;
}
--
2.33.0
2 years, 1 month
[libvirt PATCH v2 0/2] conf: fix handling of missing CPU cache info in sysfs
by Daniel P. Berrangé
Changed in v2:
- Introduce g_autoptr support for virCapsHostCacheBank struct
Daniel P. Berrangé (2):
conf: define autoptr func for virCapsHostCacheBankFree
conf: skip resource cache init if sysfs files are missing
src/conf/capabilities.c | 90 +++++++++++++++++++++++++----------------
src/conf/capabilities.h | 3 ++
2 files changed, 58 insertions(+), 35 deletions(-)
--
2.37.3
2 years, 1 month
[PATCH] ci: potfiles: Add 'variables' to definition
by Peter Krempa
The 'potfiles' job is lacking the 'variables' section which defines the
'NAME' variable used by the 'image' property resulting in the 'potfiles'
job failing with:
Pulling docker image registry.gitlab.com/libvirt/libvirt/ci-:latest ...
WARNING: Failed to pull image with policy "always": invalid reference format (manager.go:235:0s)
ERROR: Job failed: failed to pull image "registry.gitlab.com/libvirt/libvirt/ci-:latest" with specified policies [always]: invalid reference format (manager.go:235:0s)
Fixes: 491d918502e50bf15c75d183bb41e3c0de5a0e1b
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.gitlab-ci.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c05155ddd4..1b72ebc493 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -138,6 +138,8 @@ codestyle_local_env:
potfile:
image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/libvirt/ci-$NAME:latest
stage: builds
+ variables:
+ NAME: almalinux-8
before_script:
- cat /packages.txt
needs:
--
2.37.3
2 years, 1 month
[libvirt PATCH] conf: skip resource cache init if sysfs files are missing
by Daniel P. Berrangé
On aarch64 the 'id' file is not present for CPU cache information in
sysfs. This causes the local stateful hypervisor drivers to fail to
initialize capabilities:
virStateInitialize:657 : Initialisation of cloud-hypervisor state driver failed: no error
The 'no error' is because the 'virFileReadValueNNN' methods return
ret==-2, with no error raised, when the requeted file does not exist.
None of the callers were checking for this scenario when populating
capabilities. The most graceful way to handle this is to skip the
cache bank in question. This fixes failure to launch libvirt drivers
on certain aarch64 hardware.
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/389
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/conf/capabilities.c | 57 ++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 15 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 1a7ebf4a13..ae63515fd3 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -2184,6 +2184,7 @@ virCapabilitiesInitCaches(virCaps *caps)
g_autofree char *type = NULL;
int kernel_type;
unsigned int level;
+ int err;
if (!STRPREFIX(ent->d_name, "index"))
continue;
@@ -2199,29 +2200,54 @@ virCapabilitiesInitCaches(virCaps *caps)
bank = g_new0(virCapsHostCacheBank, 1);
bank->level = level;
- if (virFileReadValueUint(&bank->id,
- "%s/cpu/cpu%zd/cache/%s/id",
- SYSFS_SYSTEM_PATH, pos, ent->d_name) < 0)
+ err = virFileReadValueUint(&bank->id,
+ "%s/cpu/cpu%zd/cache/%s/id",
+ SYSFS_SYSTEM_PATH, pos, ent->d_name);
+ if (err == -2) {
+ VIR_DEBUG("CPU %zd cache %s 'id' missing", pos, ent->d_name);
+ goto skip_cache;
+ }
+ if (err < 0)
goto cleanup;
- if (virFileReadValueUint(&bank->level,
- "%s/cpu/cpu%zd/cache/%s/level",
- SYSFS_SYSTEM_PATH, pos, ent->d_name) < 0)
+ err = virFileReadValueUint(&bank->level,
+ "%s/cpu/cpu%zd/cache/%s/level",
+ SYSFS_SYSTEM_PATH, pos, ent->d_name);
+ if (err == -2) {
+ VIR_DEBUG("CPU %zd cache %s 'level' missing", pos, ent->d_name);
+ goto skip_cache;
+ }
+ if (err < 0)
goto cleanup;
- if (virFileReadValueString(&type,
- "%s/cpu/cpu%zd/cache/%s/type",
- SYSFS_SYSTEM_PATH, pos, ent->d_name) < 0)
+ err = virFileReadValueString(&type,
+ "%s/cpu/cpu%zd/cache/%s/type",
+ SYSFS_SYSTEM_PATH, pos, ent->d_name);
+ if (err == -2) {
+ VIR_DEBUG("CPU %zd cache %s 'type' missing", pos, ent->d_name);
+ goto skip_cache;
+ }
+ if (err < 0)
goto cleanup;
- if (virFileReadValueScaledInt(&bank->size,
- "%s/cpu/cpu%zd/cache/%s/size",
- SYSFS_SYSTEM_PATH, pos, ent->d_name) < 0)
+ err = virFileReadValueScaledInt(&bank->size,
+ "%s/cpu/cpu%zd/cache/%s/size",
+ SYSFS_SYSTEM_PATH, pos, ent->d_name);
+ if (err == -2) {
+ VIR_DEBUG("CPU %zd cache %s 'size' missing", pos, ent->d_name);
+ goto skip_cache;
+ }
+ if (err < 0)
goto cleanup;
- if (virFileReadValueBitmap(&bank->cpus,
- "%s/cpu/cpu%zd/cache/%s/shared_cpu_list",
- SYSFS_SYSTEM_PATH, pos, ent->d_name) < 0)
+ err = virFileReadValueBitmap(&bank->cpus,
+ "%s/cpu/cpu%zd/cache/%s/shared_cpu_list",
+ SYSFS_SYSTEM_PATH, pos, ent->d_name);
+ if (err == -2) {
+ VIR_DEBUG("CPU %zd cache %s 'shared_cpu_list' missing", pos, ent->d_name);
+ goto skip_cache;
+ }
+ if (err < 0)
goto cleanup;
kernel_type = virCacheKernelTypeFromString(type);
@@ -2249,6 +2275,7 @@ virCapabilitiesInitCaches(virCaps *caps)
VIR_APPEND_ELEMENT(caps->host.cache.banks, caps->host.cache.nbanks, bank);
}
+ skip_cache:
g_clear_pointer(&bank, virCapsHostCacheBankFree);
}
if (rv < 0)
--
2.37.3
2 years, 1 month
[PATCH] qemu: Avoid memory leak in virQEMUCapsCPUDefsToModels
by Michal Privoznik
The @vendor variable inside virQEMUCapsCPUDefsToModels() is
allocated, but never freed. But there is actually no need for it
to be allocated, because it merely passes a retval of
virCPUGetVendorForModel() (which returns a const string) to
virDomainCapsCPUModelsAdd() (which ten accepts the argument as
const string). Therefore, drop the g_strdup() call and fix the
type of the variable.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6f3ff7f43f..04b2eef215 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2189,7 +2189,7 @@ virQEMUCapsCPUDefsToModels(virArch arch,
for (i = 0; i < defs->ncpus; i++) {
qemuMonitorCPUDefInfo *cpu = defs->cpus + i;
- char *vendor = NULL;
+ const char *vendor = NULL;
if (modelAllowed && !g_strv_contains(modelAllowed, cpu->name))
continue;
@@ -2198,7 +2198,7 @@ virQEMUCapsCPUDefsToModels(virArch arch,
continue;
if (vendors)
- vendor = g_strdup(virCPUGetVendorForModel(arch, cpu->name));
+ vendor = virCPUGetVendorForModel(arch, cpu->name);
virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable,
cpu->blockers, cpu->deprecated, vendor);
--
2.35.1
2 years, 1 month