pci detach failed with 'PciDevice' object has no attribute '__getitem__'

Bug #1565466 reported by Moshe Levi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Moshe Levi
Liberty
Fix Released
High
Moshe Levi
Mitaka
Fix Released
High
Moshe Levi

Bug Description

when doing suspend with pci device, nova tries to detach the pci device from libvrit dom.
after calling guest.detach_device nova checks the dom to ensure the detaching is finished.
 if that detach failed (because of using old qemu in my case) the _detach_pci_devices method failed with the following error instead of raising PciDeviceDetachFailed

2016-03-31 08:50:46.727 10338 DEBUG nova.objects.instance [req-225f9ed4-1f93-427b-a045-84535b3aeb55 admin demo] Lazy-loading 'pci_devices' on Instance uuid 7114fa62-10bb-45dc-b64e-b301bfce4dfa obj_load_attr /opt/stack/nova/nova/objects/instance.py:895
2016-03-31 08:50:46.727 10338 DEBUG oslo_messaging._drivers.amqpdriver [req-225f9ed4-1f93-427b-a045-84535b3aeb55 admin demo] CALL msg_id: c96a579643054867adc0e119d93cc6a9 exchange 'nova' topic 'conductor' _send /usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py:454
2016-03-31 08:50:46.745 10338 DEBUG oslo_messaging._drivers.amqpdriver [-] received reply msg_id: c96a579643054867adc0e119d93cc6a9 __call__ /usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py:302
2016-03-31 08:50:46.751 10338 DEBUG nova.virt.libvirt.config [req-225f9ed4-1f93-427b-a045-84535b3aeb55 admin demo] Generated XML ('<hostdev mode="subsystem" type="pci" managed="yes">\n <source>\n <address bus="0x04" domain="0x0000" function="0x7" slot="0x00"/>\n </source>\n</hostdev>\n',) to_xml /opt/stack/nova/nova/virt/libvirt/config.py:82
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [req-225f9ed4-1f93-427b-a045-84535b3aeb55 admin demo] [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] Setting instance vm_state to ERROR
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] Traceback (most recent call last):
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] File "/opt/stack/nova/nova/compute/manager.py", line 6588, in _error_out_instance_on_exception
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] yield
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] File "/opt/stack/nova/nova/compute/manager.py", line 4196, in suspend_instance
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] self.driver.suspend(context, instance)
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2641, in suspend
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] self._detach_sriov_ports(context, instance, guest)
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3432, in _detach_sriov_ports
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] self._detach_pci_devices(guest, sriov_devs)
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3350, in _detach_pci_devices
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] dbsf = pci_utils.parse_address(dev['address'])
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa] TypeError: 'PciDevice' object has no attribute '__getitem__'
2016-03-31 08:50:51.784 10338 ERROR nova.compute.manager [instance: 7114fa62-10bb-45dc-b64e-b301bfce4dfa]
2016-03-31 08:50:51.792 10338 DEBUG oslo_messaging._drivers.amqpdriver [req-225f9ed4-1f93-427b-a045-84535b3aeb55 admin demo] CALL msg_id: b5353aecfd4a44aa8735c46a0427a12d exchange 'nova' topic 'conductor' _send /usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py:454

Tags: libvirt pci
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/300885

Changed in nova:
assignee: nobody → Moshe Levi (moshele)
status: New → In Progress
Matt Riedemann (mriedem)
tags: added: libvirt mitaka-backport-potential
tags: added: liberty-backport-potential
Revision history for this message
Matt Riedemann (mriedem) wrote :

This was a regression in liberty due to https://github.com/openstack/nova/commit/e464267085ca45129ef9b092db41112697ddf3ca and the fact that the unit tests were passing dicts rather than the actual PciDeviceList that we get from the Instance object.

Changed in nova:
importance: Undecided → High
tags: removed: liberty-backport-potential mitaka-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/300885
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=871368bc65eb9ededd053055c35673dbb61dd3ad
Submitter: Jenkins
Branch: master

commit 871368bc65eb9ededd053055c35673dbb61dd3ad
Author: Moshe Levi <email address hidden>
Date: Sun Apr 3 15:53:36 2016 +0300

    libvirt: pci detach devices should use dev.address

    The _detach_pci_devices gets pci_devs which is list
    of PciDevice objects. The code that check if pci is
    detach is using dev['address'] and as not in the obj
    format dev.address.

    Closes-Bug: #1565466

    Change-Id: I9ba58707d03d19018a025d7760f2a77f84d23aad

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/301500

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/301502

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/mitaka)

Reviewed: https://review.openstack.org/301500
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=827ac5727c55edbd6f5112a3b9b2d52fc48a3bd1
Submitter: Jenkins
Branch: stable/mitaka

commit 827ac5727c55edbd6f5112a3b9b2d52fc48a3bd1
Author: Moshe Levi <email address hidden>
Date: Sun Apr 3 15:53:36 2016 +0300

    libvirt: pci detach devices should use dev.address

    The _detach_pci_devices gets pci_devs which is list
    of PciDevice objects. The code that check if pci is
    detach is using dev['address'] and as not in the obj
    format dev.address.

    Closes-Bug: #1565466

    Change-Id: I9ba58707d03d19018a025d7760f2a77f84d23aad
    (cherry picked from commit 871368bc65eb9ededd053055c35673dbb61dd3ad)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/liberty)

Reviewed: https://review.openstack.org/301502
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c628cd0aa0ae6659703f9f4407d0c6ed92289630
Submitter: Jenkins
Branch: stable/liberty

commit c628cd0aa0ae6659703f9f4407d0c6ed92289630
Author: Moshe Levi <email address hidden>
Date: Sun Apr 3 15:53:36 2016 +0300

    libvirt: pci detach devices should use dev.address

    The _detach_pci_devices gets pci_devs which is list
    of PciDevice objects. The code that check if pci is
    detach is using dev['address'] and as not in the obj
    format dev.address.

    Closes-Bug: #1565466

    Change-Id: I9ba58707d03d19018a025d7760f2a77f84d23aad
    (cherry picked from commit 871368bc65eb9ededd053055c35673dbb61dd3ad)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/nova 12.0.3

This issue was fixed in the openstack/nova 12.0.3 release.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/nova 14.0.0.0b1

This issue was fixed in the openstack/nova 14.0.0.0b1 development milestone.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 13.1.0

This issue was fixed in the openstack/nova 13.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.