Re: [PATCH 2/2] Shorten domain name for automatic coredump

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

 



On Tue, Apr 26, 2016 at 02:07:49PM +0200, Martin Kletzander wrote:
> If the domain name is long enough, the timestamp can prolong the
> filename for automatic coredump to more than the filesystem's limit.
> Simply shorten it like we do in other places.  The timestamp helps with
> the unification, but having the ID in the name won't hurt.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1289363
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 542d13c2ac70..2991bbc2ce4a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3965,13 +3965,14 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
>      char timestr[100];
>      struct tm time_info;
>      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
> +    char *domname = virDomainObjGetShortName(vm);
> 

    if (!domname)
        goto cleanup;

>      localtime_r(&curtime, &time_info);
>      strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);
> 
>      if (virAsprintf(&dumpfile, "%s/%s-%s",
>                      cfg->autoDumpPath,
> -                    vm->def->name,
> +                    domname,
>                      timestr) < 0)
>          goto cleanup;
> 
> @@ -3984,6 +3985,7 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
>                         "%s", _("Dump failed"));
>   cleanup:
>      VIR_FREE(dumpfile);
> +    VIR_FREE(domname);
>      virObjectUnref(cfg);
>      return ret;
>  }

ACK with the check for domname, safe for freeze.

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