Bug 817239 - dominfo outputs incorrectly for memory unit
dominfo outputs incorrectly for memory unit
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.3
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Eric Blake
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-28 04:24 EDT by min zhan
Modified: 2013-02-21 02:12 EST (History)
8 users (show)

See Also:
Fixed In Version: libvirt-0.9.13-3.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 02:12:32 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description min zhan 2012-04-28 04:24:28 EDT
Description of problem:
dominfo outputs incorrectly for memory unit

Version-Release number of selected component (if applicable):
libvirt-0.9.10-14.el6

How reproducible:
Always

Steps to Reproduce:
# virsh dumpxml rhel63
...
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
...

# virsh dominfo rhel63
Id:             -
Name:           rhel63
UUID:           9078a4b7-f1b5-71a2-43dc-7e3e000bc0ce
OS Type:        hvm
State:          shut off
CPU(s):         1
Max memory:     1048576 kB -> the unit should be KiB or k
Used memory:    1048576 kB -> the unit should be KiB or k
Persistent:     yes
Autostart:      enable
Managed save:   no
Security model: selinux
Security DOI:   0

Actual results:
As above

Expected results:
Use k or KiB for memory unit


Additional info:
Comment 1 min zhan 2012-04-28 04:25:52 EDT
Also for the following memory unit:

# virsh nodeinfo
CPU model:           x86_64
CPU(s):              4
CPU frequency:       2659 MHz
CPU socket(s):       1
Core(s) per socket:  4
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         7994800 kB 

# virsh nodememstats
total  :              7994800 kB
free   :              5690124 kB
buffers:               251384 kB
cached :              1123096 kB
Comment 2 Eric Blake 2012-04-28 12:48:05 EDT
These should be trivial fixes to virsh.  I'll propose something upstream soon.
Comment 4 Eric Blake 2012-04-30 16:31:39 EDT
Upstream patch proposed
https://www.redhat.com/archives/libvir-list/2012-April/msg01535.html
Comment 5 Eric Blake 2012-05-23 13:48:33 EDT
Will be fixed for 6.4 when the rebase picks this up:

commit 706aa7c52bcedb9a1346e23ecb244b7291d06c53
Author: Eric Blake <eblake@redhat.com>
Date:   Mon Apr 30 14:27:56 2012 -0600

    virsh: output scaled values with correct units
    
    The recent push to use correct scaling terms (kB for 1000, KiB for
    1024 - such as commit 9dfdead) missed some places in virsh.
    
    * tools/virsh.c (prettyCapacity, cmdDominfo, cmdFreecell)
    (cmdNodeinfo, cmdNodeMemStats, cmdMigrateSetMaxSpeed)
    (cmdBlockCopy, cmdBlockPull, cmdBlockJob): Use KiB, not kB, when
    referring to multiples of 1024.
    * tests/virshtest.c: Update expected output to match.
Comment 8 EricLee 2012-07-24 22:04:11 EDT
Verified in libvirt-0.9.13-3.el6:

# virsh dumpxml qcow2_foo | grep -I mem
  <memory unit='KiB'>1048576</memory>
    <memballoon model='virtio'>
    </memballoon>

# virsh dominfo qcow2_foo
Id:             -
Name:           qcow2_foo
UUID:           8ac888e7-7288-bce9-0ef1-ce639d51c095
OS Type:        hvm
State:          shut off
CPU(s):         4
Max memory:     1048576 KiB
Used memory:    1048576 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

# virsh nodeinfo
CPU model:           x86_64
CPU(s):              4
CPU frequency:       2000 MHz
CPU socket(s):       1
Core(s) per socket:  4
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         3791292 KiB

# virsh nodememstats
total  :              3791292 KiB
free   :              2727060 KiB
buffers:               110820 KiB
cached :               424992 KiB

And can reproduce in libvirt-0.9.10-21.el6:

# virsh dominfo qcow2_foo
Id:             -
Name:           qcow2_foo
UUID:           8ac888e7-7288-bce9-0ef1-ce639d51c095
OS Type:        hvm
State:          shut off
CPU(s):         4
Max memory:     1048576 kB
Used memory:    1048576 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

# virsh nodeinfo
CPU model:           x86_64
CPU(s):              4
CPU frequency:       2000 MHz
CPU socket(s):       1
Core(s) per socket:  4
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         3791292 kB

# virsh nodememstats
total  :              3791292 kB
free   :              2735832 kB
buffers:               110888 kB
cached :               418464 kB

So setting to VERIFIED.
Comment 9 errata-xmlrpc 2013-02-21 02:12:32 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0276.html

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