def _get_pcidev_info(self, devname):
    'Returns a dict of PCI device.'

    def _get_device_type(cfgdev):
        "Get a PCI device's device type.\n\n            An assignable PCI device can be a normal PCI device,\n            a SR-IOV Physical Function (PF), or a SR-IOV Virtual\n            Function (VF). Only normal PCI devices or SR-IOV VFs\n            are assignable, while SR-IOV PFs are always owned by\n            hypervisor.\n\n            Please notice that a PCI device with SR-IOV\n            capability but not enabled is reported as normal PCI device.\n            "
        for fun_cap in cfgdev.pci_capability.fun_capability:
            if (len(fun_cap.device_addrs) != 0):
                if (fun_cap.type == 'virt_functions'):
                    return {'dev_type': 'type-PF'}
                if (fun_cap.type == 'phys_function'):
                    phys_address = ('%s:%s:%s.%s' % (fun_cap.device_addrs[0][0].replace('0x', ''), fun_cap.device_addrs[0][1].replace('0x', ''), fun_cap.device_addrs[0][2].replace('0x', ''), fun_cap.device_addrs[0][3].replace('0x', '')))
                    return {'dev_type': 'type-VF', 'phys_function': phys_address}
        return {'dev_type': 'type-PCI'}
    virtdev = self._conn.nodeDeviceLookupByName(devname)
    xmlstr = virtdev.XMLDesc(0)
    cfgdev = vconfig.LibvirtConfigNodeDevice()
    cfgdev.parse_str(xmlstr)
    address = ('%04x:%02x:%02x.%1x' % (cfgdev.pci_capability.domain, cfgdev.pci_capability.bus, cfgdev.pci_capability.slot, cfgdev.pci_capability.function))
    device = {'dev_id': cfgdev.name, 'address': address, 'product_id': cfgdev.pci_capability.product_id[2:6], 'vendor_id': cfgdev.pci_capability.vendor_id[2:6]}
    device['label'] = ('label_%(vendor_id)s_%(product_id)s' % device)
    device.update(_get_device_type(cfgdev))
    return device
Returns a dict of PCI device.
def _get_pcidev_info(self, devname):
    

    def _get_device_type(cfgdev):
        "Get a PCI device's device type.\n\n            An assignable PCI device can be a normal PCI device,\n            a SR-IOV Physical Function (PF), or a SR-IOV Virtual\n            Function (VF). Only normal PCI devices or SR-IOV VFs\n            are assignable, while SR-IOV PFs are always owned by\n            hypervisor.\n\n            Please notice that a PCI device with SR-IOV\n            capability but not enabled is reported as normal PCI device.\n            "
        for fun_cap in cfgdev.pci_capability.fun_capability:
            if (len(fun_cap.device_addrs) != 0):
                if (fun_cap.type == 'virt_functions'):
                    return {'dev_type': 'type-PF'}
                if (fun_cap.type == 'phys_function'):
                    phys_address = ('%s:%s:%s.%s' % (fun_cap.device_addrs[0][0].replace('0x', ), fun_cap.device_addrs[0][1].replace('0x', ), fun_cap.device_addrs[0][2].replace('0x', ), fun_cap.device_addrs[0][3].replace('0x', )))
                    return {'dev_type': 'type-VF', 'phys_function': phys_address}
        return {'dev_type': 'type-PCI'}
    virtdev = self._conn.nodeDeviceLookupByName(devname)
    xmlstr = virtdev.XMLDesc(0)
    cfgdev = vconfig.LibvirtConfigNodeDevice()
    cfgdev.parse_str(xmlstr)
    address = ('%04x:%02x:%02x.%1x' % (cfgdev.pci_capability.domain, cfgdev.pci_capability.bus, cfgdev.pci_capability.slot, cfgdev.pci_capability.function))
    device = {'dev_id': cfgdev.name, 'address': address, 'product_id': cfgdev.pci_capability.product_id[2:6], 'vendor_id': cfgdev.pci_capability.vendor_id[2:6]}
    device['label'] = ('label_%(vendor_id)s_%(product_id)s' % device)
    device.update(_get_device_type(cfgdev))
    return device