Statistics
| Branch: | Tag: | Revision:

root / test / ganeti.query_unittest.py @ ebfb2f46

History | View | Annotate | Download (73.3 kB)

# Date Author Comment
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...

052783ff 09/28/2012 03:14 pm Michael Hanselmann

Stop hardcoding root user

Some parts of the code still use a hardcoded user name: root. This patch
replaces all with a constant specified at build time. The end goal is to
make it possible to run a Ganeti cluster without any special privileges
(of course this will prevent some functionality from working)....

0c77c331 09/12/2012 12:27 pm René Nussbaumer

Move _CalculateGroupIPolicy and _ComputeDiskSize

This makes it possible to better untangle the IAllocator code, which
would otherwise lead to a recursive import structure as we need those
helpers there as well.

Signed-off-by: René Nussbaumer <>...

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

09532dcc 08/07/2012 12:48 pm Iustin Pop

Make jqueue unittests more generic

This patch removes/abstracts some hardcoded values in the jqueue
unittests. Currently we have a per-resource type name field, but the
name field values are hardcoded at the call sites, instead of being
abstracted into separate variables....

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

d3b51156 05/14/2012 04:49 pm René Nussbaumer

ganeti.query_unittest: Adding testcase for diskparams

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

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

query: Expose diskparamters through query

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

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

d6f58310 03/30/2012 04:49 pm Michael Hanselmann

Fix query unittests after converting jobs to query2

I missed these among some shelltest-related failures.

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

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

861610e9 11/22/2011 07:55 pm Guido Trotter

unittests: use max/min memory

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

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

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

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

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

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

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

b12d5e2e 02/28/2011 02:33 pm René Nussbaumer

Query: Add additional test to node.powered for OOB handling

This patch covers the testing of _GetNodePower of query.py not only for
unavailable but also for OOB support and returning the right
node.powered.

Signed-off-by: René Nussbaumer <>...

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

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

502b3316 02/23/2011 03:31 pm René Nussbaumer

Merge remote branch 'devel-2.4'

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

bacae536 02/23/2011 03:27 pm René Nussbaumer

query_unittest: Fix argument to set()

Commit e431074f introduced an uncatched bug. This patch fixes this. The
set is expecting a list or iteratable to work on, so it splitted the
provided instance name into a set of characters. This caused the
exp_status never been set and therefore not catched in one assert rule...

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

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

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

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

d8b7ff5f 01/06/2011 03:02 pm Adeodato Simo

ganeti.query_unittest.py: add tests for 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 <>

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

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

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