Bug 1675743
| Summary: | virt-clone does not honor '--nonsparse' argument | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | amashah | ||||
| Component: | virt-manager | Assignee: | Cole Robinson <crobinso> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 7.6 | CC: | amashah, crobinso, dyuan, juzhou, mxie, phrdina, tzheng, xiaodwan, zili | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | virt-manager-1.5.0-5.el7 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2019-08-06 13:08:01 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: |
|
||||||
Thanks for the report, I've fixed it upstream now:
commit 4f66c423f7833e270b61536d53a0772ce1242abc
Author: Cole Robinson <crobinso>
Date: Mon Mar 4 13:20:51 2019 -0500
cloner: Handle --nonsparse for qcow2 images (bz 1675743)
Created attachment 1567812 [details]
virt-clone debug log in virt-manager-1.5.0-4.el7.noarch
I can reproduce this bug with build:
virt-manager-1.5.0-3.el7
Steps:
1. Prepare a health qcow2 disk format vm.
# qemu-img info /var/lib/libvirt/images/rhel7.7-2.qcow2
image: /var/lib/libvirt/images/rhel7.7-2.qcow2
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 1.5G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
refcount bits: 16
corrupt: false
2. Clone the original to a new vm with option "--nonsparse"
# virt-clone -o rhel7.7-1675743 -n rhel7.7-1675743-old --nonsparse --file /tmp/rhel7.7-1675743-old
Allocating 'rhel7.7-1675743-old' | 9.0 GB 00:00:24
Clone 'rhel7.7-1675743-old' created successfully.
3. Check the disk info of newly clone vm.
# qemu-img info /tmp/rhel7.7-1675743-old
image: /tmp/rhel7.7-1675743-old
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 2.0G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
refcount bits: 16
corrupt: false
Result: Newly cloned disk is not preallocated.
Then try to verify this bug with build:
virt-manager-1.5.0-4.el7.noarch
Steps:
1. Clone the original to a new vm with option "--nonsparse"
# virt-clone -o rhel7.7-1675743 -n rhel7.7-1675743-new --nonsparse --file /tmp/rhel7.7-1675743-new
Allocating 'rhel7.7-1675743-new' | 9.0 GB 00:00:30
Clone 'rhel7.7-1675743-new' created successfully.
2. Check the disk info of newly clone vm.
# qemu-img info /tmp/rhel7.7-1675743-new
image: /tmp/rhel7.7-1675743-new
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 1.9G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
refcount bits: 16
corrupt: false
Result: The newly disk is also not preallocated, please help me have a look, thanks.
Whoops I confused myself with this patch and my testing, the --nonsparse check is inverted. So you will see preallocation when --nonsparse is _not_ specified. Thanks for catching it, I'll fix it Verify this bug with new build:
virt-manager-1.5.0-5.el7.noarch
libvirt-4.5.0-17.el7.x86_64
virt-install-1.5.0-5.el7.noarch
qemu-kvm-rhev-2.12.0-28.el7.x86_64
Steps:
1. Prepare a healthy vm which disk format is "qcow2".
# virsh dumpxml testvm
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/testvm'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
# qemu-img info /var/lib/libvirt/images/testvm
image: /var/lib/libvirt/images/testvm
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 4.4G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
2. Clone the original to a new vm.
Scenario-1 with '--nonsparse' argument
2.1.1
# virt-clone -o testvm -n testvm-with-nonsparse --nonsparse --file /tmp/testvm-with-nonsparse
Allocating 'testvm-with-nonsparse' | 9.0 GB 00:01:58
Clone 'testvm-with-nonsparse' created successfully.
2.1.2 Check the disk info of newly clone vm.
# qemu-img info /tmp/testvm-with-nonsparse
image: /tmp/testvm-with-nonsparse
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 9.0G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
refcount bits: 16
corrupt: false
Result: The newly disk is preallocated when "--nonsparse" is specified. it's as expected.
Scenario-2 without '--nonsparse' argument
2.2.1
# virt-clone -o testvm -n testvm-without --file /tmp/testvm-without
Allocating 'testvm-without' | 9.0 GB 00:01:44
Clone 'testvm-without' created successfully.
2.2.2 Check the disk info of newly clone vm.
# qemu-img info /tmp/testvm-without
image: /tmp/testvm-without
file format: qcow2
virtual size: 9.0G (9663676416 bytes)
disk size: 4.3G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
refcount bits: 16
corrupt: false
Result: The newly disk is not preallocated when "--nonsparse" is not specified. it's also as expected.
So I move this bug from ON_QA to VERIFIED, thanks.
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/RHBA-2019:2232 |
Description of problem: virt-clone does not honor '--nonsparse' argument. If passed, the new disk should be thick provisioned, but is instead sparse. Version-Release number of selected component (if applicable): virt-install-1.5.0-1 How reproducible: 100% Steps to Reproduce: 1. virt-clone --connect qemu:///system --original originalVM --name newVM --nonsparse --file /VM/newdisk --debug 2. # ls -lh /VM/newdisk -rw-------. 1 root root 28G Feb 8 21:53 /VM/newdisk 3. # qemu-img info /VM/newdisk image: /VM/newdisk file format: qcow2 virtual size: 100G (107374182400 bytes) disk size: 28G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: true Actual results: Disk is thin provisioned, file size 28G rather than 100G Expected results: Disk should be preallocated, file size 100G Additional info: