Bug 1474766 - Error creating pool: local variable 'srcname' referenced before assignment
Error creating pool: local variable 'srcname' referenced before assignment
Product: Virtualization Tools
Classification: Community
Component: virt-manager (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Cole Robinson
Depends On:
  Show dependency treegraph
Reported: 2017-07-25 07:18 EDT by Marius Gedminas
Modified: 2017-08-03 12:42 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-08-03 12:42:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1706313 None None None 2017-07-25 07:18 EDT

  None (edit)
Description Marius Gedminas 2017-07-25 07:18:43 EDT
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):


How reproducible:


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
  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
  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 12:42:09 EDT
Thanks for the report, fixed upstream now:

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

    storage: Fix 'srcname' referenced before assignment (bz #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.