Bug 857881 - libvirt returns wrong memory size on uclibc
Summary: libvirt returns wrong memory size on uclibc
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-17 11:52 UTC by Carlo Landmeter
Modified: 2014-04-22 07:19 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-22 07:19:53 UTC
Embargoed:


Attachments (Terms of Use)

Description Carlo Landmeter 2012-09-17 11:52:21 UTC
Description of problem:

libvirt reports wrong "memory size"

Version-Release number of selected component (if applicable):

Latest stable (0.10.1)

How reproducible:

Install latest alpinelinux stable (uclibc based distribution) including libvirt

Exec: virsh nodeinfo
  
Actual results:

Memory size:         65536 KiB

Expected results:

Installed memory size is 4GB

Additional info:

on uclibc sysconf(_SC_PHYS_PAGES) returns -1
while _SC_PAGE_SIZE gives the correct value

found in: gnulib/lib/physmem.c

Comment 1 Ján Tomko 2014-04-22 07:19:53 UTC
This has been fixed in gnulib:
commit 22756d58aa46c291f7fa1c63d61c7c0483622c4e
Author:     Natanael Copa <ncopa>
AuthorDate: 2014-04-18 09:16:27 +0000
Commit:     Pádraig Brady <P>
CommitDate: 2014-04-19 12:34:49 +0100

    physmem: use sysinfo if _SC_PHYS_PAGES unavailable
    
    * lib/physmem.c (physmem_total): Some systems like musl libc do not
    (yet) support _SC_PHYS_PAGES.  Use the linux syscall sysinfo as fallback
    if _SC_PHYS_PAGES or _SC_PAGESIZE fails.
    (physmem_available): Likewise for _SC_AVPHYS_PAGES.
    
    Signed-off-by: Natanael Copa <ncopa>

git describe: v0.1-119-g22756d5

Libvirt uses it since
commit 45e134d6fcb63e9fa052b3490120d51040f7cec4
Author:     Eric Blake <eblake>
CommitDate: 2014-04-21 14:52:28 -0600

    maint: update to latest gnulib
    
    Among other patches, Natanael Copa contributed a fix for
    pyshmem_available when using musl libc that directly affects
    libvirt.
    
    * .gnulib: Update to latest, in part for musl libc compat.
    
    Signed-off-by: Eric Blake <eblake>

git describe: v1.2.3-142-g45e134d


Note You need to log in before you can comment on or make changes to this bug.