Re: [PATCH] qemu: Shorten domain name for watchdog coredump

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

 



On Thu, Jun 16, 2016 at 09:06:29AM -0400, John Ferlan wrote:


On 06/13/2016 10:34 AM, Martin Kletzander wrote:
Similarly to commit d294f6b0dff7, if the name is long enough, the
filename can be longer than filesystem's limit.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1334237

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


ACK - although does it matter that the name format would be different
than doCoreDumpToAutoDumpPath? (eg time(NULL) vs. localtime_r and
strftime)...  IOW: Should there be a helper to generate a consistent name?

Also, it would be nice to take the time and alter the function name and
args to follow recent conventions

static void
processWatchdogEvent(...,
                    ...)


These all make sense, so I'll post fixes for that, just not as part of
this particular patch since it is a separate fix.

Thanks for the review and ideas,
Martin

John
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index efb3f854fb10..80d1d209a80c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3906,6 +3906,10 @@ static void processWatchdogEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, in
 {
     int ret;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+    char *domname = virDomainObjGetShortName(vm);
+
+    if (!domname)
+        goto cleanup;

     switch (action) {
     case VIR_DOMAIN_WATCHDOG_ACTION_DUMP:
@@ -3915,7 +3919,7 @@ static void processWatchdogEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, in

             if (virAsprintf(&dumpfile, "%s/%s-%u",
                             cfg->autoDumpPath,
-                            vm->def->name,
+                            domname,
                             (unsigned int)time(NULL)) < 0)
                 goto cleanup;

@@ -3959,6 +3963,7 @@ static void processWatchdogEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, in
     qemuDomainObjEndAsyncJob(driver, vm);

  cleanup:
+    VIR_FREE(domname);
     virObjectUnref(cfg);
 }

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]