[libvirt] [PATCH] virsysinfo: Use more virSkipSpacesBackwards()

Andrea Bolognani abologna at redhat.com
Wed Mar 14 09:15:29 UTC 2018


On Tue, 2018-03-13 at 16:21 +0100, Michal Privoznik wrote:
> Some fields reported by dmidecode have plenty of useless spaces
> (in fact some have nothing but spaces). To deal with this we have
> introduced virSkipSpacesBackwards() and use it in
> virSysinfoParseX86Processor() and virSysinfoParseX86Memory().
> However, other functions (e.g. virSysinfoParseX86Chassis()) don't
> use it at all and thus we are reporting nonsense:
> 
>   <sysinfo type='smbios'>
>     <chassis>
>       <entry name='manufacturer'>FUJITSU</entry>
>       <entry name='version'>                      </entry>
>       <entry name='serial'>                </entry>
>       <entry name='asset'>                                        </entry>
>       <entry name='sku'>Default string</entry>
>     </chassis>
>   </sysinfo>
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/util/virsysinfo.c | 34 ++++++++++++++++++++++++++++++----
>  1 file changed, 30 insertions(+), 4 deletions(-)

This would be the perfect time to add test coverage for such odd
smbios data, wouldn't it? :)

You can just modify tests/sysinfodata/x86sysinfo.data and add some
extra spaces eg. after "LENOVO" to show that they are now ignored.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list