Statistics
| Branch: | Tag: | Revision:

root / lib / ht.py @ 5073fa0c

History | View | Annotate | Download (10.7 kB)

# Date Author Comment
ab98e236 04/22/2013 02:10 pm Michele Tartara

Add TMaybeList as a new type for parameters

This will be used as the type for the reason trail parameter.

Signed-off-by: Michele Tartara <>
Reviewed-by: Helga Velroyen <>

b3ab9a8a 02/27/2013 11:57 am Christos Stavrakakis

Fix typo in docstring

Signed-off-by: Christos Stavrakakis <>
Reviewed-by: Michele Tartara <>

dd076c21 12/04/2012 01:44 pm Iustin Pop

Add safety check on job dependency/TIsLength

If TIsLength is applied to a non-container item, it will fail (type
error) due to invalid application of len(). Since this can happen on
user-supplied data, we add an explicit TList/TTuple check (the TTuple
test is a new one)....

e055a2ab 11/30/2012 10:14 am Dimitris Aragiorgis

Introduce ht.TMaybeValueNone and ht.TValueNone

TValueNone checks if a value is "none" and TMaybeValueNone is a wrapper
of TOr(TValueNone, x). This is used by OpNetworkSetParam in order to
reset a network value (e.g. mac_prefix, gateway, etc.)

Signed-off-by: Dimitris Aragiorgis <>...

16091a6e 11/29/2012 01:33 pm Michael Hanselmann

Fix type descriptions in RAPI documentation

This patch adds descriptors to the “_CheckCIDR*” functions in opcodes
and improves the descriptions generated by “ht.TInstanceOf”, thereby
indirectly fixing bad type descriptions in the RAPI documentation.

Before this patch:...

fd9f58fd 11/23/2012 04:24 pm Iustin Pop

Introduce a TMaybe combinator

We have many cases in the code where we write TOr(TNone, a), so let's
introduce a combinator that simplifies this case.

Beside replacing the above with TMaybe(a), I did a few other parameter
fixes:

- noop change TOr(TNone, TDict) to TMaybeDict...

a138ead7 11/21/2012 08:21 am Michael Hanselmann

ht: Complain if TNone isn't listed first for TOr/TAnd

Some type descriptions are rather long. If "None" is listed at the end
or somewhere in between it is easily missed. Therefore it should be at
the beginning, e.g. "None or (long description)".

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

2c9fa1ff 11/20/2012 11:16 am Iustin Pop

Cleanup ht's use of positive/strictpositive

Currently, ht.py uses a bad terminology for positive/non-negative
numbers. Per http://en.wikipedia.org/wiki/Positive_number, this is the
correct terminology:

- A number is positive if it is greater than zero.
- A number is negative if it is less than zero....

b1e47e2d 09/12/2012 12:27 pm René Nussbaumer

Adding new multi-allocation request

Now that we've the refactoring done, we can easily add the new mode and
everything works.

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

ff8067cf 02/01/2012 08:24 am Michael Hanselmann

Add ht.TMaybeListOf type check

Replaces some uses of TOr(TNone, TListOf(…)).

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

2c0af7da 01/18/2012 06:03 pm Guido Trotter

gnt-instance modify -m|--runtime-memory

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

9eec6d67 08/12/2011 03:49 pm Michael Hanselmann

ht: Allow adding comment to type descriptions

This will be used to add some more details to type descriptions, e.g. on
opcode parameters or result values. The implementation is very similar
to “WithDesc”.

I chose to use “[…]” after finding “/*…*/” hard to read and spot. At...

bdfd7802 08/12/2011 03:12 pm Michael Hanselmann

Clarify job ID-related type checks, add unittests

Instead of a rather complicated expression only “JobId” is output. Job
ID lists (like generated by “SubmitManyJobs”) are limited to two-item
lists. Unittests are added.

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

b247c6fc 07/21/2011 08:33 am Michael Hanselmann

jqueue: Implement submitting multiple jobs with dependencies

With this change users of the “SubmitManyJobs” interface can use
relative job dependencies. Relative job IDs in dependencies are resolved
before handing the job off to the workerpool.

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

7fc548e9 07/12/2011 06:22 pm Michael Hanselmann

ht.WithDesc: Work around pylint warning

Explicitely defining “__call__” silences a pylint warning when wrapped
type check functions are used directly. I had no idea pylint is this
intelligent.

Signed-off-by: Michael Hanselmann <>
Reviewed-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 <>...

b99b607f 05/30/2011 02:08 pm Michael Hanselmann

ht: Accept both int and long as integers

This fixes a unittest failure on 32 bit systems. A recently added
unittest for ht.TJobId uses a rather large number (2347625220). On 64
bit systems it is stored as “int”. On 32 bit systems however, Python
uses “long”. The two types can be intermixed in Python as the...

8620f50e 05/27/2011 03:14 pm Michael Hanselmann

ht: Add checks for anything, regexp, job ID, container items

The check for container items is useful for tuples and/or lists with
non-uniform values. The “anything” check can be used when any value
should be accepted for an item.

The job ID check, which uses the regexp check, will be used for...

a464ce71 05/17/2011 06:05 pm Michael Hanselmann

ht: Add strict check for dictionaries

This allows checking specific dictionary items, unlike TDict
or TDictOf.

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

beff3779 03/09/2011 11:39 am René Nussbaumer

OpOobCommand: Adding power on delay

This delays the invocation of the power on of the next node. So if you
power on a bunch of nodes it will not blow the fuse.

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

8c9ee749 02/04/2011 07:05 pm Michael Hanselmann

ht: Add descriptive text representations

This patch adds text descriptions to all T* checks. Converting to a
string (e.g. str(ht.TNone)) will produce a user-readable text. This
will be used for Opcode parameter documentation.

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

5f074973 01/25/2011 07:00 pm Michael Hanselmann

ht: Add TMaybeDict check

This replaces a number of equal “ht.TOr(ht.TDict, ht.TNone)” checks.

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

8568de9e 01/04/2011 05:10 pm Michael Hanselmann

ht.TInt: Exclude boolean values

See inline comment.

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

62e0e880 10/13/2010 02:44 pm Iustin Pop

Move the parameter types to their own module

This is for cleanup, and for later reuse in other parts of the code
(outside of LUs).

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