Re: [PATCH v2 09/12] getstats: prepare for dynamic block.count stat

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

 



On 12/16/2014 08:09 AM, Peter Krempa wrote:
> On 12/16/14 09:04, Eric Blake wrote:
>> A coming patch will make it optionally possible to list backing
>> chain block stats; in this mode of operation, block.counts is no
>> longer the number of <disks> in the domain, but the number of
>> blocks in the array being reported.  We still want block.count
>> listed first, but rather than iterate the tree twice (once to
>> count, and once to list stats), it's easier to just touch things
>> up after the fact.
>>

>> +    count_index = record->nparams;
> 
> The index is remembered prior ..
> 
>> +    QEMU_ADD_COUNT_PARAM(record, maxparams, "block", 0);
> 
> to adding the element into the array. As the macro may jump to cleanup
> precisely at this moment, if adding of the element failed you'd ...
> 
>>
>> -    for (i = 0; i < dom->def->ndisks; i++) {
>> +    for (; i < dom->def->ndisks; i++) {
>>          qemuBlockStats *entry;
>>          virDomainDiskDefPtr disk = dom->def->disks[i];
>>
>> @@ -18627,6 +18632,8 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
>>      ret = 0;
>>
>>   cleanup:
>> +    if (count_index >= 0)
>> +        record->params[count_index].value.ui = i;
> 
> Touch a non-existent field here.

Ooh, good catch.

> 
> if (ret == 0 && count_index >= 0) ...
> 
> 
>>      virHashFree(stats);
>>      virObjectUnref(cfg);
>>      return ret;
>>
> 
> ACK with the tweak above.

Fixed, and will push shortly.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP 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]