Bug 1167998 - virt-install fails to create guest using non-sparse logical volume
Summary: virt-install fails to create guest using non-sparse logical volume
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-virtinst
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Giuseppe Scrivano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-25 20:17 UTC by Kha Do
Modified: 2015-07-22 07:06 UTC (History)
7 users (show)

Fixed In Version: python-virtinst-0.600.0-26.el6
Doc Type: Bug Fix
Doc Text:
Prior to this update, input from the user was validated incorrectly by the virt-install utility. Consequently, a non-sparse LVM could not be created and an error message was displayed. This update fixes the input validation and virt-install can now create a non-sparse LVM as expected and an error no longer occurs.
Clone Of:
Environment:
Last Closed: 2015-07-22 07:06:24 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1372 normal SHIPPED_LIVE python-virtinst bug fix update 2015-07-20 17:58:46 UTC

Description Kha Do 2014-11-25 20:17:59 UTC
Description of problem:

An error is given when trying to install a guest to a non-sparse logical volume using virt-install:

[root@localhost ~]# virt-install --name=test --disk=pool=guests,size=20,sparse=false --cdrom=/mnt/OS.iso --ram=2048
ERROR    Error with storage parameters: Sparse logical volumes are not supported, allocation must be equal to capacity

Version-Release number of selected component (if applicable):

python-virtinst-0.600.0-24

How reproducible:

Steps to Reproduce:
1. Create volume pool
2. Run the above command


Actual results:

ERROR    Error with storage parameters: Sparse logical volumes are not supported, allocation must be equal to capacity

Expected results:

Guest is created

Additional info:

This appears to be a problem introduced with virtinst-LVM-Show-warning-when-allocation-0-and-allocation-ca.patch:

@@ -1350,7 +1350,7 @@ class LogicalVolume(StorageVolume):

     def __init__(self, name, capacity, pool=None, pool_name=None, conn=None,
                  allocation=None, perms=None):
-        if allocation and allocation != capacity:
+        if allocation is not None and allocation != capacity:
             raise ValueError(_("Sparse logical volumes are not supported, "
                                "allocation must be equal to capacity"))
         StorageVolume.__init__(self, name=name, pool=pool, pool_name=pool_name,

Allocation is hard-coded as 0 on line 1478 in cli.py, so this looks like it will always fail:

        volinst = vc(pool_name=pool, name=vname, conn=guest.conn,
                     allocation=0, capacity=(size and
                                             size * 1024 * 1024 * 1024))

Comment 4 zhoujunqin 2015-03-02 07:43:19 UTC
I can reproduce bug issue with following package:
python-virtinst-0.600.0-24.el6.noarch

steps:
1. Create a lvm pool:
# virsh pool-info lvmpool 
Name:           lvmpool
UUID:           48078a48-ca27-2d50-d5b8-bdaed7d1733a
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       10.00 GiB
Allocation:     0.00 
Available:      10.00 GiB

2. Use virt-install to install a guest on logical volume
# virt-install --name=test --disk=pool=lvmpool,size=10,sparse=false --cdrom=/iso/RHEL-6.6-20140926.0-Server-x86_64-dvd1.iso  --ram=2048
ERROR    Error with storage parameters: Sparse logical volumes are not supported, allocation must be equal to capacity

Result: failed to install guest and showing above error.

Then try to verify this bug with new build:
python-virtinst-0.600.0-26.el6.noarch

steps:
# virt-install --name=test --disk=pool=lvmpool,size=10,sparse=false --cdrom=/iso/RHEL-6.6-20140926.0-Server-x86_64-dvd1.iso  --ram=2048

Starting install...
Allocating 'test.img'                                                                                                                 |  10 GB     00:00     
Creating domain...                                                                                                                    |    0 B     00:01     

.....

Result: virt-install create guest using non-sparse logical volume successfully.

# virsh vol-info --pool lvmpool /dev/lvmpool/test.img 
Name:           test.img
Type:           block
Capacity:       10.00 GiB
Allocation:     10.00 GiB

so move this bug from ON_QA to VERIFIED.

Comment 5 errata-xmlrpc 2015-07-22 07:06:24 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.

https://rhn.redhat.com/errata/RHBA-2015-1372.html


Note You need to log in before you can comment on or make changes to this bug.