Statistics
| Branch: | Tag: | Revision:

root / htools / Ganeti / Query @ 1ba01ff7

# Date Author Comment
1ba01ff7 12/19/2012 03:45 pm Iustin Pop

Move a node-specific function to Query.Node

This shouldn't live in the main Query module, since it's too node
specific.

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

a7e484c4 12/19/2012 03:37 pm Iustin Pop

Add support for job queries in hconfd

This adds support for job queries, including (basic) unit-tests.

I've tested this for memory and cpu usage as follows:

- 3600 jobs (live queue):
- via masterd, default: ~1.1s (masterd: ~60MB ram)
- via confd, default: ~1.1s (hconfd: ~25MB ram)...

037762a9 12/19/2012 03:37 pm Iustin Pop

Change makeSimpleFilter accept NumericValues as well

This is required for QueryJobs implementation; we change
makeSimpleFilter to support both string and integers as names.

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

f94a9680 12/19/2012 03:37 pm Iustin Pop

Implement support for QFF_SPLIT_TIMESTAMP

I am very very unhappy with this patch. We have to do this, in order
to be compatible with the Python code and behaviour, but there's lots
of duplication; both the Python and the Haskell code will need to be
cleaned up and simplified (we don't need QFF_* at all)....

13b17073 12/17/2012 01:38 pm Iustin Pop

Add NFData instances for query results

This allows us to ensure that query results are strict as we build
them, instead of being lazy and only evaluated when the reply is sent
over the Luxi interface.

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

a1d137f6 12/17/2012 01:29 pm Iustin Pop

Simplify a bit the FilterRegex JSON instance

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

ad1c1e41 12/17/2012 01:29 pm Iustin Pop

Implement opcode summary support

This implements in the Haskell codebase the opcode summary. As opposed
to Python, we always use custom code for formatting, since we don't
want to use dynamic attribute lookup.

To test this properly, we need to change MetaOpCode to record-syntax,...

f74b88fa 12/13/2012 07:47 pm Iustin Pop

Log only partial response in Luxi when in debug mode

Currently, we log the entire response (at debug level) in the Luxi
replies. This is not a good idea; the logging library operates on
strings, and as such it will use huge amounts of memory: without debug...

d277b075 11/30/2012 04:17 pm Iustin Pop

Optimise recursive Query filters

Currently, the And and Or filters use very nice code, e.g. in case of
OrFilter:

any id <$> mapM evaluateFilter flts

However, looking at the memory profiles shows that application of
any/id to monadic values via '<$>' does not work nicely, losing the...

228ef0f2 11/30/2012 04:17 pm Iustin Pop

Make Query operators enforce strictness

Currently, the query operators (binop, etc.) create thunks, instead of
forcing the evaluation of the simple boolean results. This results in
higher than needed memory use.

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

139c0683 11/30/2012 03:54 pm Iustin Pop

Remove read instances from our Haskell code

It turns out that optimising 'read' derived instances (via -O) for
complex data types (like OpCode, or the various objects) can be slow
to very slow. Disabling such instances results in (time make
$all_our_haskell_binaries) large compile-time savings and also smaller...

1283cc38 11/21/2012 03:51 pm Iustin Pop

Split 'Query.Language.ItemType' in two sub-types

The QR_VIA_OP/QR_VIA_LUXI types in Python are using yet another
validation mode: QR_VIA_OP is the base type, and QR_VIA_LUXI extends
it (when doing luxi queries). But on the wire they have the same
representation....

51d991d7 11/20/2012 11:26 am Iustin Pop

Fix docstrings for the Filter type

While looking at the opcode docs and clicking accidentally on the
filter type, I saw that the haddock formatting is broken due to
non-escaped use of special chars. Let's convert the ascii-like
formatting to haddock, and have nicer apidoc....

32a569fe 11/15/2012 12:20 pm Iustin Pop

Cleanup THH function use from built module namespace

Currently, THH.hs "injects" into the built code names of library
functions like Text.JSON.makeObj, Ganeti.JSON.fromObj, etc. built
directly from strings, via (e.g.)

varE (mkName "makeObj")

This means that the "makeObj" name must exist in the target module,...

29a30533 11/12/2012 01:21 pm Iustin Pop

Remove unsafePerformIO usage

We need to change a few things, most importantly CLI options defaults,
but otherwise we already used the path to files from functions which
were already in the I/O monad, so we don't have to change much of the
code flow.

Additionally, Path.hs now has an explicit export list, to stop...

73b16ca1 11/12/2012 12:02 pm Iustin Pop

Annotate confd startup/luxi binding error

The luxi binding is now annotated for better readability.

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

4c3f55b8 11/12/2012 12:02 pm Iustin Pop

Split queryd run into prepare and exec

This will help with the general daemon split of prepare/run, and flag
errors earlier in the startup.

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

d8e7c45e 11/12/2012 12:00 pm Iustin Pop

Convert tag objects to a safer type

Currently, we keep information about the "target" of a tag operation
in a data type similar to (TagKind, Maybe String). This is unsafe, as
nothing (at the type level) prevents us from accidentally having
(TagCluster, Just "instance1.example.com"), or (TagInstance, Nothing)....

367c4241 11/08/2012 12:31 pm Dato Simó

htools: move TagObject from Luxi.hs to OpCodes.hs

In addition to ReqQueryTags in Luxi.hs, the TagObject ADT is also
required for the "kind" attribute of OpTagsSet and OpTagsDel, which
are coming to OpCodes.hs next. Hence, we move TagObject there, and
adjust imports accordingly....

5183e8be 10/25/2012 01:05 pm Iustin Pop

Convert query path from string errors to GanetiException

This patch converts all the call paths from 'Result' (which contains
just string errors) to 'ErrorResult', which holds
GanetiException-encoded errors. We can now return proper
OpPrereq/OpExec errors to the clients of the luxi/query socket....

a2ae14e9 10/11/2012 01:03 pm Iustin Pop

Add a helper for query field checks

… and also use it to simplify 'needsLiveData'. Additionally, add an
explicit export list to Ganeti.Query.Types, since otherwise we'd
(re)export all imported symbols.

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

bc4cdeef 10/11/2012 01:03 pm Iustin Pop

Add functionality for checking validity of names

This replicates in the Haskell Query2 implementation the behaviour of
the Python code: if a "simple" filter is passed (one that contains
only Or aggregators and EQ binary ops on the name field), then an
failure is flagged if the given values are not known....

a41c337e 10/11/2012 01:03 pm Iustin Pop

Use the new name filtering behaviour in query

We do this not quite generically, which means we have to add
another layer in the call chain, and rename the current query
function, plus add special-case code for each query type. Hopefully we
will be able to improve on this in the future....

1fc3812c 10/11/2012 01:03 pm Iustin Pop

Switch ordering of names on query to niceSort

This makes the "all" names queries consistent with the Python
results. The change requires updating the unittests, at which point a
duplicate error message is simplified.

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

90d033ef 10/11/2012 01:03 pm Iustin Pop

Add function for getting a group's merged disk params

… and use it in the Query implementation, removing the last
non-correct query field for Groups.

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

b04dc242 10/11/2012 01:03 pm Iustin Pop

Simplify a bit queryFields

We don't add a type class for fully-generic handling, but we do
abstract the duplicate part.

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

5227de56 10/11/2012 01:03 pm Iustin Pop

Fix the node powered field

When initially implementing the node query, I thought the 'powered'
field is a representation of the run-time powered status, which would
make its query complex.

In reality, it's a simple config query, which we can support
easily. We also add a small helper, so that we don't hardcode the...

b3d17f52 10/11/2012 01:03 pm Iustin Pop

Add a makeSimpleFilter function

And associated unittests. This will be needed for classic-style
queries.

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

cd67e337 10/11/2012 01:03 pm Iustin Pop

Add support for classic queries

This patch adds support for classic-style queries (before query2) to
the query socket server. The patch is rather trivial, since as in
Python we just piggy-back on the query2 implementation.

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

318853ab 10/10/2012 07:12 pm Iustin Pop

Fixup node disk free/total queries

The disk free/total values are optional ones, wrapped in a Maybe, so
we shouldn't directly serialise them. In order to simplify the
embedded extraction, we add a small helper function.

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

0ec87781 10/10/2012 03:03 pm Iustin Pop

Fixup hypervisor queries in node query

We need to only query the default (first enabled) hypervisor, not all
hypervisors. For this, we need to add a manual check to ensure that we
don't have a corrupt config (there's no "NonEmptyList" type…).

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

7ae97c33 10/10/2012 02:43 pm Iustin Pop

Make regex-pcre an optional dependency

This patch makes regex-pcre optional, allowing its disable via a
preprocessor define NO_REGEX_PCRE. This define will be added to
config.ac/Makefile.am in the next patch.

The patch also changes multi-line strings into string concatenation,...

edb3f937 10/10/2012 02:43 pm Iustin Pop

Fixup node live field names

The String parameter to 'nodeLiveFieldExtract' is the query2 field
name, not the RPC-layer field name. Grrr for not having a real data
type for this.

Furthermore, we add some safety check that we don't return JSNull via
rsNormal…...

cca4e6fe 09/26/2012 07:35 pm Agata Murawska

Node query now uses live data

Added support for NodeInfo RPC call as source of data for node query.

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

7f0fd838 09/26/2012 07:35 pm Agata Murawska

Node query now collects live fields

We make use of the parameter added in the previous patch and add
option to add live parameters to the query.

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

fa2c927c 09/26/2012 07:35 pm Agata Murawska

Add live parameter to query

The tests we currently have assume, that all the data required for
running the query is available - once we add live data, this will no
longer be the case.

This patch adds boolean parameter to query function, which tells it
whether to ignore live parameters gathering....

4393e075 09/26/2012 07:35 pm Agata Murawska

Conversion from RPC error to query status

Simple conversion for queries that use live fields gathered from
RPC calls.

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

40246fa0 09/26/2012 07:34 pm Agata Murawska

NodeGroup query in Haskell

Implementation of nodegroup queries in Haskell. This is not yet
complete as we are missing merged disk parameters and option
want_diskparams is not implemented.

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

d120506c 09/26/2012 07:34 pm Agata Murawska

Correct top comment in Query/Server

I assumed this was a copy-paste+forgetting to change the header comment.

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

9eeb0aa5 09/18/2012 06:11 pm Michael Hanselmann

Use autoconf-based paths from Haskell instead of constants

Future changes will change Path.hs to use an environment variable.

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

3ce788db 09/05/2012 05:31 pm Iustin Pop

Fix deserialisation bug in ResultEntry

Found via the newly added unit-tests, which test most of the
serialisation code in Query/Language (except for QueryResult, for
which we already tests both sub-components separately).

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

5b11f8db 09/05/2012 05:31 pm Iustin Pop

Further hlint fixes

Commit 2cdaf22, “Re-enable standard hlint warnings”, got it almost
right. The only problem is that (confusingly) the default set of hints
is not in HLint.Default, but in HLint.HLint (it includes Default and
some built-ins).

After changing the lint file to correctly include the defaults, we had...

b9bdc10e 09/05/2012 05:18 pm Iustin Pop

Add some unittests for node queries

These new tests check that:

- no known fields return unknown
- any unknown field returns unknown
- the type of the fields is consistent between the getters and the
field definition
- the length of each result row corresponds with the number of fields...

f3baf5ef 09/04/2012 04:51 pm Iustin Pop

Move JSON.hs and Compat.hs out from under HTools/

These two files are not htools-specific, so let's move them out of the
HTools subdirectory/module hierarchy and directly under Ganeti.

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

01606931 09/04/2012 02:00 pm Iustin Pop

Implement compilation of regexes at creation time

This means that the verification of the correctness of the regex is
done once, at the deserialisation/creation time, as in the Python
code. To do this, we have to change the FilterRegex type from an alias...

4cab6703 09/04/2012 02:00 pm Iustin Pop

Rename the Qlang and Queryd modules

Per the new query module hierarchy, rename Qlang to Query/Language and
Queryd to Query/Server. This way, all query-related functionality is
now "contained" in the Query/ directory.

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

8a65c02b 09/04/2012 02:00 pm Iustin Pop

Add filtering support in Query

This adds basic infrastructure for filtering (fully functional except,
as usual, for runtime data), and then uses it for node queries.

Since the filtering exports regex matching as an external
functionality, we have to use a regex library. There are many flavours...

518023a9 09/04/2012 01:59 pm Iustin Pop

Implement QueryFields for Nodes

Since we have all the definitions already, we can easily enable
this. Manual testing shows no difference between the Python and the
Haskell versions of node list-fields.

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

046fe3f5 09/03/2012 04:52 pm Iustin Pop

Add Query support for Nodes (no filtering, no RPC)

This is the initial support for Query2: basic infrastructure (except
filtering) and node query support (without RPC).

It implements all the fields (tests by comparison with list-fields on
the Python side), except that:...

4cbe9bda 09/03/2012 04:45 pm Iustin Pop

Stub query2 call integration into QueryD

This patch corrects the definitions in Qlang.hs to match what Python
expects on the wire; this means replacing some manual data type
definitions with 'buildObject' so that we get serialisation (and field
names) for free, adding (manually) JSON instances for types which are...