Bug 1474766 - Error creating pool: local variable 'srcname' referenced before assignment
Summary: Error creating pool: local variable 'srcname' referenced before assignment
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: virt-manager
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Cole Robinson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-25 11:18 UTC by Marius Gedminas
Modified: 2017-08-03 16:42 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-03 16:42:09 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1706313 0 None None None 2017-07-25 11:18:42 UTC

Description Marius Gedminas 2017-07-25 11:18:43 UTC
Description of problem:

I was trying to add an existing LVM volume group as a storage pool in virt-manager. I filled in the volume group name, then got to the dialog with source and target path entries, didn't know what to put there (see bug 1316977), so left them blank and hit Finish. I then got a popup with this error.

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

1.3.2

How reproducible:

Always

Steps to Reproduce:
1. Connect to KVM
2. Select Connection Details
3. Go to the Storage tab
4. Hit the + icon at the bottom left
5. Enter a name
6. Select Type: "logical: LVM Volume Group"
7. Hit Next
8. Leave Target Path and Source Path blank
9. Hit Finish

Actual results:

New popup shows up saying "Error creating pool: local variable 'srcname' referenced before assignment", with this traceback in the Details expander:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 90, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/createpool.py", line 446, in _async_pool_create
    poolobj = self._pool.install(create=True, meter=meter, build=build)
  File "/usr/share/virt-manager/virtinst/storage.py", line 496, in install
    xml = self.get_xml_config()
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 834, in get_xml_config
    return self._do_get_xml_config()
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 1043, in _do_get_xml_config
    self._add_parse_bits(node)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 1066, in _add_parse_bits
    return self._do_add_parse_bits(node)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 1077, in _do_add_parse_bits
    prop._set_default(self)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 506, in _set_default
    candefault, val = self._default_get_value(xmlbuilder)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 494, in _default_get_value
    return (True, self._default_cb(xmlbuilder))
  File "/usr/share/virt-manager/virtinst/storage.py", line 366, in _default_source_name
    return srcname
UnboundLocalError: local variable 'srcname' referenced before assignment

Expected results:

The Finish button is disabled until I enter a target path.  Ideally there's some placeholder text in the Target Path that mentions "/dev/vgname", assuming GTK+ supports placeholder text.

Additional info:

Originally filed at https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/1706313

Comment 1 Cole Robinson 2017-08-03 16:42:09 UTC
Thanks for the report, fixed upstream now:

commit c4826444e98428d7770c9933428e7b7b0911bbdb (HEAD -> master, origin/master, origin/HEAD)
Author: Cole Robinson <crobinso>
Date:   Thu Aug 3 12:38:37 2017 -0400

    storage: Fix 'srcname' referenced before assignment (bz #1474766)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1474766


In fact lack of target path can be valid for logical pools, if the pool name matches and lvm volgroup name on the host. We just had a bug in the code here


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