Bug 770791

Summary: Can't browse existing storage via virt-manager if an broken backing_file image exist in the default pool
Product: [Community] Virtualization Tools Reporter: yanbing du <ydu>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: berrange, crobinso, dallan, hjiang, hyao, jwu, mzhan, rwu, xen-maint, zpeng
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-30 03:24:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description yanbing du 2011-12-29 06:02:29 UTC
Description of problem:
Create a qcow2 format image in default libvirt pool and let it point at an iscsi storage(/dev/sdb) or USB stoage. Then logout the iscsi or USB storage. When create a new guest via virt-manager, the Browse dialog of "Select managed or other existing storage" can not open.
BTW, check the Connection Detail and select the Storage tab, the default pool only show up an error message:
"Error selecting pool: cannot stat file '/dev/sdb':No such file or directory"
maybe this's an expect result since there's an broken image locate at this pool.


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


How reproducible:
libvirt-0.9.8-1.el6.x86_64
virt-manager-0.9.0-7.el6.x86_64


Steps to Reproduce:
1. Create a qcow2 format image and point at an iscsi storage
#qemu-img create -f qcow2 -o backing_file=/dev/sdb /var/lib/libvirt/images/test.qcow2

2. Logout the storage
iscsiadm -m node -T iqn.2011-12.com.redhat:ydu.target0 --logout

3. Create a new guest via virt-manager, and browse existing storage for the guest.
  
Actual results:
Step3, Browse dialog can't open, and --debug output the following message:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 1240, in browse_storage
    self._browse_file(set_path, is_media=False)
  File "/usr/share/virt-manager/virtManager/create.py", line 2122, in _browse_file
    self.storage_browser.show(self.topwin, self.conn)
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 74, in show
    self.reset_state(conn)
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 183, in reset_state
    self.pool_selected()
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 257, in pool_selected
    self.populate_storage_volumes()
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 322, in populate_storage_volumes
    path = vol.get_target_path()
  File "/usr/share/virt-manager/virtManager/storagevol.py", line 49, in get_target_path
    return util.xpath(self.get_xml(), "/volume/target/path")
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 93, in get_xml
    self.refresh_xml()
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 105, in refresh_xml
    self._xml = self._XMLDesc(self._active_xml_flags)
  File "/usr/share/virt-manager/virtManager/storagevol.py", line 35, in _XMLDesc
    return self.vol.XMLDesc(flags)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 2002, in XMLDesc
    if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed', vol=self)
libvirt.libvirtError: cannot stat file '/dev/sdb': No such file or directory

Expected results:
Browse dialog of "Select managed or other existing storage" can open.

Additional info:
There's a workaround. 
If there's a boot-scratch libvirt pool, the dialog can open, and all volumes expect the broken image can be listed out.
# virsh pool-list
Name                 State      Autostart 
-----------------------------------------
boot-scratch         active     yes       
default              active     yes       

# virsh pool-dumpxml boot-scratch
<pool type='dir'>
  <name>boot-scratch</name>
  <uuid>8f8f4527-7600-7a67-e2f3-2a3a016cf49d</uuid>
  <capacity>42275766272</capacity>
  <allocation>2492018688</allocation>
  <available>39783747584</available>
  <source>
  </source>
  <target>
    <path>/var/lib/libvirt/boot</path>
    <permissions>
      <mode>0700</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Comment 2 Huming Jiang 2012-01-04 08:56:16 UTC
When i reproduced this bug, i got different result with the "additional info" content in the bug description.

If there's a boot-scratch libvirt pool, the dialog can open, but all volumes
could not be listed out.

#virt-manager --debug
...
None
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 257, in pool_selected
    self.populate_storage_volumes()
  File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 322, in populate_storage_volumes
    path = vol.get_target_path()
  File "/usr/share/virt-manager/virtManager/storagevol.py", line 49, in get_target_path
    return util.xpath(self.get_xml(), "/volume/target/path")
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 93, in get_xml
    self.refresh_xml()
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 105, in refresh_xml
    self._xml = self._XMLDesc(self._active_xml_flags)
  File "/usr/share/virt-manager/virtManager/storagevol.py", line 35, in _XMLDesc
    return self.vol.XMLDesc(flags)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 2002, in XMLDesc
    if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed', vol=self)
libvirt.libvirtError: cannot stat file '/dev/sdc': No such file or directory

# virsh pool-list 
Name                 State      Autostart 
-----------------------------------------
boot-scratch         active     yes       
default              active     yes

Comment 3 Huming Jiang 2012-01-05 08:54:41 UTC
(In reply to comment #2)
> When i reproduced this bug, i got different result with the "additional info"
> content in the bug description.
> 
> If there's a boot-scratch libvirt pool, the dialog can open, but all volumes
> could not be listed out.
> 
> #virt-manager --debug
> ...
> None
> Traceback (most recent call last):
>   File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 257, in
> pool_selected
>     self.populate_storage_volumes()
>   File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 322, in
> populate_storage_volumes
>     path = vol.get_target_path()
>   File "/usr/share/virt-manager/virtManager/storagevol.py", line 49, in
> get_target_path
>     return util.xpath(self.get_xml(), "/volume/target/path")
>   File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 93, in
> get_xml
>     self.refresh_xml()
>   File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 105, in
> refresh_xml
>     self._xml = self._XMLDesc(self._active_xml_flags)
>   File "/usr/share/virt-manager/virtManager/storagevol.py", line 35, in
> _XMLDesc
>     return self.vol.XMLDesc(flags)
>   File "/usr/lib64/python2.6/site-packages/libvirt.py", line 2002, in XMLDesc
>     if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed',
> vol=self)
> libvirt.libvirtError: cannot stat file '/dev/sdc': No such file or directory
> 
> # virsh pool-list 
> Name                 State      Autostart 
> -----------------------------------------
> boot-scratch         active     yes       
> default              active     yes



To be clear, this bug could be reproduced, only got different "addional info" result when i reproduced it.