Bug 1271107

Summary: The vaule of Used memory in 'virsh dominfo' is 0 when the guest is shut off
Product: Red Hat Enterprise Linux 7 Reporter: lijuan men <lmen>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: dyuan, lhuang, mzhan, pkrempa, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:26:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lijuan men 2015-10-13 07:55:16 UTC
Description of problem:
The vaule of Used memory in 'virsh dominfo' is 0 when the guest is shut off

Version-Release number of selected component (if applicable):
  kernel-3.10.0-322.el7.x86_64
  qemu-kvm-1.5.3-104.el7.x86_64
  libvirt-1.2.17-13.el7.x86_64
  

How reproducible:
100%

Steps to Reproduce:

1. create a  guest named rhel7

2. #virsh destroy rhel7

3. #virsh dumpxml rhel7
    *******
     <memory unit='KiB'>4194300</memory>
     <currentMemory unit='KiB'>1024857</currentMemory>
    *******

4. #virsh dominfo rhel7
    *******
    Max memory:     4194300 KiB
    Used memory:    0 KiB
    *******

Actual results:
the vaule of Used memory in step4 is 0,that is not the same as the value of currentMemory in step 3


Expected results:
the vaule of Used memory in step4 is the same as the value of currentMemory in step 3

Comment 1 Peter Krempa 2015-10-13 08:53:42 UTC
Already fixed upstream:

commit 60acb38abbee1636a9cddf8d296f700d115c8f77
Author: Jim Fehlig <jfehlig>
Date:   Mon Aug 10 12:49:55 2015 -0600

    Revert "LXC: show used memory as 0 when domain is not active"
    
    This reverts commit 1ce7c1d20cfd5afb26d2dbc88201085d52415d0e,
    which introduced a significant semantic change to the
    virDomainGetInfo() API. Additionally, the change was only
    made to 2 of the 15 virt drivers.
    
    Conflicts:
        src/qemu/qemu_driver.c
    
    Signed-off-by: Jim Fehlig <jfehlig>

Comment 3 Luyao Huang 2016-06-01 08:42:39 UTC
Verify this bug with libvirt-1.3.4-1.el7.x86_64:

1. prepare a inactive guest:

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel7.0-rhel                   shut off

2. check guest current memory:

# virsh dumpxml rhel7.0-rhel
<domain type='kvm'>
  <name>rhel7.0-rhel</name>
  <uuid>67c7a123-5415-4136-af62-a2ee098ba6cd</uuid>
  <maxMemory slots='16' unit='KiB'>15243264</maxMemory>
  <memory unit='KiB'>1818624</memory>
  <currentMemory unit='KiB'>1798144</currentMemory>

3. check dominfo output:

# virsh dominfo rhel7.0-rhel
Id:             -
Name:           rhel7.0-rhel
UUID:           67c7a123-5415-4136-af62-a2ee098ba6cd
OS Type:        hvm
State:          shut off
CPU(s):         12
Max memory:     1818624 KiB
Used memory:    1798144 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

Comment 5 errata-xmlrpc 2016-11-03 18:26:10 UTC
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.

https://rhn.redhat.com/errata/RHSA-2016-2577.html