Historically threads are given a name based on the C function,
and this name is just used inside libvirt. With OS level thread
naming this name is now visible to debuggers, but also has to
fit in 15 characters on Linux, so function names are too long
in some cases.
Signed-off-by: Daniel P. Berrangé
---
src/libxl/libxl_domain.c| 10 ++
src/libxl/libxl_migration.c | 23 ++-
src/lxc/lxc_fuse.c | 4 ++--
src/node_device/node_device_udev.c | 7 ---
src/nwfilter/nwfilter_dhcpsnoop.c | 11 ++-
src/nwfilter/nwfilter_learnipaddr.c | 10 ++
src/qemu/qemu_driver.c | 3 ++-
src/qemu/qemu_migration.c | 8 +---
src/qemu/qemu_process.c | 17 -
src/remote/remote_daemon.c | 9 ++---
src/rpc/virnetserver.c | 9 +
src/storage/storage_backend_scsi.c | 4 ++--
src/storage/storage_driver.c| 4 ++--
src/util/vircommand.c | 5 +++--
src/util/virfdstream.c | 10 ++
src/util/virnodesuspend.c | 8 +---
src/util/virthreadpool.c| 14 ++
src/util/virthreadpool.h| 2 +-
18 files changed, 101 insertions(+), 57 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index c8b68665af..e3da9f777d 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -664,6 +664,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST
libxl_event *event)
virThread thread;
g_autoptr(libxlDriverConfig) cfg = NULL;
int ret = -1;
+g_autofree char *name = NULL;
if (event->type != LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN &&
event->type != LIBXL_EVENT_TYPE_DOMAIN_DEATH) {
@@ -687,12 +688,13 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST
libxl_event *event)
shutdown_info->driver = driver;
shutdown_info->event = (libxl_event *)event;
+name = g_strdup_printf("ev-%d", event->domid);
if (event->type == LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN)
-ret = virThreadCreate(&thread, false, libxlDomainShutdownThread,
- shutdown_info);
+ret = virThreadCreateFull(&thread, false, libxlDomainShutdownThread,
+ name, false, shutdown_info);
else if (event->type == LIBXL_EVENT_TYPE_DOMAIN_DEATH)
-ret = virThreadCreate(&thread, false, libxlDomainDeathThread,
- shutdown_info);
+ret = virThreadCreateFull(&thread, false, libxlDomainDeathThread,
+ name, false, shutdown_info);
if (ret < 0) {
/*
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 873b2b3e01..e5f39cfc40 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -293,6 +293,7 @@ libxlMigrateDstReceive(virNetSocketPtr sock,
virNetSocketPtr client_sock;
int recvfd = -1;
size_t i;
+g_autofree char *name = NULL;
/* Accept migration connection */
if (virNetSocketAccept(sock, &client_sock) < 0 || !client_sock) {
@@ -313,8 +314,13 @@ libxlMigrateDstReceive(virNetSocketPtr sock,
VIR_FREE(priv->migrationDstReceiveThr);
if (VIR_ALLOC(priv->migrationDstReceiveThr) < 0)
goto fail;
-if (virThreadCreate(priv->migrationDstReceiveThr, true,
-libxlDoMigrateDstReceive, args) < 0) {
+
+name = g_strdup_printf("mig-%s", args->vm->def->name);
+if (virThreadCreateFull(priv->migrationDstReceiveThr, true,
+libxlDoMigrateDstReceive,
+name,
+false,
+args) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to create thread for receiving migration
data"));
goto fail;
@@ -553,6 +559,7 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
char *xmlout = NULL;
int dataFD[2] = { -1, -1 };
int ret = -1;
+g_autofree char *name = NULL;
if (libxlDomainMigrationPrepareAny(dconn, def, cookiein, cookieinlen,
&mig, &xmlout, &taint_hook) < 0)
@@ -610,7 +617,10 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
VIR_FREE(priv->migrationDstReceiveThr);
if (VIR_ALLOC(priv->migrationDstReceiveThr) < 0)
goto error;
-if (virThreadCreate(priv->migrationDstReceiveThr, true,
libxlDoMigrateDstReceive, args) < 0) {
+name = g_strdup_printf("mig-%s", args->vm->def->name);
+if (virThreadCreateFull(priv->migrationDstReceiveThr, true,
+libxlDoMigrateDstReceive,
+name, false, args) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to create thread for receiving migration
data"));
goto endjob;
@@ -909,6 +919,7 @@