Bug 1177219
| Summary: | [Storage] vol-download / upload works well with an offset which was "too large" | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Pei Zhang <pzhang> |
| Component: | libvirt | Assignee: | Erik Skultety <eskultet> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, jferlan, lhuang, mzhan, pkrempa, rbalakri, xuzhang, yanyang, yisun |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.14-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:05:48 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: | |||
Fixed upstream:
commit 3fde7986d6694f122ae919d68ec64eee79bd51db
Author: Erik Skultety <eskultet>
Date: Tue Mar 3 16:57:38 2015 +0100
storage: tweak condition to properly test lseek
According to the POSIX standard, off_t (returned by lseek) is defined as
signed integral type no shorter than int. Because our offset variable is defined
as unsigned long long, the original check was passed successfully if UINT64_MAX had
been used as offset value, due to implicit conversion.
v1.2.13-56-g3fde798
Verified
On Versions:
libvirt-1.2.15-2.el7.x86_64
verify steps:
# cat qcow2.vol
<volume>
<name>qcow2-vol</name>
<source>
</source>
<capacity unit='bytes'>1024000000</capacity>
<allocation unit='bytes'>204000</allocation>
<target>
<format type='qcow2'/>
<features>
<lazy_refcounts/>
</features>
</target>
</volume>
# virsh vol-create default qcow2.vol
Vol qcow2-vol created from qcow2.vol
# cat raw.vol
<volume>
<name>raw-vol</name>
<source>
</source>
<capacity unit='bytes'>589934592</capacity>
<allocation unit='bytes'>56063232</allocation>
<target>
<format type='raw'/>
</target>
</volume>
# virsh vol-create default raw.vol
Vol raw-vol created from raw.vol
use 2^64-1 (18446744073709551615) as boundary, all produce error messages as expected.
# virsh vol-download --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551613 --length 18
error: cannot download from volume qcow2-vol
error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551613: Invalid argument
# virsh vol-download --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551614 --length 18
error: cannot download from volume qcow2-vol
error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551614: Invalid argument
# virsh vol-download --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551615 --length 18
error: cannot download from volume qcow2-vol
error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551615: Invalid argument
And the vol-upload check. # virsh vol-upload --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551613 --length 18446744073709551615 error: cannot upload to volume qcow2-vol error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551613: Invalid argument # virsh vol-upload --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551614 --length 18446744073709551615 error: cannot upload to volume qcow2-vol error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551614: Invalid argument # virsh vol-upload --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551615 --length 18446744073709551615 error: cannot upload to volume qcow2-vol error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551615: Invalid argument 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-2015-2202.html |
Description of problem: Try to do vol-download /upload with an offset which is too large (eg.UINT64_MAX) , it will be successful . But value which is less than UINT64_MAX is invalid and will give error if using it . Version-Release number of selected component (if applicable): libvirt-1.2.8-11.el7.x86_64 qemu-kvm-rhev-2.1.2-17.el7.x86_64 kernel-3.10.0-217.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.create two volumes in the default pool # cat default-volume.xml <volume> <name>qcow2-vol</name> <source> </source> <capacity unit='bytes'>1024000000</capacity> <allocation unit='bytes'>204000</allocation> <target> <format type='qcow2'/> <features> <lazy_refcounts/> </features> </target> </volume> # virsh vol-create default default-volume.xml Vol qcow2-vol created from default-volume.xml # cat raw-vol.xml <volume> <name>raw-vol</name> <source> </source> <capacity unit='bytes'>589934592</capacity> <allocation unit='bytes'>56063232</allocation> <target> <format type='raw'/> </target> </volume> # virsh vol-create default raw-vol.xml Vol raw-vol created from raw-vol.xml check volumes in default pool # virsh vol-list default Name Path ------------------------------------------------------------------------------ qcow2-vol /var/lib/libvirt/images/qcow2-vol raw-vol /var/lib/libvirt/images/raw-vol 2.try to do vol-upload/download with an offset that was "too large" 2.1 try to download qcow2-vol to raw by passing an offset with too large value # virsh vol-download --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551614 --length 18446744073709551614 error: cannot download to volume qcow2-vol error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551614: Invalid argument NOTE : if set an offset that was 18446744073709551615 ,it will download successfully. # virsh vol-download --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551615 --length 18446744073709551615 # virsh vol-download --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551616 --length 18446744073709551616 error: Unable to parse offset value 2.2 try to upload qcow2 to raw by passing an offset with too large value # virsh vol-upload --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551614 --length 18446744073709551615 error: cannot upload to volume qcow2-vol error: Unable to seek /var/lib/libvirt/images/qcow2-vol to 18446744073709551614: Invalid argument NOTE : if set an offset that was 18446744073709551615 ,it will upload successfully. # virsh vol-upload --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551615 --length 18446744073709551615 # virsh vol-upload --pool default qcow2-vol /var/lib/libvirt/images/raw-vol --offset 18446744073709551616 --length 18446744073709551616 error: Unable to parse offset value Actuall result : As step 2 , the value *1614 and *1616 is invalid and give error message if try to use it . But the *1615 value works well . Expect result : The *1615 value should also be invalid and cannot be used .