def _find_cached_image(session, image_id, sr_ref):
    name_label = _get_image_vdi_label(image_id)
    recs = session.call_xenapi("VDI.get_all_records_where",
                               'field "name__label"="%s"'
                               % name_label)
    number_found = len(recs)
    if number_found > 0:
        if number_found > 1:
            LOG.warning(_LW("Multiple base images for image: %s"), image_id)
        return list(recs.keys())[0]
Returns the vdi-ref of the cached image.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/xenapi/vm_utils.py/_find_cached_image