def get_instances(self, session):
LOG.debug("<STR_LIT>")<EOL>recs = session.xenapi.VM.get_all_records()<EOL>is_inst = lambda r: (r['<STR_LIT>'].lower() == '<STR_LIT>' and<EOL>not r['<STR_LIT>'] and<EOL>not r['<STR_LIT>'] and<EOL>('<STR_LIT>' in r['<STR_LIT>'] or<EOL>r['<STR_LIT>'].startswith('<STR_LIT>')))<EOL>instances = dict()<EOL>for vm_ref, rec in recs.iteritems():<EOL><INDENT>if not is_inst(rec):<EOL><INDENT>continue<EOL><DEDENT>instances[vm_ref] = VM(ref=vm_ref,<EOL>uuid=rec["<STR_LIT>"]["<STR_LIT>"],<EOL>vifs=rec["<STR_LIT>"],<EOL>dom_id=rec["<STR_LIT>"])<EOL><DEDENT>return instances<EOL>
Returns a dict of `VM OpaqueRef` (str) -> `xapi.VM`.