Bug 1087670

Summary: Error info is not clear/useful and hit AttributeError in debug mode when try to add new device "Filesystem" into guest
Product: Red Hat Enterprise Linux 7 Reporter: zhengqin <zsong>
Component: virt-managerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED UPSTREAM QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: codong, dyuan, gscrivan, lcui, mzhan, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-18 08:02:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description zhengqin 2014-04-15 02:33:26 UTC
Description of problem:

Version-Release number of selected component:

How reproducible:

Steps to Reproduce:
1. Start virt-manager with --debug, and prepare a shutoff rhel guest.
#virt-manager --debug

2. Open the guest's detail page, and click "Add Hardware" -> "Filesystem", and Error "Not supported for this hypervisor/libvirt combination" shows.

3. Click "Finish" button

Actual result:
1. Debug mode hit AttributeError:
2014-04-14 05:53:00,511 (addhardware:164): Showing addhw
2014-04-14 05:53:05,816 (error:81): error dialog message:
summary=Unable to add device: 'NoneType' object has no attribute 'virtual_device_type'
details=Unable to add device: 'NoneType' object has no attribute 'virtual_device_type'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1032, in finish
    failure, errinfo = self.add_device()
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1308, in add_device
    ret = self.setup_device()
  File "/usr/share/virt-manager/virtManager/addhardware.py", line 1301, in setup_device
    if (self._dev.virtual_device_type == self._dev.VIRTUAL_DEV_DISK and
AttributeError: 'NoneType' object has no attribute 'virtual_device_type'

2. Error info for virt-manager will show:
Unable to add device: 'NoneType' object has no attribue 'virtual_device_type'

Expected results:
1. No error will be shown in debug mode
2. It is better to disable the "Finish" button since the error shows at step 2 is good enough, and this error from virt-manager is not clear and not useful.

Additional info:
1. This issue also occurs on latest rhel6u5.

Comment 1 Giuseppe Scrivano 2014-04-18 08:02:00 UTC
fixed upstream by:

commit 06e480c8474d0c0ecce66804c473f675a47afe68
Author: Giuseppe Scrivano <gscrivan>
Date:   Thu Apr 17 11:25:01 2014 +0200

    virt-manager, addhardware: disable "Finish" with unsupported devs
    Disabled the "Finish" button in the "Add Hardware" window when the
    specified dev is not supported by the HV.
    Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1087670
    Signed-off-by: Giuseppe Scrivano <gscrivan>