def QueryFields(fielddefs, selected):
  if selected is None:
    # Client requests all fields, sort by name
    fdefs = utils.NiceSort(GetAllFields(fielddefs.values()),
                           key=operator.attrgetter("name"))
  else:
    # Keep order as requested by client
    fdefs = Query(fielddefs, selected).GetFields()

  return objects.QueryFieldsResponse(fields=fdefs).ToDict()
Returns list of available fields.
dataset/ETHPy150Open ganeti/ganeti/lib/query.py/QueryFields