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'}
Get a PCI device's device type.

An assignable PCI device can be a normal PCI device,
a SR-IOV Physical Function (PF), or a SR-IOV Virtual
Function (VF). Only normal PCI devices or SR-IOV VFs
are assignable, while SR-IOV PFs are always owned by
hypervisor.

Please notice that a PCI device with SR-IOV
capability but not enabled is reported as normal 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'}