Bug 1437797
| Summary: | Volume's format should be updated automatically after it is wiped | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | lijuan men <lmen> |
| Component: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED ERRATA | QA Contact: | jiyan <jiyan> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.4 | CC: | dyuan, rbalakri, xuzhang, yisun |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-3.7.0-1.el7 | Doc Type: | No Doc Update |
| Doc Text: |
undefined
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-04-10 10:42:33 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: | |||
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 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
$
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.
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 |
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: