Bug 494005

Summary: libvirt should sanitize pool paths
Product: [Fedora] Fedora Reporter: Jesse Keating <jkeating>
Component: libvirtAssignee: Cole Robinson <crobinso>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: berrange, clalance, crobinso, dcantrell, hbrock, itamar, jforbes, markmc, veillard, virt-maint, xen-maint
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.7.1-18.fc12 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-07-08 18:18:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jesse Keating 2009-04-03 17:06:59 UTC
I added a storage pool that was a directory that has a live iso in it, then I tried to create a guest using the live iso as the "install" media.  I was told no, and this is the log:

[Fri, 03 Apr 2009 09:54:13 virt-manager 7648] DEBUG (VirtualDisk:442) Path '/srv/mirror/releases/test/11-Beta/Live/F11-Beta-x86_64-Live-KDE' is target for pool 'F11-Beta-x86_64-Live-KDE'. Creating volume 'F11-Beta-x86_64-Live-KDE.iso'.
[Fri, 03 Apr 2009 09:54:13 virt-manager 7648] ERROR (storagebrowse:273) Failed to determine if storage volume in use.
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 266, in populate_storage_volumes
    size=.001)
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 180, in __init__
    self.__validate_params()
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 523, in __validate_params
    self.__check_if_path_managed()
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 453, in __check_if_path_managed
    capacity=cap, allocation=alloc, pool=pool)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 954, in __init__
    conn=conn)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 705, in __init__
    name=name, conn=self.pool._conn)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 92, in __init__
    self.name = name
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 123, in set_name
    self._check_name_collision(val)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 855, in _check_name_collision
    name))
ValueError: Name 'F11-Beta-x86_64-Live-KDE.iso' already in use by another volume.
[Fri, 03 Apr 2009 09:54:13 virt-manager 7648] DEBUG (VirtualDisk:442) Path '/srv/mirror/releases/test/11-Beta/Live/F11-Beta-x86_64-Live-KDE' is target for pool 'F11-Beta-x86_64-Live-KDE'. Creating volume 'F11-Beta-x86_64-Live-KDE.log'.
[Fri, 03 Apr 2009 09:54:13 virt-manager 7648] ERROR (storagebrowse:273) Failed to determine if storage volume in use.
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 266, in populate_storage_volumes
    size=.001)
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 180, in __init__
    self.__validate_params()
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 523, in __validate_params
    self.__check_if_path_managed()
  File "/usr/lib/python2.6/site-packages/virtinst/VirtualDisk.py", line 453, in __check_if_path_managed
    capacity=cap, allocation=alloc, pool=pool)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 954, in __init__
    conn=conn)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 705, in __init__
    name=name, conn=self.pool._conn)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 92, in __init__
    self.name = name
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 123, in set_name
    self._check_name_collision(val)
  File "/usr/lib/python2.6/site-packages/virtinst/Storage.py", line 855, in _check_name_collision
    name))
ValueError: Name 'F11-Beta-x86_64-Live-KDE.log' already in use by another volume.
[Fri, 03 Apr 2009 09:54:21 virt-manager 7648] DEBUG (DistroInstaller:134) Size must be specified for non existent volume path '/srv/mirror/releases/test/11-Beta/Live/F11-Beta-x86_64-Live-KDE/F11-Beta-x86_64-Live-KDE.iso'
[Fri, 03 Apr 2009 09:54:21 virt-manager 7648] DEBUG (error:97) Validation Error: Error setting install media location.
[Fri, 03 Apr 2009 09:54:52 virt-manager 7648] DEBUG (DistroInstaller:134) Size must be specified for non existent volume path '/srv/mirror/releases/test/11-Beta/Live/F11-Beta-x86_64-Live-KDE/F11-Beta-x86_64-Live-KDE.iso'
[Fri, 03 Apr 2009 09:54:52 virt-manager 7648] DEBUG (error:97) Validation Error: Error setting install media location.

Comment 1 Mark McLoughlin 2009-04-06 08:26:46 UTC
This:

ValueError: Name 'F11-Beta-x86_64-Live-KDE.iso' already in use by another
volume.

Sounds like virtinst thinks the volume doesn't exist and is trying to create it.

Did you perhaps create the pool, then copy the iso in and then try and create the guest? Does "virsh pool-list" list it? Try "virsh pool-refresh"?

Any SELinux errors?

Comment 2 Cole Robinson 2009-04-06 12:21:28 UTC
Jesse and I followed up offline when the bug was filed. You can't tell from the error message, but the issue is that the storage pool was defined with a spurious ending '/', like:

/some/pool/directory//

Libvirt doesn't sanitize the path at define time, but virtinst likely is when it's trying to lookup the volume path. Should be an easy fix, I'll take a look at this today.

Comment 3 Bug Zapper 2009-06-09 13:13:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 4 Cole Robinson 2010-02-27 01:53:16 UTC
Reassigning this to libvirt with a proper description.

Comment 5 Bug Zapper 2010-04-27 13:29:14 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Jesse Keating 2010-04-27 15:44:48 UTC
AFAIK this is still an issue.  putting it on rawhide and using keyword to avoid the bugzappers.

Comment 7 Daniel Berrangé 2010-04-27 15:55:52 UTC
Moving to the upstream bug tracker, since this requires some dev effort beyond scope of fedora bug fixing.

Comment 8 Cole Robinson 2010-06-03 18:54:49 UTC
This is fixed upstream now:

http://libvirt.org/git/?p=libvirt.git;a=commit;h=a7fb2258cac63b2420b51d5720a6e2b8734d818d

But we should backport to fedora, since the error case here causes lots of confusion for virt-manager users.

Comment 9 Fedora Update System 2010-06-17 16:55:57 UTC
libvirt-0.7.1-18.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/libvirt-0.7.1-18.fc12

Comment 10 Fedora Update System 2010-06-21 13:02:41 UTC
libvirt-0.7.1-18.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libvirt'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/libvirt-0.7.1-18.fc12

Comment 11 Fedora Update System 2010-07-08 18:17:31 UTC
libvirt-0.7.1-18.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.