Bug 873545
| Summary: | virt-install parameter sparse=false doesn't take effect | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | tingting zheng <tzheng> |
| Component: | python-virtinst | Assignee: | Giuseppe Scrivano <gscrivan> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.4 | CC: | bugzilla-redhat, cwei, lcui, mjenner, mtessun, mzhan, wim.ten.have |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | python-virtinst-0.600.0-20.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-10-14 06:23:23 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: | |||
| Bug Depends On: | |||
| Bug Blocks: | 994246 | ||
Do more test,and found that parameter --nonsparse doesn't work for virt-clone.
Steps:
1.Prepare a guest with sparse disk.
# virsh dumpxml test
……
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/test.img'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
……
# qemu-img info /var/lib/libvirt/images/test.img
image: /var/lib/libvirt/images/test.img
file format: raw
virtual size: 6.0G (6442450944 bytes)
disk size: 3.3G
# ll -lsh /var/lib/libvirt/images/test.img
3.4G -rwxr-xr-x. 1 root root 6.0G Dec 12 13:21 /var/lib/libvirt/images/test.img
2.Use virt-clone to clone the guest,add parameter --nonsparse
virt-clone -o test -n test-clone -f /tmp/test.img --nonsparse
Cloning test.img | 6.0 GB 02:39
Clone 'test-clone' created successfully.
3.Check the disk of the new cloned guest,it is still sparse.
# qemu-img info /tmp/test.img
image: /tmp/test.img
file format: raw
virtual size: 6.0G (6442450944 bytes)
disk size: 3.3G
# ll -lsh /tmp/test.img
3.3G -rwxr-xr-x. 1 root root 6.0G Dec 12 13:27 /tmp/test.img
Reproduced the bug with the following package:
# rpm -qa libvirt python-virtinst
python-virtinst-0.600.0-18.el6.noarch
libvirt-0.10.2-26.el6.x86_64
And the value of sparse are yes or no in error notification are not same with the value in manual: true or false.
# virt-install -n T -r 1024 --vcpus=2 --disk path=/var/lib/libvirt/images/T.img,size=4 -l $URL --nonsparse
ERROR Cannot mix --file, --nonsparse, or --file-size with --disk options. Use --disk PATH[,size=SIZE][,sparse=yes|no]
in the manual
sparse
whether to skip fully allocating newly created storage. Value is ’true’ or ’false’.
Default is ’true’ (do not fully allocate).
Reproduced the bug with the following packages from current RHEL6.4: rpm -qa libvirt python-virtinst libvirt-0.10.2-18.el6_4.14.x86_64 python-virtinst-0.600.0-15.el6.noarch 1.) sparse=no or sparse=false makes no change 2.) mixing --disk and -f does not work (as documented) 3.) using only -f and the other "obsolte" paramters work. This does not work: --disk sparse=false,path=/var/lib/libvirt/images/$newhostname.disk,size=200 This works as expected: -f /var/lib/libvirt/images/$newhostname.disk -s 200 --nonsparse and creates a sparse 200G file. (In reply to Jens Kuehnel from comment #5) > Reproduced the bug with the following packages from current RHEL6.4: > rpm -qa libvirt python-virtinst > libvirt-0.10.2-18.el6_4.14.x86_64 > python-virtinst-0.600.0-15.el6.noarch Ok, my versions slightly differ as I am using libvirt-0.10.2-18.el6_4.9.x86_64 > > 1.) sparse=no or sparse=false makes no change Installing with the following commandline: # virt-install -n demo1 -r 1024 --vnc -c /VirtualMachines/ISO/RHEL6.4-20130130.0-Server-x86_64-DVD1.iso --disk path=/VirtualMachines/demo1.img,size=5,sparse=false lasts a long time to create the 5GB disk, so I believe this is not sparse (writing 18MB per second;) but we check: qemu-img info /VirtualMachines/demo1.img image: /VirtualMachines/demo1.img file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 5.0G So this is indeed no sparse file. Deleting the file and doing again with sparse=true: [mtessun@mtessun ~]$ qemu-img info /VirtualMachines/demo1.img image: /VirtualMachines/demo1.img file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 0 So this seems to work for me. > 2.) mixing --disk and -f does not work (as documented) Ok. This is expected isn't it? > 3.) using only -f and the other "obsolte" paramters work. > > This does not work: > --disk sparse=false,path=/var/lib/libvirt/images/$newhostname.disk,size=200 > > This works as expected: > -f /var/lib/libvirt/images/$newhostname.disk -s 200 --nonsparse > and creates a sparse 200G file. Did it create a sparse file? Or a nonsparse file? Testing with the old (obsoleted) parameters works as well here: # virt-install -n demo1 -r 1024 --vnc -c /VirtualMachines/ISO/RHEL6.4-20130130.0-Server-x86_64-DVD1.iso -f /VirtualMachines/demo1.img -s 5 --nonsparse again creates a 5GB disk nonsparse and # virt-install -n demo1 -r 1024 --vnc -c /VirtualMachines/ISO/RHEL6.4-20130130.0-Server-x86_64-DVD1.iso -f /VirtualMachines/demo1.img -s 5 creates a sparse file. Just did a second test with the exact same versions as mentioned in comment #5: just did a second test: [root@inf13 ~]# virt-install -n demo1 -r 1024 --vnc -c /VirtualMachines/test.iso --disk sparse=false,path=/VirtualMachines/test.img,size=5 Starting install... Creating storage file test.img | 5.0 GB 00:32 Creating domain... | 0 B 00:00 WARNING Unable to connect to graphical console: virt-viewer not installed. Please install the 'virt-viewer' package. Domain installation still in progress. You can reconnect to the console to complete the installation process. [root@inf13 ~]# qemu-img info /VirtualMachines/test.img image: /VirtualMachines/test.img file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 5.0G This time with the following versions: [root@inf13 ~]# rpm -q -a libvirt python-virtinst libvirt-0.10.2-18.el6_4.14.x86_64 python-virtinst-0.600.0-15.el6.noarch (In reply to Martin Tessun from comment #7) > [root@inf13 ~]# virt-install -n demo1 -r 1024 --vnc -c > /VirtualMachines/test.iso --disk > sparse=false,path=/VirtualMachines/test.img,size=5 Yes, works here as well when I put it else where. Please put the image into /var/lib/libvirt/images/ and try again. Hi, work also when using pool like this: --disk pool=default,size=20,sparse=false (In reply to Jens Kuehnel from comment #8) > (In reply to Martin Tessun from comment #7) > > > [root@inf13 ~]# virt-install -n demo1 -r 1024 --vnc -c > > /VirtualMachines/test.iso --disk > > sparse=false,path=/VirtualMachines/test.img,size=5 > > Yes, works here as well when I put it else where. Please put the image into > /var/lib/libvirt/images/ and try again. Indeed. That's interessting. Installing in /var/lib/libvirt/images does not respect the sparse-flag. [root@inf13 ~]# virt-install -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,path=/var/lib/libvirt/images/test.img,size=5 Starting install... Creating domain... | 0 B 00:00 WARNING Unable to connect to graphical console: virt-viewer not installed. Please install the 'virt-viewer' package. Domain installation still in progress. You can reconnect to the console to complete the installation process. [root@inf13 ~]# qemu-img info /var/lib/libvirt/images/test.img image: /var/lib/libvirt/images/test.img file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 0 I did try with filename /var/lib/libvirt/test.img again, an the file is created correctly. This looks to me as if it is intentional (as it only does not work when using /var/lib/libvirt/images as destination), but undocumented. Con someone please confirm? I did now run all three "possible" creation scripts that where discussed here with --debug switch.
I stripped the definition of the domains, as this is not of interest.
Running with --debug:
1. Usinf /var/lib/libvitrt/images as a path (DEFAULT_POOL_PATH):
[root@inf13 ~]# virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,path=/var/lib/libvirt/images/test.img,size=5
Fri, 25 Oct 2013 08:40:58 DEBUG Launched with command line:
/usr/sbin/virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,path=/var/lib/libvirt/images/test.img,size=5
Fri, 25 Oct 2013 08:40:58 DEBUG Requesting libvirt URI default
Fri, 25 Oct 2013 08:40:58 DEBUG Received libvirt URI qemu:///system
Fri, 25 Oct 2013 08:40:58 DEBUG Requesting virt method 'default', hv type 'default'.
Fri, 25 Oct 2013 08:40:58 DEBUG Received virt method 'hvm'
Fri, 25 Oct 2013 08:40:58 DEBUG Hypervisor name is 'kvm'
Fri, 25 Oct 2013 08:40:58 DEBUG --graphics compat generated: vnc
Fri, 25 Oct 2013 08:40:58 DEBUG Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'test.img'.
Fri, 25 Oct 2013 08:40:58 DEBUG Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'test.img'.
Fri, 25 Oct 2013 08:40:58 DEBUG DistroInstaller location is a local file/path: /tmp/test.iso
Fri, 25 Oct 2013 08:40:58 DEBUG Guest.has_install_phase: True
Starting install...
Fri, 25 Oct 2013 08:40:58 DEBUG Creating storage volume 'test.img' with xml:
<volume>
<name>test.img</name>
<capacity>5368709120</capacity>
<allocation>0</allocation> <====== This should be equal to capacity!!!
<target>
<format type='raw'/>
</target>
</volume>
Allocating 'test.img' | 5.0 GB 00:00
Fri, 25 Oct 2013 08:40:58 DEBUG Storage volume 'test.img' install complete.
Fri, 25 Oct 2013 08:40:59 DEBUG Generated install XML:
...
So the image gets created from some xml-file in this case.
2. Creating disk in /var/lib/libvirt
[root@inf13 ~]# virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,path=/var/lib/libvirt/test.img,size=5
Fri, 25 Oct 2013 08:42:32 DEBUG Launched with command line:
/usr/sbin/virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,path=/var/lib/libvirt/test.img,size=5
Fri, 25 Oct 2013 08:42:32 DEBUG Requesting libvirt URI default
Fri, 25 Oct 2013 08:42:32 DEBUG Received libvirt URI qemu:///system
Fri, 25 Oct 2013 08:42:32 DEBUG Requesting virt method 'default', hv type 'default'.
Fri, 25 Oct 2013 08:42:32 DEBUG Received virt method 'hvm'
Fri, 25 Oct 2013 08:42:32 DEBUG Hypervisor name is 'kvm'
Fri, 25 Oct 2013 08:42:32 DEBUG --graphics compat generated: vnc
Fri, 25 Oct 2013 08:42:32 DEBUG DistroInstaller location is a local file/path: /tmp/test.iso
Fri, 25 Oct 2013 08:42:32 DEBUG Guest.has_install_phase: True
Starting install...
Creating storage file test.img | 5.0 GB 00:36
Fri, 25 Oct 2013 08:43:09 DEBUG Generated install XML:
...
This time the file is created "manully" not vir libvirt.
3. Using pool=default (DEFAULT_POOL) instead of disk=
[root@inf13 ~]# virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,pool=default,size=5
Fri, 25 Oct 2013 08:46:43 DEBUG Launched with command line:
/usr/sbin/virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=false,pool=default,size=5
Fri, 25 Oct 2013 08:46:43 DEBUG Requesting libvirt URI default
Fri, 25 Oct 2013 08:46:43 DEBUG Received libvirt URI qemu:///system
Fri, 25 Oct 2013 08:46:43 DEBUG Requesting virt method 'default', hv type 'default'.
Fri, 25 Oct 2013 08:46:43 DEBUG Received virt method 'hvm'
Fri, 25 Oct 2013 08:46:43 DEBUG Hypervisor name is 'kvm'
Fri, 25 Oct 2013 08:46:43 DEBUG --graphics compat generated: vnc
Fri, 25 Oct 2013 08:46:43 DEBUG DistroInstaller location is a local file/path: /tmp/test.iso
Fri, 25 Oct 2013 08:46:43 DEBUG Guest.has_install_phase: True
Starting install...
Fri, 25 Oct 2013 08:46:43 DEBUG Creating storage volume 'demo1.img' with xml:
<volume>
<name>demo1.img</name>
<capacity>5368709120</capacity>
<allocation>5368709120</allocation>
<target>
<format type='raw'/>
</target>
</volume>
Allocating 'demo1.img' | 5.0 GB 00:00
Fri, 25 Oct 2013 08:46:43 DEBUG Storage volume 'demo1.img' install complete.
Fri, 25 Oct 2013 08:46:43 DEBUG Generated install XML:
...
Here again the image is created via libvirt, but this time the allocation policy matches.
4. Just for completion again with pool but with sparse=true:
[root@inf13 ~]# virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=true,pool=default,size=5
Fri, 25 Oct 2013 08:54:25 DEBUG Launched with command line:
/usr/sbin/virt-install --debug -n demo1 -r 1024 --vnc -c /tmp/test.iso --disk sparse=true,pool=default,size=5
Fri, 25 Oct 2013 08:54:25 DEBUG Requesting libvirt URI default
Fri, 25 Oct 2013 08:54:25 DEBUG Received libvirt URI qemu:///system
Fri, 25 Oct 2013 08:54:25 DEBUG Requesting virt method 'default', hv type 'default'.
Fri, 25 Oct 2013 08:54:25 DEBUG Received virt method 'hvm'
Fri, 25 Oct 2013 08:54:25 DEBUG Hypervisor name is 'kvm'
Fri, 25 Oct 2013 08:54:25 DEBUG --graphics compat generated: vnc
Fri, 25 Oct 2013 08:54:26 DEBUG DistroInstaller location is a local file/path: /tmp/test.iso
Fri, 25 Oct 2013 08:54:26 DEBUG Guest.has_install_phase: True
Starting install...
Fri, 25 Oct 2013 08:54:26 DEBUG Creating storage volume 'demo1.img' with xml:
<volume>
<name>demo1.img</name>
<capacity>5368709120</capacity>
<allocation>0</allocation>
<target>
<format type='raw'/>
</target>
</volume>
Allocating 'demo1.img' | 5.0 GB 00:00
Fri, 25 Oct 2013 08:54:26 DEBUG Storage volume 'demo1.img' install complete.
Fri, 25 Oct 2013 08:54:26 DEBUG Generated install XML:
...
So here it works as expected again.
I can reproduce the issue with: python-virtinst-0.600.0-18.el6.noarch libvirt-0.10.2-26.el6.x86_64 Verify the issue with: python-virtinst-0.600.0-20.el6.noarch virt-manager-0.9.0-20.el6.x86_64 1. virt-install -n demo1 -r 1024 --vnc -l http://tree.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.3/Server/x86_64/os/ --disk path=/var/lib/libvirt/images/demo1.img,size=2,sparse=false # qemu-img info /var/lib/libvirt/images/demo1.img image: /var/lib/libvirt/images/demo1.img file format: raw virtual size: 2.0G (2147483648 bytes) disk size: 2.0G 2. virt-install -n demo2 -r 1024 --vnc -l http://tree.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.3/Server/x86_64/os/ -f /var/lib/libvirt/images/demo2.img -s 2 --nonsparse Starting install... Retrieving file vmlinuz... | 7.6 MB 00:00 ... Retrieving file initrd.img... | 58 MB 00:00 ... Allocating 'demo2.img' | 2.0 GB 00:31 Creating domain... | 0 B 00:00 # qemu-img info /var/lib/libvirt/images/demo2.img image: /var/lib/libvirt/images/demo2.img file format: raw virtual size: 2.0G (2147483648 bytes) disk size: 2.0G 3. # virt-install -n demo3 -r 1024 --vnc -l http://tree.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.3/Server/x86_64/os/ --disk pool=default,,size=2,sparse=false Starting install... Retrieving file vmlinuz... | 7.6 MB 00:00 ... Retrieving file initrd.img... | 58 MB 00:00 ... Allocating 'demo3.img' | 2.0 GB 00:32 Creating domain... | 0 B 00:00 # qemu-img info /var/lib/libvirt/images/demo3.img image: /var/lib/libvirt/images/demo3.img file format: raw virtual size: 2.0G (2147483648 bytes) disk size: 2.0G 4. Test sparse=true, correct either. # virt-install -n demo4 -r 1024 --vnc -l http://tree.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.3/Server/x86_64/os/ --disk pool=default,,size=2,sparse=true Starting install... Retrieving file vmlinuz... | 7.6 MB 00:00 ... Retrieving file initrd.img... | 58 MB 00:00 ... Allocating 'demo4.img' | 2.0 GB 00:00 Creating domain... | 0 B 00:00 # qemu-img info /var/lib/libvirt/images/demo4.img image: /var/lib/libvirt/images/demo4.img file format: raw virtual size: 2.0G (2147483648 bytes) disk size: 0 So change the status from 'ON_QA' to 'VERIFIED' 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/RHBA-2014-1444.html |
Description virt-install parameter sparse=false doesn't take effect Version python-virtinst-0.600.0-12.el6.noarch libvirt-0.10.2-7.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1.Use virt-install to install a guest,add parameter sparse=false # virt-install -n demo1 -r 1024 --vnc -c /root/Desktop/RHEL6.3-20120613.2-Server-x86_64-DVD1.iso --disk path=/var/lib/libvirt/images/demo1.img,size=5,sparse=false Starting install... Allocating 'demo1.img' | 6.0 GB 00:00 Creating domain... # ll -lsh /var/lib/libvirt/images/demo1.img 0 -rw-------. 1 qemu qemu 5.0G Nov 6 11:37 /var/lib/libvirt/images/demo1.img # qemu-img info /var/lib/libvirt/images/demo1.img image: /var/lib/libvirt/images/demo1.img file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 0 2.After install the guest,check the disk: # qemu-img info /var/lib/libvirt/images/demo1.img image: /var/lib/libvirt/images/demo1.img file format: raw virtual size: 5.0G (5368709120 bytes) disk size: 1.7G # ll -lsh /var/lib/libvirt/images/demo1.img 1.8G -rw-------. 1 qemu qemu 5.0G Nov 6 11:35 /var/lib/libvirt/images/demo1.img | 0 B 00:00 Actual results: virt-install parameter sparse=false doesn't take effect,as steps show. Expected results: virt-install parameter sparse=false take effect Additional info: