Bug 499386

Summary: libvirt's qemu driver interprets the <hostdev> "managed" attribute incorrectly
Product: [Fedora] Fedora Reporter: Mark McLoughlin <markmc>
Component: libvirtAssignee: Mark McLoughlin <markmc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: berrange, clalance, crobinso, itamar, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 499577 (view as bug list) Environment:
Last Closed: 2009-05-06 17:37:37 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 480594    

Description Mark McLoughlin 2009-05-06 09:46:47 EDT
When using virt-install --host-device, the device XML looks like this:

    <hostdev mode='subsystem' type='pci' managed='yes'>
        <address domain='0' bus='0' slot='25' function='0'/>

With managed='yes', libvirt doesn't detach or reset the device before starting the guest, nor does it it re-attach it when the guest is shut down.

AFAICS, this is just a typo and we actually want "managed='no'"
Comment 1 Mark McLoughlin 2009-05-06 09:59:13 EDT
Okay, it turns out "managed='yes'" is supposed to detach/reset/reattach the device, not "managed='no'"

The fix should be as simple as:

@@ -1215,7 +1215,7 @@ static int qemuPrepareHostDevices(virConnectPtr conn,
         if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
-        if (!hostdev->managed) {
+        if (hostdev->managed) {
             pciDevice *dev = pciGetDevice(conn,
Comment 2 Mark McLoughlin 2009-05-06 11:41:12 EDT
Patch posted to libvir-list:

Comment 3 Cole Robinson 2009-05-06 12:37:38 EDT
Being built into libvirt-0.6.2-6.fc11 atm.
Comment 4 Mark McLoughlin 2009-05-06 16:17:32 EDT
Tag request: https://fedorahosted.org/rel-eng/ticket/1748

* Wed May  6 2009 Mark McLoughlin <markmc@redhat.com> - 0.6.2-5.fc11
- Fix handling of <hostdev managed='yes'> (bug #499386)
Comment 5 Mark McLoughlin 2009-05-06 17:37:37 EDT
Tagged now