After restarting nova-compute process, I found that the pci device assigned to instance in libvirt.xml was different with the record in 'pci_devices' DB table.
Every time nova-compute was restarted, pci_tracker.allocations was reset to empty dict, it didn't contain the pci devices had been allocated to instances, so some pci devices would be reallocated to the instances, and record these pci into DB, maybe they was inconsistent with the libvirt.xml.
IOW, nova-compute would reallocated the pci device for the instance with pci request when restarting.
See details:
http://git.openstack.org/cgit/openstack/nova/tree/nova/compute/resource_tracker.py#n347
This is a probabilistic problem, not always can be reproduced. If the instance have a lot of pci devices, it happen more.
Face this bug in kilo master.
Fix proposed to branch: master /review. openstack. org/151528
Review: https:/