RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1437797 - Volume's format should be updated automatically after it is wiped
Summary: Volume's format should be updated automatically after it is wiped
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: jiyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-31 08:34 UTC by lijuan men
Modified: 2018-04-10 10:43 UTC (History)
4 users (show)

Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-04-10 10:42:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:43:05 UTC

Description lijuan men 2017-03-31 08:34:39 UTC
Description of problem:
Volume's format should be updated automatically after it is wiped

Version-Release number of selected component (if applicable):
libvirt-3.1.0-2.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64


How reproducible:
100%

Steps to Reproduce:

1.create a volume(format is qcow2) in the default pool

[root@lmen1 ~]# virsh vol-dumpxml abc.qcow2 default
<volume type='file'>
  <name>abc.qcow2</name>
  <key>/var/lib/libvirt/images/abc.qcow2</key>
  <source>
  </source>
 ...
    <path>/var/lib/libvirt/images/abc.qcow2</path>
  ***  <format type='qcow2'/> ***
    <permissions>
  ...
  </target>
</volume>


2.wipe the volume
[root@lmen1 ~]# virsh vol-wipe abc.qcow2 default
Vol abc.qcow2 wiped

3.check the format before refreshing the pool
[root@lmen1 ~]# virsh vol-dumpxml abc.qcow2 default
<volume type='file'>
  <name>abc.qcow2</name>
  <key>/var/lib/libvirt/images/abc.qcow2</key>
...
    <path>/var/lib/libvirt/images/abc.qcow2</path>
 ***   <format type='qcow2'/> ***
    <permissions>
...
  </target>
</volume>

4.check the format after refreshing the pool
[root@lmen1 ~]# virsh pool-refresh default
Pool default refreshed

[root@lmen1 ~]# virsh vol-dumpxml abc.qcow2 default
<volume type='file'>
  <name>abc.qcow2</name>
  <key>/var/lib/libvirt/images/abc.qcow2</key>
 ...
    <path>/var/lib/libvirt/images/abc.qcow2</path>
  ***    <format type='raw'/>   ***
    <permissions>
 ...
  </target>
</volume>

Actual results:
Volume's format is not updated automatically

Expected results:
Volume's format should be updated automatically


Additional info:

Comment 2 John Ferlan 2017-08-24 22:32:24 UTC
I've posted a couple patches upstream for review, see:

https://www.redhat.com/archives/libvir-list/2017-August/msg00739.html

Testing showed the following results:

# virsh vol-create-as default bz 10M --format qcow2
Vol bz created


# virsh vol-dumpxml bz default | grep format
    <format type='qcow2'/>
# virsh vol-wipe bz default
Vol bz wiped

# virsh vol-dumpxml bz default | grep format
    <format type='raw'/>
# virsh vol-delete bz default
Vol bz deleted

#

NB: For each test pass (without changes and with changes) the vol sizes were:

"After create":

  <capacity unit='bytes'>10485760</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196616</physical>

"After refresh" (either algorithm, including doing pool refresh):

  <capacity unit='bytes'>200704</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>200704</physical>

So that did not change

Comment 3 John Ferlan 2017-08-30 19:37:07 UTC
Pushed the change upstream:

commit d16f803d780f63b8899df04b624d5acfd6939541
Author: John Ferlan <jferlan>
Date:   Thu Aug 24 18:19:14 2017 -0400

    storage: Use virStorageBackendRefreshVolTargetUpdate after wipeVol
    
...
    
    Rather than using refreshVol which essentially only updates the
    allocation, capacity, and permissions for the volume, but not
    the format which does get updated in a pool refresh - let's use
    the same helper that pool refresh uses in order to update the
    volume target.


$ git describe d16f803d780f63b8899df04b624d5acfd6939541
v3.7.0-rc1-13-gd16f803
$

Comment 5 jiyan 2017-09-09 11:11:10 UTC
Test env components:
libvirt-3.7.0-2.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.6.x86_64
kernel-3.10.0-709.el7.x86_64

Test scenarios:
Scenario-1: Wipe a volume without backing file
1. Prepare a volume named '1.qcow2' in 'default' pool, and display the dumpxml file info of the volume
# virsh pool-list --all |grep default
 default              active     yes   

# qemu-img info /var/lib/libvirt/images/1.qcow2 --backing-chain
image: /var/lib/libvirt/images/1.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

# virsh vol-list default |grep 1.qcow2
 1.qcow2              /var/lib/libvirt/images/1.qcow2  

# virsh vol-dumpxml 1.qcow2 default
  ...
  <capacity unit='bytes'>1073741824</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196624</physical>
  ...
    <path>/var/lib/libvirt/images/1.qcow2</path>
    <format type='qcow2'/>
  ...

2. Wipe the volume and then check the dumpxml file info of the volume
# virsh vol-wipe 1.qcow2 default
Vol 1.qcow2 wiped

# virsh vol-dumpxml 1.qcow2 default
  ...
  <capacity unit='bytes'>200704</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>200704</physical>
  ...
    <path>/var/lib/libvirt/images/1.qcow2</path>
    <format type='raw'/>
  ...

3. Check the dumpxml file info of the volume after refreshing the pool
# virsh pool-refresh default
Pool default refreshed

# virsh vol-dumpxml 1.qcow2 default
  ...
  <capacity unit='bytes'>200704</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>200704</physical>
  ...
    <path>/var/lib/libvirt/images/1.qcow2</path>
    <format type='raw'/>
  ...

Scenario-2: Wipe a volume with backing file
1. Prepare a volume named '2.qcow2' in 'default' pool with backing file named '1.qcow2', and display the dumpxml file info of the volume
# virsh pool-list --all |grep default
 default              active     yes  

# qemu-img info /var/lib/libvirt/images/2.qcow2 --backing-chain
image: /var/lib/libvirt/images/2.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 196K
cluster_size: 65536
backing file: 1.qcow2 (actual path: /var/lib/libvirt/images/1.qcow2)
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

image: /var/lib/libvirt/images/1.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

# virsh vol-list default |grep 2.qcow2
 2.qcow2              /var/lib/libvirt/images/2.qcow2    

# virsh vol-dumpxml 2.qcow2 default
  ...
  <capacity unit='bytes'>1073741824</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196624</physical>
  <target>
    <path>/var/lib/libvirt/images/2.qcow2</path>
    <format type='qcow2'/>
  </target>
  ...
  <backingStore>
    <path>/var/lib/libvirt/images/1.qcow2</path>
    <format type='qcow2'/>
  </backingStore>
  ...

2. Wipe the volume and then check the dumpxml file info of the volume
# virsh vol-wipe 2.qcow2 default
Vol 2.qcow2 wiped

# virsh vol-dumpxml 2.qcow2 default
  ...
  <capacity unit='bytes'>200704</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>200704</physical>
  <target>
    <path>/var/lib/libvirt/images/2.qcow2</path>
    <format type='raw'/>
  </target>
  <backingStore>
    <path>/var/lib/libvirt/images/1.qcow2</path>
    <format type='qcow2'/>
  </backingStore>
  ...

3. Check the dumpxml file info of the volume after refreshing the pool
Note: Backing file is not supported for file format 'raw'.
# virsh pool-refresh default
Pool default refreshed

# virsh vol-dumpxml 2.qcow2 default
  ...
  <capacity unit='bytes'>200704</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>200704</physical>
  <target>
    <path>/var/lib/libvirt/images/2.qcow2</path>
    <format type='raw'/>
  </target>
  ...

All the results are as expected, move this bug to be verified.

Comment 9 errata-xmlrpc 2018-04-10 10:42:33 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://access.redhat.com/errata/RHEA-2018:0704


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