Bug 1257469

Summary: Storage size of guest shows incorrect in virt-manager if lazy refcounts is false and disk type is volume
Product: Red Hat Enterprise Linux 7 Reporter: mxie <mxie>
Component: virt-managerAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: juzhou, mzhan, tzheng, xiaodwan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.3.2-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 01:58:07 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:
Attachments:
Description Flags
screenshots of guests none

Description mxie@redhat.com 2015-08-27 07:08:01 UTC
Created attachment 1067556 [details]
screenshots of guests

Description of problem:
Storage size of guest shows incorrect in virt-manager if lazy refcounts is false and disk type is volume

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


How reproducible:
100%

Steps to Reproduce:
1.Create a guest disk
   # qemu-img create -f qcow2 /var/lib/libvirt/images/test.img 10G
     Formatting 'test.img', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off 

 2.Check the guest disk:
   # qemu-img info test.img
     image: test.img
     file format: qcow2
     virtual size: 10G (10737418240 bytes)
     disk size: 196K
     cluster_size: 65536
     Format specific information:
     compat: 1.1
     lazy refcounts: false
 3.Define xml for test guest and set disk type is 'volume'
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='default' volume='test.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
 4.Import the test guest:
   # virsh define test.xml

 5.Check test guest's storage size shows 0.19M in virt-manager,please refer to screenshot of test 


Actual results:
As above

Expected results:
Storage size of guest shows correct in virt-manager

Additional info:
1.If modify test guest's disk type from volume to file in test.xml, its storage size will show 10G in virt-manager,please refer to screenshot of test_modify, so the bug is related to disk type 'volume'
2.*Create another guest via virt-manager. name: generic,check generic guest's disk
   # qemu-img info generic.qcow2 
   image: generic.qcow2
   file format: qcow2
   virtual size: 10G (10737418240 bytes)
   disk size: 2.2M
   cluster_size: 65536
   Format specific information:
     compat: 1.1
     lazy refcounts: true
  *Check generic guest's storage size shows 10G in virt-manager
  *Modify generic guest's xml file to change disk type from file to volume
   # virsh edit generic
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='default' volume='generic.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
  *Check generic guest's storage size in virt-manager, it still shows 10G, please refer to screenshot of generic, the difference place with above is 'lazy refcounts: true', so this bug is not only related to 'disk type is volume' but also 'lazy refcounts is false'

Comment 3 Pavel Hrdina 2015-11-05 13:59:42 UTC
Upstream commit:

commit 57fa64e542ff684d5dae9e4259aa11c6cec02ef2
Author: Cole Robinson <crobinso>
Date:   Sat Sep 5 17:59:47 2015 -0400

    details: Use devicedisk path lookup for source_pool

Comment 4 Mike McCune 2016-03-28 23:17:33 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 6 XiaoyunHu 2016-07-21 03:05:18 UTC
I can reproduce this bug with package:
virt-manager-1.2.1-8.el7.noarch
virt-install-1.2.1-8.el7.noarch

Steps are the same as description above.

Then try to verify with new build:
virt-manager-1.4.0-1.el7.noarch
virt-install-1.4.0-1.el7.noarch

Steps:
1. Create a guest disk
# qemu-img create -f qcow2 /var/lib/libvirt/images/test.img 10G
Formatting '/var/lib/libvirt/images/test.img', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
2. Check the guest disk
# qemu-img info test.img
image: test.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
3. Edit the xml of test guest and Add a disk which disk type is 'volume'
#virsh edit test
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='default' volume='test.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
4.  Import the test guest:
   # virsh define test.xml

5. Check test guest's storage size in virt-manager

Results:
1. The test guest's storage size in virt-manager is 10G.

According to the result above in the latest version of virt-manager, move this bug from ON_QA to VERIFIED.

Comment 8 errata-xmlrpc 2016-11-04 01:58:07 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/RHBA-2016-2269.html