Bug 823362

Summary: vol-create-as should fail when allocate a malformed size image
Product: Red Hat Enterprise Linux 6 Reporter: zhpeng
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, cwei, dallan, dyasny, dyuan, mzhan, rwu, veillard, whuang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.13-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:14:56 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 zhpeng 2012-05-21 02:52:15 UTC
Description of problem:
vol-create-as should fail when allocate a malformed size image

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-0.12.1.2-2.292.el6.x86_64
libvirt-0.9.10-20.el6.x86_64
kernel-2.6.32-270.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1, define and start a nfs pool
virsh # pool-info nfs
Name:           nfs
UUID:           9401f015-e2cb-2cb2-2c05-83ba92c8cb4b
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       98.43 GB       ----------> pool capacity
Allocation:     58.37 GB
Available:      40.06 GB

2,create a malformed size image

virsh # vol-create-as nfs big 10000000000000000000000000000000000000G
error: Malformed size 10000000000000000000000000000000000000G
error: Failed to create vol big
error: cannot extend file '/nfs/big': File too large

virsh # vol-create-as nfs big 100000000000G
error: Malformed size 100000000000G
Vol big created             -------------> This takes a long time and should fail

virsh # vol-info /nfs/big --pool nfs
Name:           big
Type:           file
Capacity:       93.13 GB          ------> wrong size. and this image should not exist
Allocation:     373.63 MB

3, create a over commit image in the pool
virsh # vol-create-as nfs big6 100G
Vol big6 created                     ------------> a long time

virsh # vol-info --pool nfs big6
Name:           big6
Type:           file
Capacity:       100.00 GB           -------> expect
Allocation:     401.18 MB



Actual results:
As Steps

Expected results:
1,virsh command should fail when create a malformed size image.
2,create a normal image in nfs pool with vol-create-as should be faster

Additional info:

Comment 1 Osier Yang 2012-06-05 07:35:22 UTC
(In reply to comment #0)
> Description of problem:
> vol-create-as should fail when allocate a malformed size image
> 
> Version-Release number of selected component (if applicable):
> qemu-kvm-rhev-0.12.1.2-2.292.el6.x86_64
> libvirt-0.9.10-20.el6.x86_64
> kernel-2.6.32-270.el6.x86_64
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> 1, define and start a nfs pool
> virsh # pool-info nfs
> Name:           nfs
> UUID:           9401f015-e2cb-2cb2-2c05-83ba92c8cb4b
> State:          running
> Persistent:     yes
> Autostart:      yes
> Capacity:       98.43 GB       ----------> pool capacity
> Allocation:     58.37 GB
> Available:      40.06 GB
> 
> 2,create a malformed size image
> 
> virsh # vol-create-as nfs big 10000000000000000000000000000000000000G
> error: Malformed size 10000000000000000000000000000000000000G
> error: Failed to create vol big
> error: cannot extend file '/nfs/big': File too large
> 
> virsh # vol-create-as nfs big 100000000000G
> error: Malformed size 100000000000G
> Vol big created             -------------> This takes a long time and should
> fail
> 
> virsh # vol-info /nfs/big --pool nfs
> Name:           big
> Type:           file
> Capacity:       93.13 GB          ------> wrong size. and this image should
> not exist
> Allocation:     373.63 MB
> 
> 3, create a over commit image in the pool
> virsh # vol-create-as nfs big6 100G
> Vol big6 created                     ------------> a long time
> 
> virsh # vol-info --pool nfs big6
> Name:           big6
> Type:           file
> Capacity:       100.00 GB           -------> expect
> Allocation:     401.18 MB
> 
> 
> 
> Actual results:
> As Steps
> 
> Expected results:
> 1,virsh command should fail when create a malformed size image.

This is right requirement.

> 2,create a normal image in nfs pool with vol-create-as should be faster
> 

And this is not, as it's filesystem related, you can't expect libvirt to drive
the filesystem more faster.

Comment 2 Osier Yang 2012-06-05 07:36:14 UTC
commit ee58b581c4b275f06904253285b7ad562dc09745
Author: Osier Yang <jyang>
Date:   Mon Jun 4 17:08:34 2012 +0800

    virsh: Back out if the argument for vol-create-as is malformed

Commit in upstream, move to POST.

Comment 5 Huang Wenlong 2012-07-24 05:30:55 UTC
Verify this bug with 
libvirt-0.9.13-3.el6.x86_64


# virsh vol-create-as netfs big 10000000000000G
error: Malformed size 10000000000000G

[root@intel-q9400-4-2 virsh-rail]# virsh pool-info netfs
Name:           netfs
UUID:           302df04c-6927-e9cd-2719-c7a3a7ed436b
State:          running
Persistent:     no
Autostart:      no
Capacity:       141.89 GiB
Allocation:     99.83 GiB
Available:      42.06 GiB

Comment 6 errata-xmlrpc 2013-02-21 07:14:56 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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html