mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 14:05:18 +00:00
Shorten domain name for automatic coredump
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@redhat.com>
This commit is contained in:
parent
a042275a39
commit
d294f6b0df
@ -3965,13 +3965,17 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
|
|||||||
char timestr[100];
|
char timestr[100];
|
||||||
struct tm time_info;
|
struct tm time_info;
|
||||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
|
char *domname = virDomainObjGetShortName(vm);
|
||||||
|
|
||||||
|
if (!domname)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
localtime_r(&curtime, &time_info);
|
localtime_r(&curtime, &time_info);
|
||||||
strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);
|
strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);
|
||||||
|
|
||||||
if (virAsprintf(&dumpfile, "%s/%s-%s",
|
if (virAsprintf(&dumpfile, "%s/%s-%s",
|
||||||
cfg->autoDumpPath,
|
cfg->autoDumpPath,
|
||||||
vm->def->name,
|
domname,
|
||||||
timestr) < 0)
|
timestr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -3984,6 +3988,7 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
|
|||||||
"%s", _("Dump failed"));
|
"%s", _("Dump failed"));
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(dumpfile);
|
VIR_FREE(dumpfile);
|
||||||
|
VIR_FREE(domname);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user