1. 14 Mar, 2011 2 commits
  2. 07 Mar, 2011 1 commit
  3. 02 Mar, 2011 1 commit
  4. 01 Mar, 2011 2 commits
    • Michael Hanselmann's avatar
      query: Add support for filters · fb0be379
      Michael Hanselmann authored
      
      
      This patch adds a “compiler” for query filters, converting them to a
      callable function used while preparing the query result. In addition, a
      hints call allows some analysis to be done on the query (e.g. referenced
      names), making data collection more efficient.
      
      The depth of filters is limited to avoid exceeding the runtime's maximum
      recursion depth.
      
      More operators and other improvements can be implemented using this
      base. Extensive unittests are provided.
      Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      fb0be379
    • Michael Hanselmann's avatar
      Add query field flags · 111bf531
      Michael Hanselmann authored
      
      
      Some fields (e.g. “name”) should be treated specially when comparing for
      equality. Hypervisor names should use normal rules, but for node names,
      “node2” should be equivalent with “node2.example.com”.
      
      To make these differences, a new field for flags is added to the query
      fields. It is not added to ”objects.QueryFieldDefinition” (the first
      item) as it would be exported to clients, something not desired for
      these internal rules. Instead, an additional field is added.
      
      Other special rules, e.g. “a list of strings” for an instance's
      secondary nodes, can be implemented as flags, too.
      Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      111bf531
  5. 24 Feb, 2011 3 commits
  6. 23 Feb, 2011 3 commits
  7. 22 Feb, 2011 1 commit
  8. 17 Feb, 2011 1 commit
    • Iustin Pop's avatar
      NodeQuery: mark live fields as UNAVAIL for non-vm_capable nodes · effab4ca
      Iustin Pop authored
      
      
      Since we don't have the data per design, UNAVAIL is appropriate here,
      while NODATA is not.
      
      The patch also adds a comment: if we extend the live fields list to
      contain other data in the future, we need to reevaluate this solution.
      
      This should fix issue 143. The listing now shows (node2==ofline,
      node3==not vm_capable):
      
        Node     DTotal     DFree    MTotal     MNode     MFree Pinst Sinst
        node1    698.6G    630.5G     32.0G      1.0G     30.0G     8     7
        node2 (offline) (offline) (offline) (offline) (offline)     9     4
        node3 (unavail) (unavail) (unavail) (unavail) (unavail)     0     0
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      effab4ca
  9. 28 Jan, 2011 2 commits
  10. 21 Jan, 2011 1 commit
  11. 20 Jan, 2011 2 commits
  12. 18 Jan, 2011 6 commits
    • Iustin Pop's avatar
      query: use the actual types for BE/HV parameters · af58707c
      Iustin Pop authored
      
      
      This patch exposes the VTYPE kind of BE/HV parameters, instead of
      returning QFT_OTHER. The current situation makes a query like:
      
          gnt-instance list -o name,be/memory,oper_ram
      
      very strange looking.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      af58707c
    • Iustin Pop's avatar
      query: return UNAVAIL for "wrong" HV parameters · ff4cd4d2
      Iustin Pop authored
      
      
      If a HV parameter is required that does not apply for an instance,
      currently the code returns None. This is bad, as it means we cannot
      switch to the actual HV parameter types and validate correctly this
      field.
      
      This patch changes it so that in this case we return QRFS_UNAVAIL;
      ideally we would use a NOT_APPROPRIATE or similar field, but UNAVAIL is
      good enough (the call cannot fail in another way).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      ff4cd4d2
    • Iustin Pop's avatar
      query: change (debug-mode) field validation errors · d1c3c3b3
      Iustin Pop authored
      
      
      Currently, the single assert just checks that the entire row is
      consistent (true/false), and dumps the row and field definitions as an
      accompanying message. This makes it very hard to understand what failed.
      
      This patch changes this validation to show descriptive messages, which
      makes it much faster in diagnosing invalid result.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      d1c3c3b3
    • Iustin Pop's avatar
      Rename a few instance field titles · 0ca7e384
      Iustin Pop authored
      
      
      The conversion to querylib introduced unique field titles, which however
      did an inconsistent rename of the instance vcpus/memory fields.
      
      This patch makes both BE_MEMORY and _VCPUS be named with prefix “Config”
      (which before was “Configured_”), and drops the “Runtime” (note no
      underscore) prefix on the oper_ ones.
      
      Rationale: for numeric fields, the width of the title defines the width
      of the columns, as the numbers are usually small. Hence these columns
      (more likely used than the BE ones) would be very wide, leading to a
      not-so-nice display. I happened upon this when my terminals didn't
      manage to fit a gnt-instance list anymore.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      0ca7e384
    • Iustin Pop's avatar
      query: Change internal result computation · e2d188cc
      Iustin Pop authored
      
      
      While looking at the query library, I realized that while we have five
      field statuses, making this a 5-dimensional space, four of them are
      shrunk to a single possible value (None). Hence it should be possible to
      convert this into a single value space plus extra 4 special constants.
      
      This patch implements this, making (IMHO) the return value of normal
      functions much simpler: you simply return the desired value, instead of
      (QRFS_NORMAL, value); for the special results, you simply return
      _FS_UNAVAIL, instead of (QRFS_UNAVAIL, None). This I believe does
      simplify the code.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      e2d188cc
    • Iustin Pop's avatar
      Import QRFS_* and QFT_* in query.py · 82599b3e
      Iustin Pop authored
      
      
      Currently, the QRFT/QFT constants are used with the module (e.g.
      constants.QRFS_NORMAL) in the query library. Given that there are 176
      uses of these constants in a module that has roughly ~1200 lines in
      total (including whitespace), it makes sense to import these directly to
      improve readability.
      
      This patch does this and (IMHO) it does indeed make the code more to the
      point; the entire query library is about queries, so using these
      constants directly doesn't cause any misunderstandings.
      
      Note: the epydoc links are not changed, since we want the generated docs
      to point to the right place.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      82599b3e
  13. 14 Jan, 2011 1 commit
  14. 13 Jan, 2011 2 commits
  15. 06 Jan, 2011 4 commits
  16. 05 Jan, 2011 1 commit
  17. 21 Dec, 2010 2 commits
  18. 13 Dec, 2010 1 commit
  19. 10 Dec, 2010 1 commit
  20. 08 Dec, 2010 1 commit
  21. 29 Nov, 2010 2 commits