[libvirt PATCH] qemu: Shorten domain name in virtiofsd log path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This helps when starting domains with long names which could possibly end up
creating too long of a name for the filesystem.

The path is not being saved in the domain config, so there is no need for
backwards compatibility.  User aliases will always start with "ua-" and the only
way paths could collide is to:

1) create a domain named e.g. "asdf-ua"
2) start the domain with virtiofsd debug logs
3) destroy the domain
4) restart libvirt daemon for domain IDs to start from 1 again
5) create a domain named "asdf"
6) add user alias for the virtiofs that is the same as was generated for the
   first domain, with the required "ua-" prefix
7) start the "asdf" domain

at which point the logs for the two domains would end up in the same logfile.
Since this is still better than what we had before I think it is not worth
fixing this peculiar scenario in this patch.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1817401
Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_virtiofs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
index 7e3324b017ce..67df8b3890b6 100644
--- a/src/qemu/qemu_virtiofs.c
+++ b/src/qemu/qemu_virtiofs.c
@@ -81,8 +81,9 @@ qemuVirtioFSCreateLogFilename(virQEMUDriverConfig *cfg,
                               const char *alias)
 {
     g_autofree char *name = NULL;
+    g_autofree char *shortname = virDomainDefGetShortName(def);
 
-    name = g_strdup_printf("%s-%s", def->name, alias);
+    name = g_strdup_printf("%s-%s", shortname, alias);
 
     return virFileBuildPath(cfg->logDir, name, "-virtiofsd.log");
 }
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux