[libvirt] [PATCH 3/3] util: virsysinfo: parse frequency information on S390

Bjoern Walk bwalk at linux.vnet.ibm.com
Thu Jan 11 09:44:40 UTC 2018

John Ferlan <jferlan at redhat.com> [2018-01-10, 05:34PM -0500]:
> Thinking partially in terms of something Andrea posted as a result of
> something I commented on:
> https://www.redhat.com/archives/libvir-list/2018-January/msg00240.html
> Maybe we should take the approach of leaving it as zero if we cannot
> find what we're looking for...
> So the above changes to
>     if ((tmp_base = strstr(tmp_base, "cpu MHz dynamic")) &&
>         (virSysinfoParseS390Line(tmp_base..., &mhz))
>         xxxx = mhz;
> IOW: Update the value if both pass and do nothing if one or the other
> fails.  If both pass then mhz won't be leaked because we'll save it.

Actually, this is not necessary. Also my initial point was irrelevant.
If no frequency information is available, we just completely skip the
whole loop (since no line with "cpu number" is found) and everything
works as before.

So, with my changes right now, we parse liberally, the only way we bail
out with error (and discard everything in the process) is when the
virStrToLong_uip fails. We report a debug message for the unlikely case
of n >= ret->nprocessor.

I have also added a new test case to the sysinfotest with updated data
for /proc/cpuinfo and /proc/sysinfo. Will send v2 shortly.
> BTW: Since Andrea has pushed and patches 1 & 2 were R-B'd, I've pushed
> them.  So it'll just be this third patch with adjustments.

Thanks a lot!

> John
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


IBM Systems
Linux on z Systems & Virtualization Development
IBM Deutschland
Schönaicher Str. 220
71032 Böblingen
Phone: +49 7031 16 1819
E-Mail: bwalk at de.ibm.com
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 906 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180111/6fd91841/attachment-0001.sig>

More information about the libvir-list mailing list