'Find and return the root and ephemeral vdi refs for a VM.'

def _find_vdi_refs(self, vm_ref, exclude_volumes=False):

    if (not vm_ref):
        return {}
    vdi_refs = {}
    for vbd_ref in self._session.call_xenapi('VM.get_VBDs', vm_ref):
        vbd = self._session.call_xenapi('VBD.get_record', vbd_ref)
        if ((not exclude_volumes) or ('osvol' not in vbd['other_config'])):
            vdi_refs[vbd['userdevice']] = vbd['VDI']
    return vdi_refs
