Bug 1198517

Summary: virt-install get error when specify a non-lvm pool
Product: Red Hat Enterprise Linux 6 Reporter: CongDong <codong>
Component: python-virtinstAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.7CC: gscrivan, juzhou, mzhan, rbalakri, tlavigne, tzheng
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-virtinst-0.600.0-27.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:06:36 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 CongDong 2015-03-04 10:26:29 UTC
Description of problem:
As subject

Version-Release number of selected component (if applicable):
virt-manager-0.9.0-29.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
# virt-install --name demo \
                  --ram 1024 \
                  --disk pool=default,size=1,device=disk \
                  --location http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os/ \
                  --vnc \
                  -d

Actual results:
Get error:
Wed, 04 Mar 2015 16:52:02 DEBUG    Launched with command line:
/usr/sbin/virt-install --name demo --ram 1024 --disk pool=default,size=1,device=disk --location http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os/ --vnc -d
Wed, 04 Mar 2015 16:52:02 DEBUG    Requesting libvirt URI default
Wed, 04 Mar 2015 16:52:02 DEBUG    Received libvirt URI qemu:///system
Wed, 04 Mar 2015 16:52:02 DEBUG    Requesting virt method 'default', hv type 'default'.
Wed, 04 Mar 2015 16:52:02 DEBUG    Received virt method 'hvm'
Wed, 04 Mar 2015 16:52:02 DEBUG    Hypervisor name is 'kvm'
Wed, 04 Mar 2015 16:52:02 DEBUG    --graphics compat generated: vnc
Wed, 04 Mar 2015 16:52:02 ERROR    Error with storage parameters: Allocation must be a non-negative number
Wed, 04 Mar 2015 16:52:02 DEBUG    Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 137, in get_disk
    dev, size = cli.parse_disk(guest, diskopts)
  File "/usr/lib/python2.6/site-packages/virtinst/cli.py", line 1570, in parse_disk
    size, fmt, sparse)
  File "/usr/lib/python2.6/site-packages/virtinst/cli.py", line 1479, in _parse_disk_source
    capacity=(size and size * 1024 * 1024 * 1024))
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 1367, in __init__
    conn=conn)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 1053, in __init__
    self.allocation = allocation
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 1157, in set_allocation
    raise ValueError(_("Allocation must be a non-negative number"))
ValueError: Allocation must be a non-negative number

Expected results:
Should install the guest successfully.

Additional info:
virtinst/Storage.py, __init__() in FileVolume and DiskVolume,

    def __init__(self, name, capacity, pool=None, pool_name=None, conn=None,
                 format="raw", allocation=None, perms=None):
        StorageVolume.__init__(self, name=name, pool=pool, pool_name=pool_name,
                               allocation=allocation, capacity=capacity,
                               conn=conn)

The value of allocation is "None" by default, I think this is caused by fixing bug 1167998.
This problem cannot be reproduced with previous version virt-manager, so set "Regression".

Comment 2 Giuseppe Scrivano 2015-03-04 11:39:39 UTC
could you try if the following patch fixes the problem for you?

diff --git a/virtinst/cli.py b/virtinst/cli.py
index 311c6c5..a0aed96 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1475,8 +1475,9 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
                                                               pool_name=pool,
                                                               name=guest.name,
                                                               suffix=".img")
+        cap = size and size * 1024 * 1024 * 1024
         volinst = vc(pool_name=pool, name=vname, conn=guest.conn,
-                     capacity=(size and size * 1024 * 1024 * 1024))
+                     allocation=cap, capacity=cap)
         if fmt:
             if not hasattr(volinst, "format"):
                 raise ValueError(_("Format attribute not supported for this "


I am going to do more tests here before I post it.

Comment 8 zhoujunqin 2015-03-06 05:23:38 UTC
I can reproduce this issue with package:
python-virtinst-0.600.0-26.el6.noarch

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

Steps:
# virsh pool-list --all
Name                 State      Autostart 
-----------------------------------------
default              active     yes       
lvmpool              active     yes       
nfsp                 active     yes       

1. Install a guest on a non-lvm pool:
with dir pool:

# virt-install --name demo-test --ram 1024 --disk pool=default,size=5,device=disk --location  http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os/ --vnc 

Starting install...
Retrieving file .treeinfo...         
...

Result: Guest can be installed with no error. 

with nfs pool:
# virt-install --name demo-nfsp --ram 1024 --disk pool=nfsp,size=5,device=disk --location  http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os/ --vnc

Starting install...
Retrieving file .treeinfo...                                                                                                                                                                | 5.5 kB     00:00 ... 
...

Result: Guest can be installed with no error. 

2. Install a guest on a lvm pool:
# virt-install --name demo-lvm --ram 1024 --disk pool=lvmpool,size=5,device=disk --location  http://download.englab.nay.redhat.com/pub/rhel/released/RHEL-6/6.6/Server/x86_64/os/ --vnc

Starting install...
Retrieving file .treeinfo...                                                                                                                                                                | 5.5 kB     00:00 ... 
Retrieving file vmlinuz...                                                                                                                                                                  | 7.9 MB     00:00 ... 
Retrieving file initrd.img...   
...

Result: Guest can be installed with no error. 

So move this bug from ON_QA to VERIFIED.

Comment 10 errata-xmlrpc 2015-07-22 07:06:36 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