Statistics
| Branch: | Tag: | Revision:

root / lib / query.py @ 7b8ba235

History | View | Annotate | Download (77.4 kB)

# Date Author Comment
83a14695 11/27/2012 07:57 pm Helga Velroyen

Fix network query for extra stats fields

Extend _GetNetworkStatsField() to accept 4 arguments.
This fixes Issue 323.

Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Helga Velroyen <>

9675661c 11/27/2012 03:03 pm Dimitris Aragiorgis

Export UUID and serial no in network queries

Add uuid and serial_no to _NETWORK_SIMPLE_FIELDS in order to export
them in network queries. Modify gnt-network to list them too.

Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Michael Hanselmann <>

cfcea7ef 11/20/2012 07:51 pm Dimitris Aragiorgis

Minor fix in query.py

Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Iustin Pop <>

3c286190 11/20/2012 07:51 pm Dimitris Aragiorgis

Fixes to pass pep8 (make lint)

Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Iustin Pop <>

beb81ea5 11/20/2012 07:51 pm Dimitris Aragiorgis

Fixes to pass pylint (make lint)

Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Iustin Pop <>

8140e24f 11/20/2012 07:51 pm Dimitris Aragiorgis

Add tags in network objects

Support:
- gnt-network add --tags.
- gnt-network list-tags/add-tags/remove-tags/.
- gnt-network list -o +tags

Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Iustin Pop <>

d4117a72 11/20/2012 07:51 pm Apollon Oikonomopoulos

Modify instance client to support networks

Add --no-conflicts-check option.
Modify instance query methods to return nic's network info.

Signed-off-by: Apollon Oikonomopoulos <>
Signed-off-by: Dimitris Aragiorgis <>
Reviewed-by: Iustin Pop <>

306bed0e 11/20/2012 07:50 pm Apollon Oikonomopoulos

Implement LUNetworkQuery

Summarily list all existing networks
Supply detailed info for every existing network
- List used/free IPs
- List instances with NICs assigned to the corresponding network
- List NIC index and IP for the above instances

Implement complementary config methods for retrieving networks....

0422250e 10/11/2012 12:23 pm Michael Hanselmann

gnt-job: List archived jobs if requested

If requested via a filter or by including the “archived” output,
archived jobs will be loaded and shown. This is significantly slower
than just listing normal jobs, therefore by default they are not loaded
at all....

52aa1efa 10/11/2012 12:23 pm Michael Hanselmann

query: Report data type for unary operators

All data kinds (used to restrict the data collected) referenced in a
filter can be requested once it's been “compiled”. However, the kinds
of fields used in boolean expressions (e.g. ["?", "xyz"]) were not
recorded. This patch changes the code accordingly and provides a unit...

a6c7e2a2 09/03/2012 04:45 pm Iustin Pop

Move parameter title definitions to constants

This fixes an old TODO for moving these; now they can be reused in the
Haskell Query2 implementation.

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>

a9310b2f 09/03/2012 04:45 pm Iustin Pop

Fix typo in node role description

I'd rather not introduce this typo in the Haskell code too, and also
not having them identical is not good.

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>

76b62028 08/07/2012 12:48 pm Iustin Pop

Switch job IDs to numeric

This has been a long-standing cleanup item, which we've always
refrained from doing due to the high estimated effort needed.

In reality, it turned out that after some infrastructure improvements
(the previous patches), the actual job queue-related changes are quite...

7cb42171 07/20/2012 12:29 pm Nikita Staroverov

Add support for -cpu option in KVM

This adds supports for the (non-validated) cpu parameter to KVM.

Signed-off-by: Iustin Pop <>
Reviewed-by: Iustin Pop <>

87f0aa48 06/28/2012 11:38 pm Jack

Add PCI passthrough for hvm xen

This hv parameter allows passing PCI devices to virtual machines.

Signed-off-by: Guido Trotter <>
Reviewed-by: Guido Trotter <>

526f866b 06/15/2012 02:50 pm Michael Hanselmann

query: Comparison of timestamps, job IDs

This patch adds the necessary conversions for comparing split timestamps
(such as used by jobs) and job IDs (by defining custom converters).
Unittests are included.

Signed-off-by: Michael Hanselmann <>...

ad48eacc 06/14/2012 02:18 pm Michael Hanselmann

query2: Add <, >, <=, >= comparison operators

These can be used, for example, to get jobs submitted after a certain
timestamp.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

2c758845 05/11/2012 05:20 pm René Nussbaumer

query: Expose diskparamters through query

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

dff5f600 04/20/2012 07:11 pm Michael Hanselmann

Convert LUClusterConfigQuery to query2

The main intention of this patch is to make it possible to retrieve
cluster tags via query2. While at it I decided to convert
LUClusterConfigQuery right away. Some of the values returned by
LUClusterQuery are also included, but the conversion of LUClusterQuery...

0fdf247d 04/19/2012 09:04 pm Michael Hanselmann

Convert listing exports to query2

This solves one case where locks are acquired during LUXI queries.
Pretty late into the transition I noticed that OpBackupQuery had a
“use_locking” parameter for a long time, but didn't use it. Since
most of the other changes were already and this allows exports to...

9665bb3a 03/30/2012 03:03 pm Michael Hanselmann

query: Add definitions for job fields

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

8930b0f0 02/21/2012 02:33 pm Iustin Pop

Add ndp/* fields to group/node query

Also change the meaning of group ndparams to mean the actual (not
custom) nd params, and add custom_ndparams for the current meaning of
ndparams.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

edd49f9b 12/08/2011 07:24 pm Agata Murawska

Group query now calculates ipolicy

Signed-off-by: Agata Murawska <>
Reviewed-by: Iustin Pop <>

54ac87c0 11/30/2011 01:57 pm Michael Hanselmann

query: Add fields for node's disk/hv state

These fields just return the node attribute's contents. They will be
used by the watcher to detect out of date node states.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>...

31d1791a 11/22/2011 04:52 pm Guido Trotter

Query: allow query on maximum and minimum memory

be/memory is kept as an alias.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

754cc530 11/17/2011 05:24 pm Agata Murawska

Backwards compatibity - added admin_up to query

Signed-off-by: Agata Murawska <>
Reviewed-by: Michael Hanselmann <>

2e04d454 11/16/2011 03:15 pm Agata Murawska

Introduce admin_state as 3-values data type

Signed-off-by: Agata Murawska <>
Reviewed-by: Iustin Pop <>

9ca8a7c5 11/16/2011 03:15 pm Agata Murawska

Rename admin_up to admin_state

Signed-off-by: Agata Murawska <>
Reviewed-by: Iustin Pop <>

34598551 11/16/2011 03:15 pm Agata Murawska

Fixed typo in _VerifyResultRow

Signed-off-by: Agata Murawska <>
Reviewed-by: Iustin Pop <>

320e34df 11/07/2011 07:01 pm Michael Hanselmann

query: Use new SequenceToDict utility

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

2e5c33db 10/12/2011 02:01 pm Iustin Pop

Rename filter and filter_ to qfilter

We currently use 'filter' as the OpCode, QueryRequest and RAPI field
name for representing a query filter. However, since 'filter' is a
built-in function, we actually have to use filter_ throughout the code
in order to not override the built-in function....

b459a848 08/30/2011 11:24 am Andrea Spadaccini

DeprecationWarning fixes for pylint

In version 0.21, pylint unified all the disable-* (and enable-*)
directives to disable (resp. enable). This leads to a lot of
DeprecationWarning being emitted even if one uses the recommended
version of pylint (0.21.1, as stated in devnotes.rst)....

eb62069e 08/03/2011 01:37 pm Iustin Pop

Add two more compat functions

operator.itemgetter(0) → fst
operator.itemgetter(1) → snd

snd is not used yet, but it makes sense to add both.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

fab9573b 08/02/2011 12:08 pm Michael Hanselmann

Add primary/second nodes' group as query fields

These will be very useful for ganeti-watcher as it needs to retrieve
instances by group.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

6ae1fade 07/27/2011 11:38 am Iustin Pop

Fix OS queries for API v20 w/parameters

OS parameters is a list of tuples, so we can't pass it directly to
utils.NiceSort, hence we use a sort key.

This was not detected in QA since QA only tests API v10 :(

Signed-off-by: Iustin Pop <>...

b795a775 07/11/2011 05:53 pm Michael Hanselmann

Merge branch 'devel-2.4'

  • devel-2.4:
    ht: Add new check for numbers
    Fix off-by-one bug in job serial generation
    Shorten some unbreakable lines in man pages
    Correct some spelling mistakes
    Fix bug in recreate-disks for DRBD instances
    Fix a lint warning...
697f49d5 07/11/2011 05:28 pm Michael Hanselmann

ht: Add new check for numbers

Places which receive floats can usually also deal with integers, e.g.
OpTestDelay. Tests are added and the new check function is used for the
aforementioned opcode and verifying query results.

Signed-off-by: Michael Hanselmann <>...

1ffd2673 04/21/2011 04:08 pm Michael Hanselmann

masterd: Add support for tagging node groups

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

7c670076 04/18/2011 11:56 am Michael Hanselmann

Add instance query field for OS parameters

These were not available as a query field before. Update unittests
and description text for the other “..params” fields.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

bc385fa0 04/05/2011 03:20 pm Michael Hanselmann

qlang: Remove OP_GLOB operator

It'll be implemented using OP_REGEXP by the parser.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

23d0a608 04/05/2011 03:20 pm Michael Hanselmann

query: Add implementation of regex match operator

So far this operator was not implemented. This patch adds an additional
value preparation function to the function table for binary operators,
used to compile the regular expression. Unittests are included....

be3a4b14 03/14/2011 12:50 pm Michael Hanselmann

Convert OsDiagnose to query

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

425e5bf0 03/14/2011 12:48 pm Michael Hanselmann

query: Add conversion wrapper

Allows converting the value of a column before returning it. Useful for
sorting while still using one of the other generic functions for
retrieving the value.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

3b877f08 03/07/2011 03:28 pm Michael Hanselmann

query: Add operator for truth

The “?” operator is the equivalent of “if var” in Python.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

fbc263a9 03/02/2011 11:59 am Michael Hanselmann

query: Fix bug when names are specified

If the client/caller would specify names through the use of a filter,
the result would be sorted. This is a regression over earlier Ganeti
versions and verified in QA. This patch adds an optional parameter to
control the sorting and provides unittests....

fb0be379 03/01/2011 03:42 pm Michael Hanselmann

query: Add support for filters

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....

111bf531 03/01/2011 03:31 pm Michael Hanselmann

Add query field flags

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...

95eb4188 02/24/2011 03:25 pm Michael Hanselmann

Add script to generate query fields documentation

- All lines matching "QUERY_FIELDS_${resource}" in the input will be
replaced with a definition list describing the fields for $resource
- The core code is kept in the Sphinx extension, so that it could be...

79b2ca83 02/24/2011 03:25 pm Michael Hanselmann

Add query field descriptions

- Make “doc” parameter to MakeField non-optional
- Add descriptions for all fields

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

1ae17369 02/24/2011 03:25 pm Michael Hanselmann

query: Add support for field description

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

1e28e3b8 02/23/2011 08:55 pm Michael Hanselmann

Add constants for node roles

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

61a980a9 02/23/2011 03:52 pm Michael Hanselmann

Add constants for instance status

They've been hardcoded for too long.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

4cc4d1fa 02/23/2011 02:55 pm Michael Hanselmann

query: Use aliases for legacy instance NIC fields

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

f5182ecb 02/22/2011 08:03 pm Michael Hanselmann

Fix title of query field containing instance name

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

effab4ca 02/17/2011 07:25 pm Iustin Pop

NodeQuery: mark live fields as UNAVAIL for non-vm_capable nodes

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....

5d28cb6f 01/28/2011 04:31 pm Michael Hanselmann

Export console information as query field

This makes it possible to get the console information via a LUXI query.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

e431074f 01/28/2011 02:42 pm René Nussbaumer

Fix instance list for instances running multiple times

If for some reason (e.g. failed migration) one instance is running
on multiple nodes the output can become inconsistent. To get that error
and make it consistent between runs we make the call on the secondary...

e18c6c47 01/21/2011 05:36 pm Iustin Pop

Merge branch 'devel-2.4'

  • devel-2.4:
    Another fix for LUClusterVerifyDisks
    QA: also run gnt-cluster verify-disks
    Fix disk adoption breakage
    Fix typo in query2 design document
    Improve documentation for QRFS_UNAVAIL
    lvmstrap: add PV-on-partition support...
cfb084ae 01/21/2011 11:04 am René Nussbaumer

Rename QRFS_* to RS_*

This patch renames QRFS_* to RS_* fields so they can be used in other
places (i.e. LUs) without confusion, as this was initially meant for
query operations.

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

d63bd540 01/20/2011 02:05 pm Iustin Pop

query: Add alias support in _PrepareFieldList

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

e7e8037b 01/20/2011 02:05 pm Iustin Pop

Instance query: replace duplicates with aliases

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

af58707c 01/18/2011 05:55 pm Iustin Pop

query: use the actual types for BE/HV parameters

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: Iustin Pop <>...

ff4cd4d2 01/18/2011 05:55 pm Iustin Pop

query: return UNAVAIL for "wrong" HV parameters

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....

d1c3c3b3 01/18/2011 05:55 pm Iustin Pop

query: change (debug-mode) field validation errors

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....

0ca7e384 01/18/2011 05:55 pm Iustin Pop

Rename a few instance field titles

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...

e2d188cc 01/18/2011 05:55 pm Iustin Pop

query: Change internal result computation

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....

82599b3e 01/18/2011 05:55 pm Iustin Pop

Import QRFS_* and QFT_* in query.py

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...

8f8ce6d1 01/14/2011 11:27 am Michael Hanselmann

query: Update docstrings

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

b288b6f3 01/13/2011 02:09 pm René Nussbaumer

List node parameters in gnt-group list

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

8572f1fe 01/13/2011 02:08 pm René Nussbaumer

List node parameters (if any) in gnt-node info

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

52b5d286 01/06/2011 05:19 pm René Nussbaumer

Support query of node field 'powered'

This field is based on OOB support and is only available if there's oob
support for that node.

Signed-off-by: René Nussbaumer <>
Reviewed-by: Michael Hanselmann <>

8e21cfc0 01/06/2011 03:01 pm Adeodato Simo

query.py: add definitions for node group queries

Signed-off-by: Adeodato Simo <>
Reviewed-by: Michael Hanselmann <>

e571ee44 01/06/2011 03:01 pm Adeodato Simo

ganeti.query_unittest.py: test lock fields too

Additionally, change TestQueryFields.testSomeFields() to handle lists of
fields shorter than 20 elements.

Signed-off-by: Adeodato Simo <>
Reviewed-by: Michael Hanselmann <>

24d16f76 01/06/2011 12:08 pm Michael Hanselmann

Convert “gnt-debug locks” to query2

Locks can now be queried using “Query(what="lock", …)” over LUXI.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

a6070ef7 01/05/2011 12:39 pm Michael Hanselmann

query2: Add new field status “offline”

This allows “gnt-node list” to show the difference between modes marked
offline and nodes with e.g. RPC errors (“(nodata)”). node1 is the
master, node2's node daemon crashed and node3 is marked offline:

$ gnt-node list -o name,offline,dtotal,dfree...

b60fcb6f 12/21/2010 03:18 pm Michael Hanselmann

query: Add wrapper for creating response object

It'll be used for querying locks.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

aa29e95f 12/21/2010 03:18 pm Michael Hanselmann

Move QueryFields to query module

Also replace “sorted” with “utils.NiceSort” now that it supports a key
function.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

145bea54 12/13/2010 05:15 pm Michael Hanselmann

query: Handle items missing timestamps

In upgraded configurations, some items might miss the “ctime” and/or
“mtime” values and need to be handled specially.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

1c8addc6 12/10/2010 05:48 pm Michael Hanselmann

query: Add definition for instance queries

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

89ce4acc 12/08/2010 08:00 pm Michael Hanselmann

query: Improve error checking

- Show only field definition, not callback when a result row is
inconsistent
- Show list of duplicate titles if there are any (module load time)

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Adeodato Simo <>

8235fe04 11/29/2010 10:00 pm Michael Hanselmann

Add node query definition

This includes a bunch of helper functions which can be helpful for other
queries, too. Unittests are included.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

4ca96421 11/29/2010 10:00 pm Michael Hanselmann

Add utility class for definition-based data queries

While not immediately visible, using definition-based queries will allow
for a number of optimizations and simplifications. This patch just
contains the utility class used for executing queries.

Signed-off-by: Michael Hanselmann <>...