Bug 718632

Summary: [RFE] vol-create-as should not allow to create image which "capacity" is far less than "allocation"
Product: Red Hat Enterprise Linux 6 Reporter: Huang Wenlong <whuang>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.2CC: cwei, dallan, dyuan, mbooth, rwu
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-10 21:02:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Huang Wenlong 2011-07-04 05:08:08 UTC
Description of problem:
vol-create-as should not allow  to create image which capacity << allocation
it will generate virt-v2v get wrong image size from libvirt(capacity) ,it look very confusing if capacity << allocation

virt-v2v create a image metadata file when it convert a guest to rhevm , the metadata file's "SIZE=16777216"(read it from image's capacity),but actually image size is 8G
it is not correct 

Version-Release number of selected component (if applicable):
libvirt-0.9.2-1.el6.x86_64
qemu-kvm-0.12.1.2-2.165.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.create a vol with virsh vol-create-as   capacity << allocation

#virsh vol-create-as default vol-create.img 1G --allocation 8G --format raw 
Vol vol-create.img created

# virsh vol-info /var/lib/libvirt/images/vol-create.img 
Name:           vol-create.img
Type:           file
Capacity:       1.00 GB
Allocation:     8.00 GB


2.install a guest with vol-create.img  ,guest named vol-create

3.virt-v2v convert this guest to rhevm NFS storage
#virt-v2v -o rhev -os 10.66.72.122:/mnt/sdb/manual_export -n rhevm vol-create
4. check the metadata file in NFS storage 
## cat ./987c21e1-0e85-4c2f-a13d-dd7477015186/images/4be3ca79-445b-4414-b42c-b2196a1439ef/234013e8-23eb-4ddb-b430-75fc62c9ae11.meta

DOMAIN=987c21e1-0e85-4c2f-a13d-dd7477015186
VOLTYPE=LEAF
CTIME=1309501737
FORMAT=RAW
IMAGE=4be3ca79-445b-4414-b42c-b2196a1439ef
DISKTYPE=1
PUUID=00000000-0000-0000-0000-000000000000
LEGALITY=LEGAL
MTIME=1309501737
POOL_UUID=00000000-0000-0000-0000-000000000000
SIZE=16777216
TYPE=PREALLOCATED
DESCRIPTION=Exported by virt-v2v
EOF

5.check the actually image size 
# ll -sh ./987c21e1-0e85-4c2f-a13d-dd7477015186/images/4be3ca79-445b-4414-b42c-b2196a1439ef/234013e8-23eb-4ddb-b430-75fc62c9ae11
8.1G -rw-r--r-- 1 36 kvm 8.0G Jul  1 13:45 ./987c21e1-0e85-4c2f-a13d-dd7477015186/images/4be3ca79-445b-4414-b42c-b2196a1439ef/234013e8-23eb-4ddb-b430-75fc62c9ae11

  
Actual results:
vol-create can create a image  capacity << allocation  

Expected results:
vol-create can not create a image  capacity << allocation  

Additional info:

Comment 2 Dave Allan 2011-11-10 21:02:20 UTC
There is little demand for this feature, so I'm closing as WONTFIX.