def _get_pci_passthrough_devices(self):
    "Get host PCI devices information.\n\n        Obtains pci devices information from libvirt, and returns\n        as a JSON string.\n\n        Each device information is a dictionary, with mandatory keys\n        of 'address', 'vendor_id', 'product_id', 'dev_type', 'dev_id',\n        'label' and other optional device specific information.\n\n        Refer to the objects/pci_device.py for more idea of these keys.\n\n        :returns: a JSON string containaing a list of the assignable PCI\n                  devices information\n        "
    if (not getattr(self, '_list_devices_supported', True)):
        return jsonutils.dumps([])
    try:
        dev_names = (self._conn.listDevices('pci', 0) or [])
    except libvirt.libvirtError as ex:
        error_code = ex.get_error_code()
        if (error_code == libvirt.VIR_ERR_NO_SUPPORT):
            self._list_devices_supported = False
            LOG.warn(_LW('URI %(uri)s does not support listDevices: %(error)s'), {'uri': self.uri(), 'error': ex})
            return jsonutils.dumps([])
        else:
            raise
    pci_info = []
    for name in dev_names:
        pci_dev = self._get_pcidev_info(name)
        if self._pci_device_assignable(pci_dev):
            pci_info.append(pci_dev)
    return jsonutils.dumps(pci_info)
Get host PCI devices information.

Obtains pci devices information from libvirt, and returns
as a JSON string.

Each device information is a dictionary, with mandatory keys
of 'address', 'vendor_id', 'product_id', 'dev_type', 'dev_id',
'label' and other optional device specific information.

Refer to the objects/pci_device.py for more idea of these keys.

:returns: a JSON string containaing a list of the assignable PCI
          devices information
def _get_pci_passthrough_devices(self):
    "Get host PCI devices information.\n\n        Obtains pci devices information from libvirt, and returns\n        as a JSON string.\n\n        Each device information is a dictionary, with mandatory keys\n        of 'address', 'vendor_id', 'product_id', 'dev_type', 'dev_id',\n        'label' and other optional device specific information.\n\n        Refer to the objects/pci_device.py for more idea of these keys.\n\n        :returns: a JSON string containaing a list of the assignable PCI\n                  devices information\n        "
    if (not getattr(self, '_list_devices_supported', True)):
        return jsonutils.dumps([])
    try:
        dev_names = (self._conn.listDevices('pci', 0) or [])
    except libvirt.libvirtError as ex:
        error_code = ex.get_error_code()
        if (error_code == libvirt.VIR_ERR_NO_SUPPORT):
            self._list_devices_supported = False
            LOG.warn(_LW('URI %(uri)s does not support listDevices: %(error)s'), {'uri': self.uri(), 'error': ex})
            return jsonutils.dumps([])
        else:
            raise
    pci_info = []
    for name in dev_names:
        pci_dev = self._get_pcidev_info(name)
        if self._pci_device_assignable(pci_dev):
            pci_info.append(pci_dev)
    return jsonutils.dumps(pci_info)