Bug 1298065
Summary: | The size of raw image is incorect after clone without --nonsparse | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Xiaodai Wang <xiaodwan> |
Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.3 | CC: | jtomko, juzhou, mxie, mzhan, rbalakri, tzheng, yisun |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
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:36: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
Xiaodai Wang
2016-01-13 06:25:59 UTC
Fixed upstream by: commit dd519a294b22646b8dab26627707a525556df4d4 Author: Prerna Saxena <prerna.ibm.com> CommitDate: 2015-07-10 08:54:10 +0200 Fix cloning of raw, sparse volumes When virsh vol-clone is attempted on a raw file where capacity > allocation, the resulting cloned volume has a size that matches the virtual-size of the parent; in place of matching its actual, disk size. This patch fixes the cloned disk to have same _allocated_size_ as the parent file from which it was cloned. Ref: http://www.redhat.com/archives/libvir-list/2015-May/msg00050.html Also fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1130739 Signed-off-by: Prerna Saxena <prerna.ibm.com> Signed-off-by: Ján Tomko <jtomko> git describe: v1.2.17-74-gdd519a2 contains: v1.2.18-rc1~100 Verified and PASSED versions: qemu-kvm-rhev-2.3.0-31.el7_2.7.x86_64 libvirt-1.3.1-1.el7.x86_64 virt-install-1.2.1-8.el7.noarch prepare disks In host: # qemu-img create -f qcow2 /var/lib/libvirt/images/qcow2 10G # qemu-img create -f raw /var/lib/libvirt/images/raw 5G # virsh dumpxml vm1 | grep var -a2 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.qcow2'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> -- <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/qcow2'/> <target dev='hdb' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> -- <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/raw'/> <target dev='hdc' bus='ide'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> In guest: #mkfs.xfs /dev/sdb; mkfs.xfs /dev/sdc #mkdir /raw; mkdir /qcow2 #mount /dev/sdb /qcow2; mount /dev/sdc/raw #dd if=/dev/urandom of=/raw/bigfile count=1000 bs=1M #dd if=/dev/urandom of=/qcow2/bigfile count=2000 bs=1M steps: 1. check original images' info # qemu-img info /var/lib/libvirt/images/qcow2 image: /var/lib/libvirt/images/qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 2.0G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false # qemu-img info /var/lib/libvirt/images/raw image: /var/lib/libvirt/images/raw file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 1.0G 2. use virt-clone to do the clone and check the new images' info # virt-clone -o vm1 -f /var/lib/libvirt/images/rhel7-clone -f /tmp/qcow2-clone -f /tmp/raw-clone -n JustATest # qemu-img info /tmp/qcow2-clone image: /tmp/qcow2-clone file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 2.0G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: true refcount bits: 16 corrupt: false # qemu-img info /tmp/raw-clone image: /tmp/raw-clone file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 1.0G 3. use virsh vol-clone to do the clone and check the new images' info # virsh vol-clone --pool default --vol qcow2 qcow2-clone Vol qcow2-clone cloned from qcow2 # virsh vol-clone --pool default --vol raw raw-clone Vol raw-clone cloned from raw # qemu-img info /var/lib/libvirt/images/qcow2-clone image: /var/lib/libvirt/images/qcow2-clone file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 2.0G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false # qemu-img info /var/lib/libvirt/images/raw-clone image: /var/lib/libvirt/images/raw-clone file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 1.0G 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 |