[PATCH] spec: Restart libvirtd on upgrade without socket activation
by Martin Kletzander
The %posttrans phase needs has a special case for upgrading libvirt
daemon with --listen, but it forgot to also restart the daemon in order
to run the new installed version.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1820437
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
libvirt.spec.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index d9529fc76c4a..77b274b6f91d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1449,6 +1449,7 @@ then
libvirtd-admin.socket \
libvirtd-tls.socket \
libvirtd-tcp.socket >/dev/null 2>&1 || :
+ /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
else
# Old libvirtd owns the sockets and will delete them on
# shutdown. Can't use a try-restart as libvirtd will simply
--
2.39.0
1 year, 10 months
[libvirt PATCH 0/9] src: misc cleanups related to remote protocol/client
by Daniel P. Berrangé
Just before xmas I did some work on an rpcgen replacement so
we can use a non-sucky API instead of xdr_*. This short series
has some general cleanups I found useful. The rpcgen code will
come later.
While this is all non-functional changes, I'm NOT proposing
it for 9.0, it can safely wait as it isn't fixing any real
bugs (that I've realized).
Daniel P. Berrangé (9):
remote: remove redundant initialization of args variable
lxc: fix XDR protocol compliance
logging: remove redundant XDR typedef
rpc: use VIR_LOCK_GUARD in remote client code
remote: use VIR_LOCK_GUARD in client code
admin: use VIR_LOCK_GUARD in client code
rpc: use struct zero initializer instead of memset
remote: use struct zero initializer instead of memset
admin: use struct zero initializer instead of memset
src/admin/admin_remote.c | 92 +--
src/logging/log_protocol.x | 2 -
src/lxc/lxc_monitor_protocol.x | 6 +-
src/remote/remote_driver.c | 1280 +++++++++-----------------------
src/rpc/gendispatch.pl | 18 +-
5 files changed, 397 insertions(+), 1001 deletions(-)
--
2.38.1
1 year, 10 months
[PATCH] qemu: Fix handling of passed FDs in remoteDispatchDomainFdAssociate
by Peter Krempa
To ensure same behaviour when remote driver is or is not used we must
not steal the FDs and array holding them passed to qemuDomainFDAssociate
but rather duplicate them. At the same time the remote driver must close
and free them to prevent leak.
Pointed out by Coverity as FD leak on error path:
*** CID 404348: Resource leaks (RESOURCE_LEAK)
/src/remote/remote_daemon_dispatch.c: 7484 in remoteDispatchDomainFdAssociate()
7478 rv = 0;
7479
7480 cleanup:
7481 if (rv < 0)
7482 virNetMessageSaveError(rerr);
7483 virObjectUnref(dom);
>>> CID 404348: Resource leaks (RESOURCE_LEAK)
>>> Variable "fds" going out of scope leaks the storage it points to.
7484 return rv;
Fixes: abd9025c2fd
Fixes: f762f87534e
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 15 ++++++++++++---
src/remote/remote_daemon_dispatch.c | 3 +++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a88c9ebe64..d6879175fe 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20442,7 +20442,8 @@ qemuDomainFDAssociate(virDomainPtr domain,
{
virDomainObj *vm = NULL;
qemuDomainObjPrivate *priv;
- virStorageSourceFDTuple *new;
+ g_autoptr(virStorageSourceFDTuple) new = NULL;
+ size_t i;
int ret = -1;
virCheckFlags(VIR_DOMAIN_FD_ASSOCIATE_SECLABEL_RESTORE |
@@ -20460,8 +20461,16 @@ qemuDomainFDAssociate(virDomainPtr domain,
priv = vm->privateData;
new = virStorageSourceFDTupleNew();
- new->fds = fds;
new->nfds = nfds;
+ new->fds = g_new0(int, new->nfds);
+ for (i = 0; i < new->nfds; i++) {
+ if ((new->fds[i] = dup(fds[i])) < 0) {
+ virReportSystemError(errno,
+ _("failed to duplicate passed fd with index '%zu'"),
+ i);
+ goto cleanup;
+ }
+ }
new->conn = domain->conn;
new->writable = flags & VIR_DOMAIN_FD_ASSOCIATE_SECLABEL_WRITABLE;
@@ -20469,7 +20478,7 @@ qemuDomainFDAssociate(virDomainPtr domain,
virCloseCallbacksDomainAdd(vm, domain->conn, qemuDomainFDHashCloseConnect);
- g_hash_table_insert(priv->fds, g_strdup(name), new);
+ g_hash_table_insert(priv->fds, g_strdup(name), g_steal_pointer(&new));
ret = 0;
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 40c734ce6b..6c56e9ec3e 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -7478,6 +7478,9 @@ remoteDispatchDomainFdAssociate(virNetServer *server G_GNUC_UNUSED,
rv = 0;
cleanup:
+ for (i = 0; i < nfds; i++)
+ VIR_FORCE_CLOSE(fds[i]);
+ g_free(fds);
if (rv < 0)
virNetMessageSaveError(rerr);
virObjectUnref(dom);
--
2.38.1
1 year, 10 months
[PATCH 00/12] migration/migrationpin:support migration pin
by Jiang Jiacheng
Support set the CPU affinity of the live migration thread to improve
the migration performance in specific cases. By default, the migration
thread shares CPU resources with the VM process. With those API, support
pin migration thread to expected CPU list to avoid preempting CPU
resources of VM process.
New API 'pinMigrationThread' and virsh command 'virsh migrationpin'
is used to pin migration thread to expected CPU list before or during
migration.
New migration param 'migration.pin' is used to support migration pin
via interface 'virDomainMigrateToURI3'.
Jiang Jiacheng (2):
migration/migration-pin: support migration thread pin by virsh command
migration/migration-pin/multifd-pin: add migration pin status handle
zhengchuan (10):
migration/migration-pin: get migration pid for migration pin
migration/migration-pin: pin migration pid by given cpumap
migration/migration-pin: add qemu monitor callback functions
migration/migration-pin: add migrationpin for migration parameters
migration/migration-pin: get cpumap from migration.pin
migration/migration-pin: add domainMigrationPid for
qemuMonitorCallbacks
migration/multifd-pin: get multifd pid for migration pin
migration/multifd-pin: pin multifd pid by given cpumap
migration/multifd-pin: add qemu monitor callback functions
migration/multifd-pin: support migration multifd thread pin
include/libvirt/libvirt-domain.h | 19 ++
src/conf/domain_conf.c | 9 +
src/conf/domain_conf.h | 11 ++
src/conf/virconftypes.h | 2 +
src/driver-hypervisor.h | 16 ++
src/libvirt-domain.c | 144 +++++++++++++++
src/libvirt_private.syms | 1 +
src/libvirt_public.syms | 7 +
src/qemu/qemu_domain.c | 5 +
src/qemu/qemu_domain.h | 5 +
src/qemu/qemu_driver.c | 175 ++++++++++++++++++
src/qemu/qemu_migration.c | 5 +
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_migration_params.c | 21 +++
src/qemu/qemu_migration_params.h | 4 +
src/qemu/qemu_monitor.c | 20 ++
src/qemu/qemu_monitor.h | 13 ++
src/qemu/qemu_monitor_json.c | 32 ++++
src/qemu/qemu_process.c | 303 +++++++++++++++++++++++++++++++
src/qemu/qemu_process.h | 15 ++
src/remote/remote_driver.c | 3 +
src/remote/remote_protocol.x | 43 ++++-
src/remote_protocol-structs | 28 +++
src/util/vircgroup.c | 3 +
src/util/vircgroup.h | 1 +
tools/virsh-domain.c | 69 +++++++
26 files changed, 954 insertions(+), 1 deletion(-)
--
2.33.0
1 year, 10 months
[PATCH] conf: check vhost-user queues with vcpus
by Jiang Jiacheng
With kernel without the ref patch, if queues > vcpus, interrupts
will be centralized on one vcpu affecting guest performance. After
the ref patch merged, the queues whose number is greater than the
number of vcpus will not be used.
Considering the above, it's better to check the counts of vhost-user
queues and vcpus.
ref:
https://patchwork.kernel.org/project/linux-scsi/cover/1553682995-5682-1-g...
Signed-off-by: Jiang Jiacheng <jiangjiacheng(a)huawei.com>
---
src/conf/domain_validate.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 95b8d9b419..6106e79999 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -308,7 +308,7 @@ virSecurityDeviceLabelDefValidate(virSecurityDeviceLabelDef **seclabels,
static int
-virDomainDiskVhostUserValidate(const virDomainDiskDef *disk)
+virDomainDiskVhostUserValidate(const virDomainDef *def, const virDomainDiskDef *disk)
{
if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -465,6 +465,12 @@ virDomainDiskVhostUserValidate(const virDomainDiskDef *disk)
return -1;
}
+ if (disk->queues > virDomainDefGetVcpus(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("vhost-user disk queues must <= vcpus"));
+ return -1;
+ }
+
return 0;
}
@@ -807,7 +813,7 @@ virDomainDiskDefValidate(const virDomainDef *def,
}
if (disk->src->type == VIR_STORAGE_TYPE_VHOST_USER &&
- virDomainDiskVhostUserValidate(disk) < 0) {
+ virDomainDiskVhostUserValidate(def, disk) < 0) {
return -1;
}
--
2.33.0
1 year, 10 months
[PATCH 0/3] define g_autoptr for virNWFilterDef and virNWFilterRuleDef
by Jiang Jiacheng
Define and use g_autoptr() for virNWFilterDef and virNWFilterRuleDef,
and remove unnecessary label/variable.
Those patches are followup with:
https://gitlab.com/libvirt/libvirt/-/commit/a9027d447be789cd11c0aa18ceb83...
Jiang Jiacheng (3):
conf: define g_autoptr for virNWFilterDef and virNWFilterRuleDef
src/tests: use g_autoptr for virNWFilterDef and virNWFilterRuleDef
virNWFilterSaveConfig: remove the unnecessary variable 'ret'
src/conf/nwfilter_conf.c | 52 ++++++++++++++--------------------
src/conf/nwfilter_conf.h | 2 ++
src/conf/virnwfilterobj.c | 19 ++++++-------
src/nwfilter/nwfilter_driver.c | 7 ++---
tests/nwfilterxml2xmltest.c | 22 ++++++--------
5 files changed, 42 insertions(+), 60 deletions(-)
--
2.33.0
1 year, 10 months
[PATCH] remote: fix double free of migration params on error
by Daniel P. Berrangé
The remote_*_args methods will generally borrow pointers
passed in the caller, so should not be freed.
On failure of the virTypedParamsSerialize method, however,
xdr_free was being called. This is presumably because it
was thought that the params may have been partially
serialized and need cleaning up. This is incorrect, as
virTypedParamsSerialize takes care to cleanup partially
serialized data. This xdr_free call would lead to free'ing
the borrowed cookie pointers, which would be a double free.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/remote_driver.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index b0dba9057b..bb44d0004f 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6919,8 +6919,6 @@ remoteDomainMigrateBegin3Params(virDomainPtr domain,
(struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) {
- xdr_free((xdrproc_t) xdr_remote_domain_migrate_begin3_params_args,
- (char *) &args);
goto cleanup;
}
@@ -6981,8 +6979,6 @@ remoteDomainMigratePrepare3Params(virConnectPtr dconn,
(struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) {
- xdr_free((xdrproc_t) xdr_remote_domain_migrate_prepare3_params_args,
- (char *) &args);
goto cleanup;
}
@@ -7063,8 +7059,6 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
(struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) {
- xdr_free((xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_params_args,
- (char *) &args);
goto cleanup;
}
@@ -7149,8 +7143,6 @@ remoteDomainMigratePerform3Params(virDomainPtr dom,
(struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) {
- xdr_free((xdrproc_t) xdr_remote_domain_migrate_perform3_params_args,
- (char *) &args);
goto cleanup;
}
@@ -7216,8 +7208,6 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
(struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) {
- xdr_free((xdrproc_t) xdr_remote_domain_migrate_finish3_params_args,
- (char *) &args);
goto cleanup;
}
@@ -7284,8 +7274,6 @@ remoteDomainMigrateConfirm3Params(virDomainPtr domain,
(struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) {
- xdr_free((xdrproc_t) xdr_remote_domain_migrate_confirm3_params_args,
- (char *) &args);
goto cleanup;
}
--
2.38.1
1 year, 10 months
[PATCH] admin: fix leak of typed parameters on error
by Daniel P. Berrangé
A few admin client methods had the xdr_free call the wrong
side of the cleanup label, so typed parameters would not
be freed on error.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/admin/admin_remote.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c
index 012488bff3..f99b93eef6 100644
--- a/src/admin/admin_remote.c
+++ b/src/admin/admin_remote.c
@@ -269,9 +269,9 @@ remoteAdminServerGetThreadPoolParameters(virAdmServerPtr srv,
goto cleanup;
rv = 0;
- xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret);
cleanup:
+ xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret);
virObjectUnlock(priv);
return rv;
}
@@ -342,9 +342,9 @@ remoteAdminClientGetInfo(virAdmClientPtr client,
goto cleanup;
rv = 0;
- xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret);
cleanup:
+ xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret);
virObjectUnlock(priv);
return rv;
}
@@ -380,10 +380,10 @@ remoteAdminServerGetClientLimits(virAdmServerPtr srv,
goto cleanup;
rv = 0;
- xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret,
- (char *) &ret);
cleanup:
+ xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret,
+ (char *) &ret);
virObjectUnlock(priv);
return rv;
}
--
2.38.1
1 year, 10 months
[libvirt PATCH 0/2] docs: submitting-patches: shorten slightly
by Ján Tomko
Ján Tomko (2):
docs: submimtting-patches: Remove emphasis on not cc'ing developers
docs: submitting-patches: remove note about --patience
docs/submitting-patches.rst | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
--
2.39.0
1 year, 10 months
[PATCH 0/2] qemu: add append mode config for serial file
by Oleg Vasilev
Serial log file contains lots of useful information for debugging
configuration problems. It makes sense to preserve the log in between
restarts, so that one can later figure out what was going on.
Oleg Vasilev (2):
qemu: add append mode config for serial file
qemuxml2xmltest: add serial append=on test
src/qemu/libvirtd_qemu.aug | 3 +
src/qemu/qemu.conf.in | 10 ++++
src/qemu/qemu_conf.c | 4 ++
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_domain.c | 13 +++++
src/qemu/test_libvirtd_qemu.aug.in | 1 +
tests/qemuxml2argvdata/serial-append.xml | 56 +++++++++++++++++++
.../serial-append.x86_64-latest.xml | 56 +++++++++++++++++++
tests/qemuxml2xmltest.c | 4 ++
9 files changed, 149 insertions(+)
create mode 100644 tests/qemuxml2argvdata/serial-append.xml
create mode 100644 tests/qemuxml2xmloutdata/serial-append.x86_64-latest.xml
--
2.38.1
1 year, 10 months