Bug 1198517 - virt-install get error when specify a non-lvm pool
Summary: virt-install get error when specify a non-lvm pool
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-virtinst
Version: 6.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Giuseppe Scrivano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-04 10:26 UTC by CongDong
Modified: 2015-07-22 07:06 UTC (History)
6 users (show)

Fixed In Version: python-virtinst-0.600.0-27.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-22 07:06:36 UTC
Target Upstream Version:


Attachments (Terms of Use)


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

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


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