'Get a list pci devices that are available for pci passthtough.
We use a plugin to get the output of the lspci command runs on dom0.
From this list we will extract pci devices that are using the pciback
kernel driver.
:returns: a list of pci devices on the node'

def _get_passthrough_devices(self):

    def _compile_hex(pattern):
        'Return    a    compiled    regular    expression    pattern    into    which    we    have\n                                                replaced    occurrences    of    hex    by    [\\da-fA-F].\n                                                '
        return re.compile(pattern.replace('hex', '[\\da-fA-F]'))
    def _parse_pci_device_string(dev_string):
        'Exctract    information    from    the    device    string    about    the    slot,    the\n                                                vendor    and    the    product    ID.    The    string    is    as    follow:\n                                                                "Slot: DCTB BDF\nClass: DCTB xxxx\nVendor: DCTB xxxx\nDevice: DCTB xxxx\n..."\n                                                Return    a    dictionary    with    information    about    the    device.\n                                                '
        slot_regex = _compile_hex('Slot:\\t((?:hex{4}:)?hex{2}:hex{2}\\.hex{1})')
        vendor_regex = _compile_hex('\\nVendor:\\t(hex+)')
        product_regex = _compile_hex('\\nDevice:\\t(hex+)')
        slot_id = slot_regex.findall(dev_string)
        vendor_id = vendor_regex.findall(dev_string)
        product_id = product_regex.findall(dev_string)
        if ((not slot_id) or (not vendor_id) or (not product_id)):
            raise exception.NovaException(_('Failed    to    parse    information    about    a    pci    device    for    passthrough'))
        type_pci = host_management.get_pci_type(self._session, slot_id[0])
        return {'label': '_'.join(['label', vendor_id[0], product_id[0]]), 'vendor_id': vendor_id[0], 'product_id': product_id[0], 'address': slot_id[0], 'dev_id': '_'.join(['pci', slot_id[0]]), 'dev_type': type_pci, 'status': 'available'}
    lspci_out = host_management.get_pci_device_details(self._session)
    pci_list = lspci_out.split('\n\n')
    passthrough_devices = []
    for dev_string_info in pci_list:
        if ('Driver: DCTB pciback' in dev_string_info):
            new_dev = _parse_pci_device_string(dev_string_info)
            passthrough_devices.append(new_dev)
    return passthrough_devices
