def _get_domain(*vms, **kwargs):
 ret = list()
 lookup_vms = list()
 conn = __get_conn()
 all_vms = list_domains()
 if (not all_vms):
  raise CommandExecutionError('No virtual machines found.')
 if vms:
  for vm in vms:
   if (vm not in all_vms):
    raise CommandExecutionError('The VM "{name}" is not present'.format(name=vm))
   else:
    lookup_vms.append(vm)
 else:
  lookup_vms = list(all_vms)
 for vm in lookup_vms:
  ret.append(conn.lookupByName(vm))
 return (((len(ret) == 1) and (not kwargs.get('iterable')) and ret[0]) or ret)

def _get_domain ( * vms , ** kwargs ) : ret = list ( ) lookup_vms = list ( ) conn = __get_conn ( ) all_vms = list_domains ( ) if ( not all_vms ) : raise CommandExecutionError ( 'No virtual machines found.' ) if vms : for vm in vms : if ( vm not in all_vms ) : raise CommandExecutionError ( 'The VM "{name}" is not present' . format ( name = vm ) ) else : lookup_vms . append ( vm ) else : lookup_vms = list ( all_vms ) for vm in lookup_vms : ret . append ( conn . lookupByName ( vm ) ) return ( ( ( len ( ret ) == 1 ) and ( not kwargs . get ( 'iterable' ) ) and ret [ 0 ] ) or ret )
return a domain object for the named vm or return domain object for all vms .