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

Martin Kletzander mkletzan at redhat.com
Thu Jun 16 14:43:11 UTC 2016


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 at redhat.com>
>> ---
>>  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);
>>  }
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160616/ef20704a/attachment-0001.sig>


More information about the libvir-list mailing list